mirror of https://github.com/commaai/panda.git
Move CanHandle to python/ (#1550)
This commit is contained in:
parent
5af25e2a67
commit
e7894e6770
|
@ -1,6 +1,7 @@
|
|||
from .python.constants import McuType, BASEDIR, FW_PATH, USBPACKET_MAX_SIZE # noqa: F401
|
||||
from .python.spi import PandaSpiException, PandaProtocolMismatch # noqa: F401
|
||||
from .python.serial import PandaSerial # noqa: F401
|
||||
from .python.canhandle import CanHandle # noqa: F401
|
||||
from .python import (Panda, PandaDFU, # noqa: F401
|
||||
pack_can_buffer, unpack_can_buffer, calculate_checksum, unpack_log,
|
||||
DLC_TO_LEN, LEN_TO_DLC, ALTERNATIVE_EXPERIENCE, CANPACKET_HEAD_SIZE)
|
||||
|
|
|
@ -15,7 +15,7 @@ class BaseHandle(ABC):
|
|||
...
|
||||
|
||||
@abstractmethod
|
||||
def controlWrite(self, request_type: int, request: int, value: int, index: int, data, timeout: int = TIMEOUT) -> int:
|
||||
def controlWrite(self, request_type: int, request: int, value: int, index: int, data, timeout: int = TIMEOUT, expect_disconnect: bool = False):
|
||||
...
|
||||
|
||||
@abstractmethod
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
import struct
|
||||
import signal
|
||||
|
||||
from .base import BaseHandle
|
||||
|
||||
class CanHandle(object):
|
||||
|
||||
class CanHandle(BaseHandle):
|
||||
def __init__(self, p, bus):
|
||||
self.p = p
|
||||
self.bus = bus
|
||||
|
@ -29,7 +31,10 @@ class CanHandle(object):
|
|||
|
||||
return ret
|
||||
|
||||
def controlWrite(self, request_type, request, value, index, data, timeout=0):
|
||||
def close(self):
|
||||
pass
|
||||
|
||||
def controlWrite(self, request_type, request, value, index, data, timeout=0, expect_disconnect=False):
|
||||
# ignore data in reply, panda doesn't use it
|
||||
return self.controlRead(request_type, request, value, index, 0, timeout)
|
||||
|
|
@ -1,8 +1,7 @@
|
|||
#!/usr/bin/env python3
|
||||
import time
|
||||
import argparse
|
||||
from panda import Panda, McuType
|
||||
from panda.tests.pedal.canhandle import CanHandle
|
||||
from panda import Panda, CanHandle, McuType
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
|
|
@ -3,9 +3,8 @@ import os
|
|||
import time
|
||||
import subprocess
|
||||
import unittest
|
||||
from panda import Panda, BASEDIR
|
||||
from panda import Panda, CanHandle, BASEDIR
|
||||
from panda_jungle import PandaJungle # pylint: disable=import-error
|
||||
from panda.tests.pedal.canhandle import CanHandle
|
||||
|
||||
|
||||
JUNGLE_SERIAL = os.getenv("PEDAL_JUNGLE")
|
||||
|
|
Loading…
Reference in New Issue