I have a USB device that is likely a CAN bus and I'm trying to interact with it. I'm wondering if anyone can offer any advice for probing and discovering what services are available. I suppose a good place to start would be to check whether or not its actually a CAN bus. I'm not certain how to do that, though.
Specifically, I'm plugged into the USB interface for a DJI Phantom quad copter. It's a small autonomous drone.
Here's what I have so far:
If I call lsusb
with the drone plugged in and powered-up,
Bus 003 Device 003: ID fff0:0008
is new. lsusb -vvv
gives the further details:
Bus 003 Device 003: ID fff0:0008
Device Descriptor:
bLength 18
bDescriptorType 1
bcdUSB 2.00
bDeviceClass 2 Communications
bDeviceSubClass 0
bDeviceProtocol 0
bMaxPacketSize0 64
idVendor 0xfff0
idProduct 0x0008
bcdDevice 1.00
iManufacturer 1 DJI CONFIF
iProduct 2 DJI CONTROLLER
iSerial 3 0001A0000000
bNumConfigurations 1
Configuration Descriptor:
bLength 9
bDescriptorType 2
wTotalLength 75
bNumInterfaces 2
bConfigurationValue 1
iConfiguration 0
bmAttributes 0x80
(Bus Powered)
MaxPower 100mA
Interface Association:
bLength 8
bDescriptorType 11
bFirstInterface 0
bInterfaceCount 2
bFunctionClass 2 Communications
bFunctionSubClass 2 Abstract (modem)
bFunctionProtocol 0 None
iFunction 4 VCOM
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 0
bAlternateSetting 0
bNumEndpoints 1
bInterfaceClass 2 Communications
bInterfaceSubClass 2 Abstract (modem)
bInterfaceProtocol 0 None
iInterface 4 VCOM
CDC Header:
bcdCDC 1.10
CDC Call Management:
bmCapabilities 0x01
call management
bDataInterface 1
CDC ACM:
bmCapabilities 0x02
line coding and serial state
CDC Union:
bMasterInterface 0
bSlaveInterface 1
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x81 EP 1 IN
bmAttributes 3
Transfer Type Interrupt
Synch Type None
Usage Type Data
wMaxPacketSize 0x0010 1x 16 bytes
bInterval 2
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 1
bAlternateSetting 0
bNumEndpoints 2
bInterfaceClass 10 CDC Data
bInterfaceSubClass 0 Unused
bInterfaceProtocol 0
iInterface 4 VCOM
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
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x82 EP 2 IN
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize 0x0040 1x 64 bytes
bInterval 0
Device Status: 0x0000
(Bus Powered)
if I call udevadm
and remove the quad copter's USB cable, I get:
UDEV [41256.502177] remove /devices/pci0000:00/0000:00:14.0/usb3/3-2/3-2:1.0/tty/ttyACM0 (tty)
UDEV [41256.502247] remove /devices/pci0000:00/0000:00:14.0/usb3/3-2/3-2:1.1 (usb)
UDEV [41256.502286] remove /devices/pci0000:00/0000:00:14.0/usb3/3-2/3-2:1.0 (usb)
UDEV [41256.502346] remove /devices/pci0000:00/0000:00:14.0/usb3/3-2 (usb)`
and when I plug it in...
`UDEV [41261.068689] add /devices/pci0000:00/0000:00:14.0/usb3/3-2 (usb)
UDEV [41261.070265] add /devices/pci0000:00/0000:00:14.0/usb3/3-2/3-2:1.0 (usb)
UDEV [41261.071507] add /devices/pci0000:00/0000:00:14.0/usb3/3-2/3-2:1.1 (usb)
UDEV [41261.072843] add /devices/pci0000:00/0000:00:14.0/usb3/3-2/3-2:1.0/tty/ttyACM0 (tty)
So I try to treat it like a CAN bus interface. It seems okay with the command:
sudo slcand -o -s6 -t hw -S 1000000 /dev/ttyACM0
i.e. no error messages, and
sudo ip link set up slcan0
creates the network interface slcan0
and ifconfig
now shows:
slcan0 Link encap:UNSPEC HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
UP RUNNING NOARP MTU:16 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:10
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
From this can anyone tell if this is really a CAN bus I'm interacting with? Or am I walking down the wrong path?
0 Answers