8000 Bugfix release 2.2.1 by christiansandberg · Pull Request #357 · hardbyte/python-can · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Bugfix release 2.2.1 #357

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jul 12, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
Version 2.2.1 (2018-07-12)
=====

* Fix errors and warnings when importing library on Windows
* Fix Vector backend raising ValueError when hardware is not connected

Version 2.2.0 (2018-06-30)
=====
Expand Down
2 changes: 1 addition & 1 deletion can/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

import logging

__version__ = "2.2.0"
__version__ = "2.2.1"

log = logging.getLogger('can')

Expand Down
5 changes: 4 additions & 1 deletion can/interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@
from .util import load_config
from .interfaces import BACKENDS

from can.interfaces.socketcan.socketcan import CyclicSendTask, MultiRateCyclicSendTask
if 'linux' in sys.platform:
# Deprecated and undocumented access to SocketCAN cyclic tasks
# Will be removed in version 3.0
from can.interfaces.socketcan import CyclicSendTask, MultiRateCyclicSendTask

# Required by "detect_available_configs" for argument interpretation
if sys.version_info.major > 2:
Expand Down
13 changes: 10 additions & 3 deletions can/interfaces/vector/canlib.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

# Import Modules
# ==============
from can import BusABC, Message
from can import BusABC, Message, CanError
from can.util import len2dlc, dlc2len
from .exceptions import VectorError

Expand Down Expand Up @@ -101,6 +101,14 @@ def __init__(self, channel, can_filters=None, poll_interval=0.01,
LOG.debug('Channel index %d found', channel)
idx = vxlapi.xlGetChannelIndex(hw_type.value, hw_index.value,
hw_channel.value)
if idx < 0:
# Undocumented behavior! See issue #353.
# If hardware is unavailable, this function returns -1.
# Raise an exception as if the driver
# would have signalled XL_ERR_HW_NOT_PRESENT.
raise VectorError(vxlapi.XL_ERR_HW_NOT_PRESENT,
"XL_ERR_HW_NOT_PRESENT",
"xlGetChannelIndex")
mask = 1 << idx
LOG.debug('Channel %d, Type: %d, Mask: 0x%X',
hw_channel.value, hw_type.value, mask)
Expand Down Expand Up @@ -177,8 +185,7 @@ def __init__(self, channel, can_filters=None, poll_interval=0.01,

self._is_filtered = False
super(VectorBus, self).__init__(channel=channel, can_filters=can_filters,
poll_interval=0.01, receive_own_messages=False, bitrate=None,
rx_queue_size=256, app_name="CANalyzer", **config)
**config)

def _apply_filters(self, filters):
if filters:
Expand Down
1 change: 1 addition & 0 deletions can/interfaces/vector/vxlapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
XL_BUS_TYPE_CAN = 0x00000001

XL_ERR_QUEUE_IS_EMPTY = 10
XL_ERR_HW_NOT_PRESENT = 129

XL_RECEIVE_MSG = 1
XL_CAN_EV_TAG_RX_OK = 1024
Expand Down
0