All of lore.kernel.org
 help / color / mirror / Atom feed
* Getting manufacturer/product name for CAN interface
@ 2017-07-01 15:57 André Hartmann
  2017-07-05 15:21 ` Marcel.Birthelmer
  2017-07-05 18:01 ` Wolfgang Grandegger
  0 siblings, 2 replies; 10+ messages in thread
From: André Hartmann @ 2017-07-01 15:57 UTC (permalink / raw)
  To: linux-can

Hi SocketCAN experts and developers,

I'm one of the QtSerialBus [1] developers and added a function to scan
for available devices [2] some month ago.

For now this function reads the sysfs to create a list like this:

can0
can1
vcan0
vcan1

What I wanted to have now, is the corresponding hardware description for
each of these interfaces. For the virtual devices this would be just 
something like "Virtual CAN 0". For real hardware I'd like to get the 
manufacturer and product strings.

This information is available in dmesg when a device is connected:

[48395.500029] usb 1-4: new full-speed USB device number 7 using xhci_hcd
[48395.641496] usb 1-4: New USB device found, idVendor=0878, idProduct=1105
[48395.641501] usb 1-4: New USB device strings: Mfr=1, Product=2, 
SerialNumber=0
[48395.641504] usb 1-4: Product: USB-CANmodul2
[48395.641507] usb 1-4: Manufacturer: SYS TEC electronic GmbH

But not even ifconfig shows this:

can0      Link encap:UNSPEC  Hardware Adresse 00-01-B0-BD-...-00
           NOARP  MTU:16  Metrik:1
           RX-Pakete:0 Fehler:0 Verloren:0 Überläufe:0 Fenster:0
           TX-Pakete:0 Fehler:0 Verloren:0 Überläufe:0 Träger:0
           Kollisionen:0 Sendewarteschlangenlänge:10
           RX-Bytes:0 (0.0 B)  TX-Bytes:0 (0.0 B)

can1      Link encap:UNSPEC  Hardware Adresse 00-01-B0-BD--...-00
           NOARP  MTU:16  Metrik:1
           RX-Pakete:0 Fehler:0 Verloren:0 Überläufe:0 Fenster:0
           TX-Pakete:0 Fehler:0 Verloren:0 Überläufe:0 Träger:0
           Kollisionen:0 Sendewarteschlangenlänge:10
           RX-Bytes:0 (0.0 B)  TX-Bytes:0 (0.0 B)

Now the question: Is there a way to query manufacturer/device
information for a given interface name canX from C/C++?

Thanks in advance,
André

[1] http://code.qt.io/cgit/qt/qtserialbus.git
[2] http://doc.qt.io/qt-5/qcanbus.html#availableDevices

^ permalink raw reply	[flat|nested] 10+ messages in thread

* RE: Getting manufacturer/product name for CAN interface
  2017-07-01 15:57 Getting manufacturer/product name for CAN interface André Hartmann
@ 2017-07-05 15:21 ` Marcel.Birthelmer
  2017-07-05 18:01 ` Wolfgang Grandegger
  1 sibling, 0 replies; 10+ messages in thread
From: Marcel.Birthelmer @ 2017-07-05 15:21 UTC (permalink / raw)
  To: aha_1980, linux-can

Hi André,

> This information is available in dmesg when a device is connected:

> [48395.500029] usb 1-4: new full-speed USB device number 7 using xhci_hcd [48395.641496] usb 1-4: New USB device found, idVendor=0878, idProduct=1105 [48395.641501] usb 1-4: New USB device strings: Mfr=1, Product=2,
> SerialNumber=0
> [48395.641504] usb 1-4: Product: USB-CANmodul2 [48395.641507] usb 1-4: Manufacturer: SYS TEC electronic GmbH

The information in dmesg comes from the USB subsystem, not the CAN layer. There should be a link in the sysfs hierarchy for the CAN device that takes you to the underlying transport layer (be it USB, SPI, or whatever), and in the case of USB you can get the vendor and MFG information from there. There is no general solution, though - the closest would be the "compatible" string, but that's arbitrary and may not include the exact information you want in a useful format.

Regards,
- Marcel

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Getting manufacturer/product name for CAN interface
  2017-07-01 15:57 Getting manufacturer/product name for CAN interface André Hartmann
  2017-07-05 15:21 ` Marcel.Birthelmer
@ 2017-07-05 18:01 ` Wolfgang Grandegger
  2017-07-17 19:36   ` André Hartmann
  1 sibling, 1 reply; 10+ messages in thread
From: Wolfgang Grandegger @ 2017-07-05 18:01 UTC (permalink / raw)
  To: André Hartmann, linux-can

Hello,

Am 01.07.2017 um 17:57 schrieb André Hartmann:
> Hi SocketCAN experts and developers,
> 
> I'm one of the QtSerialBus [1] developers and added a function to scan
> for available devices [2] some month ago.
> 
> For now this function reads the sysfs to create a list like this:
> 
> can0
> can1
> vcan0
> vcan1
> 
> What I wanted to have now, is the corresponding hardware description for
> each of these interfaces. For the virtual devices this would be just 
> something like "Virtual CAN 0". For real hardware I'd like to get the 
> manufacturer and product strings.
> 
> This information is available in dmesg when a device is connected:
> 
> [48395.500029] usb 1-4: new full-speed USB device number 7 using xhci_hcd
> [48395.641496] usb 1-4: New USB device found, idVendor=0878, idProduct=1105
> [48395.641501] usb 1-4: New USB device strings: Mfr=1, Product=2, 
> SerialNumber=0
> [48395.641504] usb 1-4: Product: USB-CANmodul2
> [48395.641507] usb 1-4: Manufacturer: SYS TEC electronic GmbH
> 
> But not even ifconfig shows this:
> 
> can0      Link encap:UNSPEC  Hardware Adresse 00-01-B0-BD-...-00
>            NOARP  MTU:16  Metrik:1
>            RX-Pakete:0 Fehler:0 Verloren:0 Überläufe:0 Fenster:0
>            TX-Pakete:0 Fehler:0 Verloren:0 Überläufe:0 Träger:0
>            Kollisionen:0 Sendewarteschlangenlänge:10
>            RX-Bytes:0 (0.0 B)  TX-Bytes:0 (0.0 B)
> 
> can1      Link encap:UNSPEC  Hardware Adresse 00-01-B0-BD--...-00
>            NOARP  MTU:16  Metrik:1
>            RX-Pakete:0 Fehler:0 Verloren:0 Überläufe:0 Fenster:0
>            TX-Pakete:0 Fehler:0 Verloren:0 Überläufe:0 Träger:0
>            Kollisionen:0 Sendewarteschlangenlänge:10
>            RX-Bytes:0 (0.0 B)  TX-Bytes:0 (0.0 B)
> 
> Now the question: Is there a way to query manufacturer/device
> information for a given interface name canX from C/C++?

You can get device information via netlink interface:

  $ ip -d link show can0
  4: can0: <NOARP,ECHO> mtu 16 qdisc noop state DOWN mode DEFAULT group default qlen 10
      link/can  promiscuity 0 
      can state STOPPED restart-ms 0 
      pcan_usb: tseg1 1..16 tseg2 1..8 sjw 1..4 brp 1..64 brp-inc 1
      clock 8000000

It lists the short name of the CAN controller. Here "pcan_us", or 
"sja1000", "mscan", "flexcan" and others.

Wolfgang.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Getting manufacturer/product name for CAN interface
  2017-07-05 18:01 ` Wolfgang Grandegger
@ 2017-07-17 19:36   ` André Hartmann
  2017-07-18  6:23     ` Marc Kleine-Budde
  0 siblings, 1 reply; 10+ messages in thread
From: André Hartmann @ 2017-07-17 19:36 UTC (permalink / raw)
  To: Wolfgang Grandegger, linux-can, Marcel.Birthelmer

Hi Wolfgang and Marcel,

(sorry for the delay - I have been busy with lots of other things...)

> Hello,
> 
> Am 01.07.2017 um 17:57 schrieb André Hartmann:
>> Hi SocketCAN experts and developers,
>>
>> I'm one of the QtSerialBus [1] developers and added a function to scan
>> for available devices [2] some month ago.
>>
>> For now this function reads the sysfs to create a list like this:
>>
>> can0
>> can1
>> vcan0
>> vcan1
>>
>> What I wanted to have now, is the corresponding hardware description for
>> each of these interfaces. For the virtual devices this would be just
>> something like "Virtual CAN 0". For real hardware I'd like to get the
>> manufacturer and product strings.
>>
>> This information is available in dmesg when a device is connected:
>>
>> [48395.500029] usb 1-4: new full-speed USB device number 7 using xhci_hcd
>> [48395.641496] usb 1-4: New USB device found, idVendor=0878, idProduct=1105
>> [48395.641501] usb 1-4: New USB device strings: Mfr=1, Product=2,
>> SerialNumber=0
>> [48395.641504] usb 1-4: Product: USB-CANmodul2
>> [48395.641507] usb 1-4: Manufacturer: SYS TEC electronic GmbH
>>
>> But not even ifconfig shows this:
>>
>> can0      Link encap:UNSPEC  Hardware Adresse 00-01-B0-BD-...-00
>>             NOARP  MTU:16  Metrik:1
>>             RX-Pakete:0 Fehler:0 Verloren:0 Überläufe:0 Fenster:0
>>             TX-Pakete:0 Fehler:0 Verloren:0 Überläufe:0 Träger:0
>>             Kollisionen:0 Sendewarteschlangenlänge:10
>>             RX-Bytes:0 (0.0 B)  TX-Bytes:0 (0.0 B)
>>
>> can1      Link encap:UNSPEC  Hardware Adresse 00-01-B0-BD--...-00
>>             NOARP  MTU:16  Metrik:1
>>             RX-Pakete:0 Fehler:0 Verloren:0 Überläufe:0 Fenster:0
>>             TX-Pakete:0 Fehler:0 Verloren:0 Überläufe:0 Träger:0
>>             Kollisionen:0 Sendewarteschlangenlänge:10
>>             RX-Bytes:0 (0.0 B)  TX-Bytes:0 (0.0 B)
>>
>> Now the question: Is there a way to query manufacturer/device
>> information for a given interface name canX from C/C++?
> 
> You can get device information via netlink interface:
> 
>    $ ip -d link show can0
>    4: can0: <NOARP,ECHO> mtu 16 qdisc noop state DOWN mode DEFAULT group default qlen 10
>        link/can  promiscuity 0
>        can state STOPPED restart-ms 0
>        pcan_usb: tseg1 1..16 tseg2 1..8 sjw 1..4 brp 1..64 brp-inc 1
>        clock 8000000
> 
> It lists the short name of the CAN controller. Here "pcan_us", or
> "sja1000", "mscan", "flexcan" and others.
> 
> Wolfgang.
> 

thanks for your hints! I've investigated a bit (with PEAK and SYSTEC
adapters) and I'm partly satisfied.

Wolfgangs tip with ip -d gives me indeed the driver associated to a
CAN interface. And in /sys/class/net/can0/subsystem/can0/device/
interface I found the device string, thanks Marcel. (Full logs are
appended).

However, the most important infos are still only visible in dmesg.
It's the drivers output which CAN channel is associated with each
hardware interface, e.g.:

peak_usb 2-1.4:1.0: PEAK-System PCAN-USB Pro [...] (2 channels)
peak_usb 2-1.4:1.0 can0: attached to PCAN-USB Pro channel 0 (device 1)
peak_usb 2-1.4:1.0 can1: attached to PCAN-USB Pro channel 1 (device 0)

So if there is no way to get these infos from userspace now, I think it
would be a good addition to have this possibility. Especially if there
is more than one CAN adapter connected.

What do you think?

Best regards,
André

=== Peak PCAN-USB-Pro connected =====================================

$ dmesg | grep -i peak
[    2.330286] usb 2-1.4: Manufacturer: PEAK-System Technik GmbH
[   18.949803] peak_usb 2-1.4:1.0: PEAK-System PCAN-USB Pro hwrev 0 
serial FFFFFFFF.00000001 (2 channels)
[   18.950300] peak_usb 2-1.4:1.0 can0: attached to PCAN-USB Pro channel 
0 (device 1)
[   18.951053] peak_usb 2-1.4:1.0 can1: attached to PCAN-USB Pro channel 
1 (device 0)

$ ip -d link show can0
3: can0: <NOARP,UP,LOWER_UP,ECHO> mtu 16 qdisc pfifo_fast state UNKNOWN 
mode DEFAULT group default qlen 10
     link/can  promiscuity 0
     can state ERROR-ACTIVE restart-ms 100
     bitrate 250000 sample-point 0.875
     tq 250 prop-seg 6 phase-seg1 7 phase-seg2 2 sjw 1
     pcan_usb_pro: tseg1 1..16 tseg2 1..8 sjw 1..4 brp 1..1024 brp-inc 1
     clock 56000000

$ cat /sys/class/net/can0/subsystem/can0/device/interface
PCAN-USB-PRO-CAN Device

=== SYSTEC USB-canmodul connected ===================================

$ dmesg | grep -i systec
[10674.953674] usb 2-1.4: New USB device found, idVendor=0878, 
idProduct=1181
[10674.953686] usb 2-1.4: New USB device strings: Mfr=1, Product=2, 
SerialNumber=0
[10674.953692] usb 2-1.4: Product: USB-CANmodul2
[10674.953697] usb 2-1.4: Manufacturer: SYS TEC electronic GmbH
[10675.072589] systec_can 2-1.4:1.0: registered device: can0 (channel 
0), 00:01:b0:bd:00:00
[10675.112744] systec_can 2-1.4:1.0: registered device: can1 (channel 
1), 00:01:b0:bd:00:01

$ ip -d link show can0
6: can0: <NOARP,UP,LOWER_UP,ECHO> mtu 16 qdisc pfifo_fast state UNKNOWN 
mode DEFAULT group default qlen 10
     link/can 00:01:b0:bd:00:00 brd 00:00:00:00:00:00 promiscuity 0
     can state ERROR-ACTIVE restart-ms 100
     bitrate 250000 sample-point 0.875
     tq 250 prop-seg 6 phase-seg1 7 phase-seg2 2 sjw 1
     systec_can: tseg1 1..16 tseg2 1..8 sjw 1..4 brp 1..255 brp-inc 1
     clock 48000000

$ cat /sys/class/net/can0/subsystem/can0/device/interface
USB-CANmodul2

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Getting manufacturer/product name for CAN interface
  2017-07-17 19:36   ` André Hartmann
@ 2017-07-18  6:23     ` Marc Kleine-Budde
  2017-07-19 17:42       ` aha_1980
  0 siblings, 1 reply; 10+ messages in thread
From: Marc Kleine-Budde @ 2017-07-18  6:23 UTC (permalink / raw)
  To: André Hartmann, Wolfgang Grandegger, linux-can, Marcel.Birthelmer


[-- Attachment #1.1: Type: text/plain, Size: 1382 bytes --]

On 07/17/2017 09:36 PM, André Hartmann wrote:
> thanks for your hints! I've investigated a bit (with PEAK and SYSTEC
> adapters) and I'm partly satisfied.
> 
> Wolfgangs tip with ip -d gives me indeed the driver associated to a
> CAN interface. And in /sys/class/net/can0/subsystem/can0/device/
> interface I found the device string, thanks Marcel. (Full logs are
> appended).
> 
> However, the most important infos are still only visible in dmesg.
> It's the drivers output which CAN channel is associated with each
> hardware interface, e.g.:
> 
> peak_usb 2-1.4:1.0: PEAK-System PCAN-USB Pro [...] (2 channels)
> peak_usb 2-1.4:1.0 can0: attached to PCAN-USB Pro channel 0 (device 1)
> peak_usb 2-1.4:1.0 can1: attached to PCAN-USB Pro channel 1 (device 0)
> 
> So if there is no way to get these infos from userspace now, I think it
> would be a good addition to have this possibility. Especially if there
> is more than one CAN adapter connected.

Does the udev property dev_id help? See
http://permalink.gmane.org/gmane.linux.can/5227 for more information.

regards,
Marc

-- 
Pengutronix e.K.                  | Marc Kleine-Budde           |
Industrial Linux Solutions        | Phone: +49-231-2826-924     |
Vertretung West/Dortmund          | Fax:   +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686  | http://www.pengutronix.de   |


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Getting manufacturer/product name for CAN interface
  2017-07-18  6:23     ` Marc Kleine-Budde
@ 2017-07-19 17:42       ` aha_1980
  2017-07-19 17:52         ` Marc Kleine-Budde
  2018-01-13 15:54         ` André Hartmann
  0 siblings, 2 replies; 10+ messages in thread
From: aha_1980 @ 2017-07-19 17:42 UTC (permalink / raw)
  To: mkl; +Cc: linux-can, Marcel.Birthelmer, wg

Hi Marc,

Am Dienstag 18. Juli 2017 schrieb Marc Kleine-Budde:
> On 07/17/2017 09:36 PM, André Hartmann wrote:
> > thanks for your hints! I've investigated a bit (with PEAK and SYSTEC
> > adapters) and I'm partly satisfied.
> > 
> > Wolfgangs tip with ip -d gives me indeed the driver associated to a
> > CAN interface. And in /sys/class/net/can0/subsystem/can0/device/
> > interface I found the device string, thanks Marcel. (Full logs are
> > appended).
> > 
> > However, the most important infos are still only visible in dmesg.
> > It's the drivers output which CAN channel is associated with each
> > hardware interface, e.g.:
> > 
> > peak_usb 2-1.4:1.0: PEAK-System PCAN-USB Pro [...] (2 channels)
> > peak_usb 2-1.4:1.0 can0: attached to PCAN-USB Pro channel 0 (device 1)
> > peak_usb 2-1.4:1.0 can1: attached to PCAN-USB Pro channel 1 (device 0)
> > 
> > So if there is no way to get these infos from userspace now, I think it
> > would be a good addition to have this possibility. Especially if there
> > is more than one CAN adapter connected.
> 
> Does the udev property dev_id help? See
> http://permalink.gmane.org/gmane.linux.can/5227 for more information.

That looks indeed interesting. My Google-foo tells me the patch was included in a pull request, so it should be merged to mainline Kernel.

Let's see what I can achive.

Thanks, Andre
 
> regards,
> Marc
> 
> -- 
> Pengutronix e.K.                  | Marc Kleine-Budde           |
> Industrial Linux Solutions        | Phone: +49-231-2826-924     |
> Vertretung West/Dortmund          | Fax:   +49-5121-206917-5555 |
> Amtsgericht Hildesheim, HRA 2686  | http://www.pengutronix.de   |
> 
>

-- 
Von meinem Jolla gesendet

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Getting manufacturer/product name for CAN interface
  2017-07-19 17:42       ` aha_1980
@ 2017-07-19 17:52         ` Marc Kleine-Budde
  2018-01-13 15:54         ` André Hartmann
  1 sibling, 0 replies; 10+ messages in thread
From: Marc Kleine-Budde @ 2017-07-19 17:52 UTC (permalink / raw)
  To: aha_1980; +Cc: linux-can, Marcel.Birthelmer, wg


[-- Attachment #1.1: Type: text/plain, Size: 735 bytes --]

On 07/19/2017 07:42 PM, aha_1980@gmx.de wrote:
>> Does the udev property dev_id help? See
>> http://permalink.gmane.org/gmane.linux.can/5227 for more information.
> 
> That looks indeed interesting. My Google-foo tells me the patch was
> included in a pull request, so it should be merged to mainline
> Kernel.

Ack.

> Let's see what I can achive.

Please post you solution here, others are probably interested in it, too. :D

regards.
Marc

-- 
Pengutronix e.K.                  | Marc Kleine-Budde           |
Industrial Linux Solutions        | Phone: +49-231-2826-924     |
Vertretung West/Dortmund          | Fax:   +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686  | http://www.pengutronix.de   |


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Getting manufacturer/product name for CAN interface
  2017-07-19 17:42       ` aha_1980
  2017-07-19 17:52         ` Marc Kleine-Budde
@ 2018-01-13 15:54         ` André Hartmann
  2018-01-15 10:02           ` Marc Kleine-Budde
  1 sibling, 1 reply; 10+ messages in thread
From: André Hartmann @ 2018-01-13 15:54 UTC (permalink / raw)
  To: mkl; +Cc: linux-can, Marcel.Birthelmer, wg

Hi all,

and a (late) Happy New Year!

I finally managed to finish my patch over christmas, which is now 
included in QtSerialBus [1]. Thanks for all your help on this topic!

To summarize, I was able to get the CAN adapter description and the CAN 
channel by parsing the SysFS.

It would have been nice to extract the adapters serial number and/or an 
user-programmable device ID too (I know that Peak and SYS-TEC have such 
features), but I did not find such a property in the SysFS tree.

So if you have one more hot tip for me ... I'd appreciate it.

Thanks again, and best regards,
André

[1] 
http://code.qt.io/cgit/qt/qtserialbus.git/commit/?h=dev&id=44a449ff8f0b7cdb71e67385e1bd9a098209045e

Am 19.07.2017 um 19:42 schrieb aha_1980@gmx.de:
> Hi Marc,
> 
> Am Dienstag 18. Juli 2017 schrieb Marc Kleine-Budde:
>> On 07/17/2017 09:36 PM, André Hartmann wrote:
>>> thanks for your hints! I've investigated a bit (with PEAK and SYSTEC
>>> adapters) and I'm partly satisfied.
>>>
>>> Wolfgangs tip with ip -d gives me indeed the driver associated to a
>>> CAN interface. And in /sys/class/net/can0/subsystem/can0/device/
>>> interface I found the device string, thanks Marcel. (Full logs are
>>> appended).
>>>
>>> However, the most important infos are still only visible in dmesg.
>>> It's the drivers output which CAN channel is associated with each
>>> hardware interface, e.g.:
>>>
>>> peak_usb 2-1.4:1.0: PEAK-System PCAN-USB Pro [...] (2 channels)
>>> peak_usb 2-1.4:1.0 can0: attached to PCAN-USB Pro channel 0 (device 1)
>>> peak_usb 2-1.4:1.0 can1: attached to PCAN-USB Pro channel 1 (device 0)
>>>
>>> So if there is no way to get these infos from userspace now, I think it
>>> would be a good addition to have this possibility. Especially if there
>>> is more than one CAN adapter connected.
>>
>> Does the udev property dev_id help? See
>> http://permalink.gmane.org/gmane.linux.can/5227 for more information.
> 
> That looks indeed interesting. My Google-foo tells me the patch was included in a pull request, so it should be merged to mainline Kernel.
> 
> Let's see what I can achive.
> 
> Thanks, Andre
>   
>> regards,
>> Marc
>>
>> -- 
>> Pengutronix e.K.                  | Marc Kleine-Budde           |
>> Industrial Linux Solutions        | Phone: +49-231-2826-924     |
>> Vertretung West/Dortmund          | Fax:   +49-5121-206917-5555 |
>> Amtsgericht Hildesheim, HRA 2686  | http://www.pengutronix.de   |
>>
>>
> 


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Getting manufacturer/product name for CAN interface
  2018-01-13 15:54         ` André Hartmann
@ 2018-01-15 10:02           ` Marc Kleine-Budde
  2018-01-16 21:47             ` André Hartmann
  0 siblings, 1 reply; 10+ messages in thread
From: Marc Kleine-Budde @ 2018-01-15 10:02 UTC (permalink / raw)
  To: André Hartmann; +Cc: linux-can, Marcel.Birthelmer, wg


[-- Attachment #1.1: Type: text/plain, Size: 1968 bytes --]

On 01/13/2018 04:54 PM, André Hartmann wrote:
> Hi all,
> 
> and a (late) Happy New Year!
> 
> I finally managed to finish my patch over christmas, which is now 
> included in QtSerialBus [1]. Thanks for all your help on this topic!
> 
> To summarize, I was able to get the CAN adapter description and the CAN 
> channel by parsing the SysFS.

Why not use libudev?

> It would have been nice to extract the adapters serial number and/or an 
> user-programmable device ID too (I know that Peak and SYS-TEC have such 
> features), but I did not find such a property in the SysFS tree.
> 
> So if you have one more hot tip for me ... I'd appreciate it.

At least with my candelight and udev I can read the serial number and
other information. I suppose it's accessible via libudev somehow.

> udevadm info --path=/devices/pci0000:00/0000:00:14.0/usb1/1-2/ 
> P: /devices/pci0000:00/0000:00:14.0/usb1/1-2
> N: bus/usb/001/095
> E: BUSNUM=001
> E: DEVNAME=/dev/bus/usb/001/095
> E: DEVNUM=095
> E: DEVPATH=/devices/pci0000:00/0000:00:14.0/usb1/1-2
> E: DEVTYPE=usb_device
> E: DRIVER=usb
> E: ID_BUS=usb
> E: ID_MODEL=candleLight_USB_to_CAN_adapter
> E: ID_MODEL_ENC=candleLight\x20USB\x20to\x20CAN\x20adapter
> E: ID_MODEL_ID=606f
> E: ID_REVISION=0000
> E: ID_SERIAL=bytewerk_candleLight_USB_to_CAN_adapter_000000000002
> E: ID_SERIAL_SHORT=000000000002
> E: ID_USB_INTERFACES=:ffffff:fe0101:
> E: ID_VENDOR=bytewerk
> E: ID_VENDOR_ENC=bytewerk
> E: ID_VENDOR_FROM_DATABASE=OpenMoko, Inc.
> E: ID_VENDOR_ID=1d50
> E: MAJOR=189
> E: MINOR=94
> E: PRODUCT=1d50/606f/0
> E: SUBSYSTEM=usb
> E: TYPE=0/0/0
> E: USEC_INITIALIZED=288243366799

Marc

-- 
Pengutronix e.K.                  | Marc Kleine-Budde           |
Industrial Linux Solutions        | Phone: +49-231-2826-924     |
Vertretung West/Dortmund          | Fax:   +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686  | http://www.pengutronix.de   |


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Getting manufacturer/product name for CAN interface
  2018-01-15 10:02           ` Marc Kleine-Budde
@ 2018-01-16 21:47             ` André Hartmann
  0 siblings, 0 replies; 10+ messages in thread
From: André Hartmann @ 2018-01-16 21:47 UTC (permalink / raw)
  To: Marc Kleine-Budde; +Cc: linux-can, Marcel.Birthelmer, wg

Hi Marc,

Am 15.01.2018 um 11:02 schrieb Marc Kleine-Budde:
> On 01/13/2018 04:54 PM, André Hartmann wrote:
>> Hi all,
>>
>> and a (late) Happy New Year!
>>
>> I finally managed to finish my patch over christmas, which is now
>> included in QtSerialBus [1]. Thanks for all your help on this topic!
>>
>> To summarize, I was able to get the CAN adapter description and the CAN
>> channel by parsing the SysFS.
> 
> Why not use libudev?

So far all I needed was in sysfs, and I didn't need an extra dependecy. 
And honestly, I did not even think about libudev.

Thanks for your pointer, I'll have a look.

Regards,
André

> 
>> It would have been nice to extract the adapters serial number and/or an
>> user-programmable device ID too (I know that Peak and SYS-TEC have such
>> features), but I did not find such a property in the SysFS tree.
>>
>> So if you have one more hot tip for me ... I'd appreciate it.
> 
> At least with my candelight and udev I can read the serial number and
> other information. I suppose it's accessible via libudev somehow.
> 
>> udevadm info --path=/devices/pci0000:00/0000:00:14.0/usb1/1-2/
>> P: /devices/pci0000:00/0000:00:14.0/usb1/1-2
>> N: bus/usb/001/095
>> E: BUSNUM=001
>> E: DEVNAME=/dev/bus/usb/001/095
>> E: DEVNUM=095
>> E: DEVPATH=/devices/pci0000:00/0000:00:14.0/usb1/1-2
>> E: DEVTYPE=usb_device
>> E: DRIVER=usb
>> E: ID_BUS=usb
>> E: ID_MODEL=candleLight_USB_to_CAN_adapter
>> E: ID_MODEL_ENC=candleLight\x20USB\x20to\x20CAN\x20adapter
>> E: ID_MODEL_ID=606f
>> E: ID_REVISION=0000
>> E: ID_SERIAL=bytewerk_candleLight_USB_to_CAN_adapter_000000000002
>> E: ID_SERIAL_SHORT=000000000002
>> E: ID_USB_INTERFACES=:ffffff:fe0101:
>> E: ID_VENDOR=bytewerk
>> E: ID_VENDOR_ENC=bytewerk
>> E: ID_VENDOR_FROM_DATABASE=OpenMoko, Inc.
>> E: ID_VENDOR_ID=1d50
>> E: MAJOR=189
>> E: MINOR=94
>> E: PRODUCT=1d50/606f/0
>> E: SUBSYSTEM=usb
>> E: TYPE=0/0/0
>> E: USEC_INITIALIZED=288243366799
> 
> Marc
> 


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2018-01-16 21:47 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-07-01 15:57 Getting manufacturer/product name for CAN interface André Hartmann
2017-07-05 15:21 ` Marcel.Birthelmer
2017-07-05 18:01 ` Wolfgang Grandegger
2017-07-17 19:36   ` André Hartmann
2017-07-18  6:23     ` Marc Kleine-Budde
2017-07-19 17:42       ` aha_1980
2017-07-19 17:52         ` Marc Kleine-Budde
2018-01-13 15:54         ` André Hartmann
2018-01-15 10:02           ` Marc Kleine-Budde
2018-01-16 21:47             ` André Hartmann

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.