(resent as plain text) Thankyou very much for your quick answers. I attach the output of lsusb -v for our device (FAST ComTec S7889/MCS6) to this email. It uses the same vendor/product id's as a "D-Link DSB-R100 USB FM radio" dsbr100. I have inserted a line "blacklist dsbr100" into /etc/modprobe.d to prevent loading the dsbr100 driver, but our device is still listed as a "FM radio". You are right, our (high speed) device may not work with every controller fulfilling the USB 2.0 specification, but in practice the USB controllers and USB interface chips allow to set a different wMaxPacketsize than 512 and our Windows driver works fine. We use 64 byte bulk in and out endpoints for reading and writing parameters into / from the device and a 1024 byte bulk endpoint for fast data transfer from the device. These packet sizes were optimized for a data throughput as high as possible. I hope the Linux core will have no problem with it, like Windows. My present linux driver version follows Greg's skeleton example and uses usb_register_dev(struct usb_interface *intf, struct usb_class_driver *class_driver) for registering, but the struct usb_class_driver has only one minor_base and struct file_operations and I can register only one such driver. > You can register multiple character devices in probe() in the > same way the usb serial layer deals with multiport devices. > thankyou, I will try to follow. It means to register the driver analog to tty_register_driver(tiny_tty_driver) with usb_register( struct usb_driver *) and then separate "endpoint drivers" analog to for (i = 0; i < TINY_TTY_MINORS; ++i) tty_register_device(tiny_tty_driver, i, NULL); with usb_register_device_driver (struct usb_device_driver *, struct module *); Right? Can you give me some code example? Thankyou again, Wolfgang Wilhelm On Thu, 19 Nov 2009, Oliver Neukum wrote: > Am Donnerstag, 19. November 2009 16:30:20 schrieb Wolfgang Wilhelm: > > Hi, > > > > I am developing a USB linux driver for a special USB > > high speed device of our company. I need more than one read > > function as I have more than one bulk input endpoints. > > How can I do that? (debian 5.03) > > > > I can register only one interface with only one minor number and > > therefore can use only one struct fileoperations with only one > > read function from the user space. Is there a trick to overcome > > this? Is using the ioctl function instead of the read function the > > only way? > > You can register multiple character devices in probe() in the > same way the usb serial layer deals with multiport devices. > > > btw, we have a wMaxPacketSize of 64 for one bulk endpoint > > and 1024 for the other and I see a message in var/log/messages > > that these are wrong sizes? can I ignore it? > > 1024? Please post "lsusb -v" for your device. Is this a high-speed device? Note that for high speed devices, bulk endpoints _must_ have a wMaxPacketSize of 512. This is in the USB 2.0 specification, section 5.8.3. Neither 1024 nor 64 is allowed. For full-speed devices, 64 is okay but 1024 is not. In short, your device is in violation of the USB specification. It will not pass the USBCV tests and is not allowed to use the USB logo. Alan Stern
Bus 005 Device 002: ID 04b4:1002 Cypress Semiconductor Corp. CY7C63001 R100 FM Radio Device Descriptor: bLength 18 bDescriptorType 1 bcdUSB 2.00 bDeviceClass 0 (Defined at Interface level) bDeviceSubClass 0 bDeviceProtocol 0 bMaxPacketSize0 64 idVendor 0x04b4 Cypress Semiconductor Corp. idProduct 0x1002 CY7C63001 R100 FM Radio bcdDevice 0.00 iManufacturer 1 FAST ComTec iProduct 2 S7889 iSerial 0 bNumConfigurations 1 Configuration Descriptor: bLength 9 bDescriptorType 2 wTotalLength 39 bNumInterfaces 1 bConfigurationValue 1 iConfiguration 0 bmAttributes 0xc0 Self Powered MaxPower 100mA Interface Descriptor: bLength 9 bDescriptorType 4 bInterfaceNumber 0 bAlternateSetting 0 bNumEndpoints 3 bInterfaceClass 255 Vendor Specific Class bInterfaceSubClass 0 bInterfaceProtocol 0 iInterface 0 Endpoint Descriptor: bLength 7 bDescriptorType 5 bEndpointAddress 0x82 EP 2 IN bmAttributes 2 Transfer Type Bulk Synch Type None Usage Type Data wMaxPacketSize 0x0400 1x 1024 bytes bInterval 0 Endpoint Descriptor: bLength 7 bDescriptorType 5 bEndpointAddress 0x86 EP 6 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 0x08 EP 8 OUT bmAttributes 2 Transfer Type Bulk Synch Type None Usage Type Data wMaxPacketSize 0x0040 1x 64 bytes bInterval 0 Device Qualifier (for other device speed): bLength 10 bDescriptorType 6 bcdUSB 2.00 bDeviceClass 0 (Defined at Interface level) bDeviceSubClass 0 bDeviceProtocol 0 bMaxPacketSize0 64 bNumConfigurations 1 Device Status: 0x0000 (Bus Powered)