Page 1 of 1

Python GetAvailableHardware() and can_available_hardware_t Objects

Posted: Mon 23. Jun 2025, 21:34
by Sambo
This function returns a list of can_available_hardware_t objects.
These objects contain the following properties:
- "device"
- "hw"
- "name"
- "type"
- "channel"
- "reserved"
I find that the "device" property is always 3 for every device connected.
The PCAN-API_4_Documentation.pdf says this is "The device on which this channel is available."
I had 2 PCAN-USB and 1 PCAN_FD-USB connected. I unplugged one, but the "device" property was still 3 for the two remaining can_available_hardware_t objects.

Re: Python GetAvailableHardware() and can_available_hardware_t Objects

Posted: Tue 24. Jun 2025, 13:54
by K.Wagner
Hello,

the device ID is something "not unique" that can be set as the user needs. If you set the same ID to all your devic, then you will get also this information using the getavailableHardware function. You can change the device ID using either the PEAK Settings applet or the PCAn-View. here a picture of this in PCAN-View:
PCAN-View.png
PCAN-View.png (83.31 KiB) Viewed 12813 times

Re: Python GetAvailableHardware() and can_available_hardware_t Objects

Posted: Wed 25. Jun 2025, 01:24
by Sambo
Thanks for your response, K.Wagner, but I don't see the DeviceID property to be in the list of Available Hardware Devices.
I found my answer playing with C#, which has better type clarity.
I found the "device" property to be a PcanDevice enum value.
A device type of 3 corresponds to PcanDevice.Usb

Re: Python GetAvailableHardware() and can_available_hardware_t Objects

Posted: Wed 25. Jun 2025, 09:40
by K.Wagner
Hello,

glad to see you have found what you needed. All this information is in the documentation. It is easier looking at it first, before looking the code. Closed.