Skip to content

Commit 652d5cc

Browse files
committed
Implement CanProtocol for GsUsbBus
1 parent 9ad3dae commit 652d5cc

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

can/interfaces/gs_usb.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
1+
import logging
12
from typing import Optional, Tuple
23

4+
import usb
5+
from gs_usb.constants import CAN_ERR_FLAG, CAN_RTR_FLAG, CAN_EFF_FLAG, CAN_MAX_DLC
36
from gs_usb.gs_usb import GsUsb
47
from gs_usb.gs_usb_frame import GsUsbFrame, GS_USB_NONE_ECHO_ID
5-
from gs_usb.constants import CAN_ERR_FLAG, CAN_RTR_FLAG, CAN_EFF_FLAG, CAN_MAX_DLC
6-
import can
7-
import usb
8-
import logging
98

9+
import can
1010
from ..exceptions import CanInitializationError, CanOperationError
1111

12-
1312
logger = logging.getLogger(__name__)
1413

1514

@@ -56,7 +55,12 @@ def __init__(
5655
self.gs_usb.set_bitrate(bitrate)
5756
self.gs_usb.start()
5857

59-
super().__init__(channel=channel, can_filters=can_filters, **kwargs)
58+
super().__init__(
59+
channel=channel,
60+
can_filters=can_filters,
61+
protocol=can.CanProtocol.CAN_20,
62+
**kwargs,
63+
)
6064

6165
def send(self, msg: can.Message, timeout: Optional[float] = None):
6266
"""Transmit a message to the CAN bus.

0 commit comments

Comments
 (0)