hardbyte / python-can

The can package provides controller area network support for Python developers
https://python-can.readthedocs.io
GNU Lesser General Public License v3.0
1.26k stars 599 forks source link

Vector canlib: _detect_available_configs method includes non-CAN channels in its return value #908

Closed dhnc4u closed 3 years ago

dhnc4u commented 4 years ago

The __detect_availableconfigs method in canlib.py for Vector returns all channels enumerated by the driver. This includes LIN, Digital/Analog I/O, ... channels, which are not in scope of a CAN library, but are supported by the connected hardware. In addition, I could not find an (implemented) way to get the channel type of the returned channels.

Based on page 63 of the XL Driver Library Manual, I propose a minor change to __detect_availableconfigs, to only return channels supporting CAN: if channel_config.channelBusCapabilities & vxlapi.XL_BUS_ACTIVE_CAP_CAN: This requires the following to be added to vxlapi.py: XL_BUS_ACTIVE_CAP_CAN = 65536

Any thoughts or things I missed ? Thanks, David.

zariiii9003 commented 4 years ago

Hello, it is implemented in the develop branch. See #641

dhnc4u commented 3 years ago

Thank you for pointing that out @zariiii9003 , I can confirm it is. This means it will only be available in Python-CAN 4.x, not 3.x, correct ? What would be the quickest way to have this fix available in a/any stable release please ?

zariiii9003 commented 3 years ago

You can use the 4.0 pre-release: pip install python-can==4.0.0.dev0 We could add it to 3.3.4 but that depends on whether @hardbyte considers this a bug or just a missing feature. I'd say it is the latter.

dhnc4u commented 3 years ago

Thank you @karlding for the commit. Slightly off-topic: Do you know if it ever has been considered to include transceiverName and serialNumber in the dictionary list returned by __detect_availableconfigs ? In our setup we have multiple Vector devices connected (vehicle level tests), and we have a hard time differentiating all the channels it returns. By adding those 2 parameters, the return value would be much clearer.

felixdivo commented 3 years ago

The original problem has been resolved. There are currently no plans for further 3.x releases (see here). Thanks @dhnc4u and @zariiii9003 for the discussion and fixes.