Re: usb-can device
From: Oliver Hartkopp <socketcan@hartkopp.net>
Date: 2012-08-29 10:55:05
On 28.08.2012 16:30, Max S. wrote:
I've been reading the USB CDC specification, but i have to admit, its all rather dry material.
Hm - yes. You are right ... i've looked myself. It's not very intuitive %-)
I'm feeling a little lost developing on both sides of the puzzle. Can you provide me with a kind of lsusb printout of what the usb device is supposed to look like? what I've got right now is a CDC virtual com example, figured i could modify it.
Better try to follow examples from cdc_ether, like this one: https://bbs.archlinux.org/viewtopic.php?id=144056 Btw. a cdc_can driver would be located in linux/drivers/net/usb. I would suggest to look into cdc-phonet.c and cdc_ncm.c which are doing similar things as we need, e.g. PF_PHONET -> cdc-phonet => PF_CAN -> cdc_can Regards, Oliver
Device Descriptor:
bLength 18
bDescriptorType 1
bcdUSB 2.00
bDeviceClass 2 Communications
bDeviceSubClass 0
bDeviceProtocol 0
bMaxPacketSize0 64
idVendor 0x03eb Atmel Corp.
idProduct 0x2404
bcdDevice 1.00
iManufacturer 1 ATMEL ASF
iProduct 2 CDC Virtual Com
iSerial 0
bNumConfigurations 1
Configuration Descriptor:
bLength 9
bDescriptorType 2
wTotalLength 67
bNumInterfaces 2
bConfigurationValue 1
iConfiguration 0
bmAttributes 0xc0
Self Powered
MaxPower 100mA
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 0
bAlternateSetting 0
bNumEndpoints 1
bInterfaceClass 2 Communications
bInterfaceSubClass 2 Abstract (modem)
bInterfaceProtocol 1 AT-commands (v.25ter)
iInterface 0
CDC Header:
bcdCDC 1.10
CDC ACM:
bmCapabilities 0x02
line coding and serial state
CDC Union:
bMasterInterface 0
bSlaveInterface 1
CDC Call Management:
bmCapabilities 0x03
call management
use DataInterface
bDataInterface 1
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x83 EP 3 IN
bmAttributes 3
Transfer Type Interrupt
Synch Type None
Usage Type Data
wMaxPacketSize 0x0040 1x 64 bytes
bInterval 16
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 1
bAlternateSetting 0
bNumEndpoints 2
bInterfaceClass 10 CDC Data
bInterfaceSubClass 0 Unused
bInterfaceProtocol 0
iInterface 0
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x81 EP 1 IN
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize 0x0040 1x 64 bytes
bInterval 0
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x02 EP 2 OUT
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize 0x0040 1x 64 bytes
bInterval 0
Device Status: 0x0001
Self Powered
Max S.