Linux USB Serial
Hello-
Looking to provide support under Linux for our device which implements a USB virtual serial port using the Communications Device Class.
The device enumerates and communicates correctly under Windows XP, and shows up under lsusb -v command as:
Bus 005 Device 005: ID 0c6a:0005
Device Descriptor:
bLength 18
bDescriptorType 1
bcdUSB 2.00
bDeviceClass 2 Communications bDeviceSubClass 0 bDeviceProtocol 0 bMaxPacketSize0 64 idVendor 0x0c6a idProduct 0x0005 bcdDevice 1.00 iManufacturer 1 ACS iProduct 2 ACS-LCD-Color-320x240 iSerial 3 1.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 32
bInterfaceProtocol 0
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 0x00
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 0x0008 1x 8 bytes
bInterval 255
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 0x01 EP 1 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)
However it does not show up without the -verbose option.
Trying to load the usbserial module to activate the device results in the following error:
FATAL: Module vendor=0x0c6a not found.
Can anyone provide assistance in how to troubleshoot why Linux is not happy with this USB device ?
Thank you,
Steven J. Ackerman, Consultant
ACS, Sarasota, FL
http://www.acscontrol.com
mailto:[email protected]
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 8 lines · Steven J. Ackerman
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 0
bAlternateSetting 0
bNumEndpoints 1
bInterfaceClass 2 Communications
bInterfaceSubClass 32
Looks like your bInterfaceSubClass is nibble swapped. It should be 0x02 for ACM, not 0x20.
Bjørn
--
To unsubscribe from this list: send the line "unsubscribe linux-serial" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Bjrn-
Thank you for your response.
This change gets me closer. I can now successfully execute the modprobe without error, but the device still doesn't show up in /dev/ttyUSB? .
sja@UBUNTU-10:~$ sudo modprobe usbserial vendor=0x0c6a product=0x0005 sja@UBUNTU-10:~$ lsusb Bus 005 Device 004: ID 0c6a:0005 Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub Bus 002 Device 003: ID 045e:0048 Microsoft Corp. Office Keyboard 1.0A Bus 002 Device 002: ID 0557:7000 ATEN International Co., Ltd Hub Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
I guess it's still not happy about something...
Steven J. Ackerman, Consultant
ACS, Sarasota, FL
http://www.acscontrol.com
mailto:[email protected]
Quoted 18 lines
-----Original Message-----
From: Bjørn Mork [mailto:[email protected]]
Sent: Monday, September 17, 2012 4:08 PM
To: Steven J. Ackerman
Cc: [email protected]; [email protected]
Subject: Re: Linux USB SerialQuoted 8 lines · Steven J. Ackerman
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 0
bAlternateSetting 0
bNumEndpoints 1
bInterfaceClass 2 Communications
bInterfaceSubClass 32
Quoted 5 lines
Looks like your bInterfaceSubClass is nibble swapped. It should be
0x02for ACM, not0x20.Bjrn
--
To unsubscribe from this list: send the line "unsubscribe linux-serial" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Greg KH
maintainerQuoted 8 lines · Steven J. Ackerman
Bjrn-
Thank you for your response.
This change gets me closer. I can now successfully execute the modprobe without error, but the device still doesn't show up in
/dev/ttyUSB? .sja@UBUNTU-10:~$ sudo modprobe usbserial vendor=0x0c6a product=0x0005
Eeek, no, never do that with a device you actually want to use. This should be controlled by the cdc-acm driver, not the usbserial driver. That driver should be auto-loaded for this device, but it looks like the descriptor is wrong, so it's not binding to it.
Are you able to test a patch and rebuild the kernel to see if we can get this to work properly?
thanks,
greg k-h
Greg-
Thanks for your response.
Not sure if I need the cdc-acm functionality or not.
This is a color lcd display that supports a usb serial interface to interact. I really
just need to be able to send and receive characters and NAK the pipe back temporarily when my input buffer is full.
The descriptors were supplied by the chip vendor - Renesas - as part of a CDC demo application. The VID/PID is ours. The device works great under Windows XP with the descriptors as shown previously - even with the Communications bInterfaceSubClass value wrong.
Doing the modprobe, etc. was based upon some blog posts that purported to show how to add support for an unknown usb serial device.
Looking at the descriptor for a FTDI USB serial to TTL cable it seems a lot simpler,
but it does indicate vendor specific class, subclass and protocol - which means
that it requires a custom driver - ftdi_sio - right ? I don't really want to have to
develop and support that.
I don't think that I have enough Linux experience to be able to test a patch
and rebuild of the kernel, and I don't think that I can ask my customers to do
that it order to use our product as a simple serial display.
I'm running Ubuntu 10.10.
Any additional pointers and/or ideas would be greatly appreciated.
Thank you again,
Steven J. Ackerman, Consultant
ACS, Sarasota, FL
http://www.acscontrol.com
mailto:[email protected]
Quoted 23 lines
-----Original Message-----
From: Greg KH [mailto:[email protected]]
Sent: Monday, September 17, 2012 5:42 PM
To: Steven J. Ackerman
Cc: 'Bjørn Mork'; [email protected]; [email protected]
Subject: Re: Linux USB SerialQuoted 8 lines · Steven J. Ackerman
Bjrn-
Thank you for your response.
This change gets me closer. I can now successfully execute the modprobe without error, but the device still doesn't show up in
/dev/ttyUSB? .sja@UBUNTU-10:~$ sudo modprobe usbserial vendor=0x0c6aproduct=0x0005
Eeek, no, never do that with a device you actually want to use. This should be controlled by the cdc-acm driver, not the usbserial driver. That driver should be auto-loaded for this device, but it looks like the descriptor is wrong, so it's not binding to it.
Quoted 6 lines
Are you able to test a patch and rebuild the kernel to see if we can get this to work properly?
thanks,
greg k-h
--
To unsubscribe from this list: send the line "unsubscribe linux-serial" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
A: No.
Q: Should I include quotations after my reply?
http://daringfireball.net/2007/07/on_top
Quoted 10 lines · Steven J. Ackerman
Greg-
Thanks for your response.
Not sure if I need the cdc-acm functionality or not.
This is a color lcd display that supports a usb serial interface to interact. I really
just need to be able to send and receive characters and NAK the pipe back temporarily when my input buffer is full.
That's fine, the cdc-acm interface will work for that.
Quoted 4 lines
The descriptors were supplied by the chip vendor - Renesas - as part of a CDC demo application. The VID/PID is ours. The device works great under Windows XP with the descriptors as shown previously - even with the Communications bInterfaceSubClass value wrong.
But is your device really a CDC ACM device? Or is it something else?
Quoted 2 lines
Doing the modprobe, etc. was based upon some blog posts that purported to show how to add support for an unknown usb serial device.
Yes, but that's a one-off, and your kernel should have told you that you shouldn't be doing that, if you are using a modern kernel release.
Quoted 7 lines
Looking at the descriptor for a FTDI USB serial to TTL cable it seems a lot simpler,
but it does indicate vendor specific class, subclass and protocol - which means
that it requires a custom driver -ftdi_sio- right ? I don't really want to have to
develop and support that.
You wouldn't, if you use the ftdi serial chip in your device. Which begs me to ask, what type of usb to serial chip is in your device? What protocol does it use to talk to the host?
Quoted 3 lines
I don't think that I have enough Linux experience to be able to test a patch and rebuild of the kernel, and I don't think that I can ask my customers to do that it order to use our product as a simple serial display.
They shouldn't have to do that, once we get it working, they get the update automatically from their distro. But if you can't test any changes we make to try to get this to work, there's not much we can do here, right?
I think you need to figure out the protocol used by your device to talk to the host. If you get that worked out, we can help to get Linux working with it.
Oh, and fix that descriptor up in your firmware, that might solve everything :)
Hope this helps,
greg k-h
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 3 lines
That's fine, the cdc-acm interface will work for that.
But is your device really a CDC ACM device? Or is it something else?
The device is a 3.5" color LCD display with touchscreen that can act as a serial
terminal. It just needs to be able to send and receive characters over an USB
serial port.
Quoted 3 lines
You wouldn't, if you use the ftdi serial chip in your device. Which begs me to ask, what type of usb to serial chip is in your device? What protocol does it use to talk to the host?
The device is based upon a Renesas RX62N processor which has a USB interface
in it. The protocol is supposedly based upon the CDC - a control endpoint and
two bulk endpoints. The software was derived from a demo supplied by the manufacturer - and it does work under Windows. The device enumerates as a COM port and you can interact with the display using a program or a terminal
emulator. Unfortunately the chip vendor doesn't have any support for Linux.
Quoted 5 lines
They shouldn't have to do that, once we get it working, they get the update automatically from their distro. But if you can't test any changes we make to try to get this to work, there's not much we can do here, right?
I guess that I'm operating under the assumption that there is something wrong on my end - an incorrectly configured descriptor for example. It appears
the other USB serial devices work OK under Linux - even without custom drivers. I'm hoping that I can find an error message somewhere that will tell me what I'm doing wrong - or that somebody who has been down that path before can't point to something obvious - like Bjrn did.
Quoted 2 lines
Oh, and fix that descriptor up in your firmware, that might solve everything :)
Going through the USB CDC documentation between e-mails. Other than the incorrect bInterfaceSubClass value - which I have corrected - nothing else seems wrong.
Quoted 4 lines
Hope this helps,
greg k-h
Always appreciate your assistance - thank you!
Steven J. Ackerman, Consultant
ACS, Sarasota, FL
http://www.acscontrol.com
mailto:[email protected]
Quoted 6 lines · On Monday 17 September 2012 17:07:26 Steven J. Ackerman wrote:
Bjrn-
Thank you for your response.
This change gets me closer. I can now successfully execute the modprobe without error, but the device still doesn't show up in
/dev/ttyUSB? .
It shouldn't. Your device follows the CDC ACM specification, aside from the incorrect subclass. Such devices don't generate /dev/ttyUSB devices nodes. They generate /dev/ttyACM nodes.
Quoted 1 line
sja@UBUNTU-10:~$ sudo modprobe usbserial vendor=0x0c6a product=0x0005
That is the wrong driver. usbserial is for vendor specific serial devices. Your device follows a class specification. You need cdc_acm. As soon as the subclass is fixed, it should autoload.
If cdc_acm doesn't bind, please post "dmesg".
Regards
Oliver
Quoted 4 lines
It shouldn't. Your device follows the CDC ACM specification, aside from the incorrect subclass. Such devices don't generate
/dev/ttyUSBdevices nodes. They generate/dev/ttyACMnodes.
Thank you. I did some more research on this last night and found out that I was being mis-lead by observing how other USB Serial devices were working and used under Linux - without having to install a driver. Apparently
these were all using the FTDI chip - and there is a driver that is already installed for them.
Quoted 4 lines
That is the wrong driver. usbserial is for vendor specific serial devices. Your device follows a class specification. You need
cdc_acm. As soon as the subclass is fixed, it should autoload.
Yes - the driver now autoloads and I can communicate with the device using the /dev/ttyACM0 node. I was able to install picocom and talk to and from our display.
Thanks to everyone who replied to this question for your assistance.
Steven J. Ackerman, Consultant
ACS, Sarasota, FL
http://www.acscontrol.com
mailto:[email protected]
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html