Date: Thu, 11 Mar 2004 01:51:30 -0800 (PST) From: admin2@forkthepenguin.com To: freebsd-questions@freebsd.org Subject: USB ugen0 problems Message-ID: <Pine.BSI.4.58L.0403102353310.12783@vp4.netgate.net>
next in thread | raw e-mail | index | archive | help
I'm attempting to interface with a usb based data acquisition device called a Labjack (http://labjack.com) under FreeBSD 4.9. The Labjack is a USB1.1 compliant HID device with a single configuration and two "interrupt" endpoints (in/out) not including the control endpoint. Initially I tried to use the uhid driver, but due to lack of functionality needed in this case I removed the uhid driver from the kernel in favor of the ugen driver. The ugen driver happily accepts the device and I can talk to it with a variety of utilities such as usbctl (from usbutil) and get a complete description of the device (bottom). After much research and fiddling around, I can up with a reasonable way to communicate with the device using libusb-0.1.8 (http://libusb.sourceforge.net/). Unfortunately the two endpoints are not being configured by the ugen driver on /dev/ugen0.1 and /dev/ugen0.2. From the debugging output of libusb, I get the following error when attempting to write to the endpoint : USB error: error writing to interrupt endpoint /dev/ugen0.2: Device not configured In theory these devices should get configured to the endpoints when the device is enumerated as they belong to interface 0 (the only interface) so it's not a matter of explicitly having to attach to an alternate interface. After turning on debugging in the usb and ugen modules, I confirmed the ugen driver knows about the endpoints (see below). To write to the endpoint, I'm using the usb_interrupt_write function provided by libusb-0.1.8 for writing to "interrupt" type endpoints. I believe everything would work just fine if the /dev/ugen0.EE devices were configured by the driver properly, but at this point I'm stumped. Any ideas? Thanks in advance. Chris USB_DEBUG info : Attaching the unit : Mar 11 01:21:36 cosmo /kernel: usbd_reset_port: port 1 reset done, error=NORMAL_COMPLETION Mar 11 01:21:36 cosmo /kernel: usbd_new_device bus=0xc0d31800 port=1 depth=1 lowspeed=512 Mar 11 01:21:36 cosmo /kernel: usbd_setup_pipe: dev=0xc0d33a80 iface=0 ep=0xc0d33a9c pipe=0xc0d33a84 Mar 11 01:21:36 cosmo /kernel: usbd_new_device: adding unit addr=2, rev=110, class=0, subclass=0, protocol=0, maxpacket=8, len=18, ls=1 Mar 11 01:21:36 cosmo /kernel: usbd_new_device: new dev (addr 2), dev=0xc0d33a80, parent=0xc0d33c80 Mar 11 01:21:36 cosmo /kernel: usbd_probe_and_attach: trying device specific drivers Mar 11 01:21:36 cosmo /kernel: usbd_probe_and_attach: no device specific driver found Mar 11 01:21:36 cosmo /kernel: usbd_probe_and_attach: looping over 1 configurations Mar 11 01:21:36 cosmo /kernel: usbd_probe_and_attach: trying config idx=0 Mar 11 01:21:36 cosmo /kernel: usbd_set_config_index: (addr 2) attr=0x80, selfpowered=0, power=100 Mar 11 01:21:36 cosmo /kernel: usbd_set_config_index: set config 1 Mar 11 01:21:36 cosmo /kernel: usbd_probe_and_attach: no interface drivers found Mar 11 01:21:36 cosmo /kernel: ugen0: LabJack Labjack U12, rev 1.10/5.f6, addr 2 Mar 11 01:21:36 cosmo /kernel: usbd_set_config_index: free old config Mar 11 01:21:36 cosmo /kernel: usbd_set_config_index: (addr 2) attr=0x80, selfpowered=0, power=100 Mar 11 01:21:36 cosmo /kernel: usbd_set_config_index: set config 1 Mar 11 01:21:36 cosmo /kernel: ugen_set_config: ugen0 to configno 1, sc=0xc0d34000 Mar 11 01:21:36 cosmo /kernel: ugen_set_config: ifaceno 0 Mar 11 01:21:36 cosmo /kernel: ugen_set_config: endptno 0, endpt=0x01(1,1), sce=0xc0d34264 Mar 11 01:21:36 cosmo /kernel: ugen_set_config: endptno 1, endpt=0x02(2,0), sce=0xc0d34328 When attempting to write to the endpoint : Mar 11 01:25:18 cosmo /kernel: usbd_setup_pipe: dev=0xc0d33a80 iface=0xc0d279a0 ep=0xc0d32b78 pipe=0xcc5e3cfc Mar 11 01:25:18 cosmo /kernel: usbd_setup_pipe: dev=0xc0d33a80 iface=0xc0d279a0 ep=0xc0d32b70 pipe=0xcc5e3cfc Killing program while hung on read : Mar 11 01:26:43 cosmo /kernel: usbd_ar_pipe: pipe=0xc0eb8d00 Mar 11 01:26:43 cosmo /kernel: usbd_ar_pipe: pipe=0xc0eb8d00 xfer=0xc0d33b00 (methods=0xc04aafe0) Mar 11 01:26:43 cosmo /kernel: usbd_ar_pipe: pipe=0xc0eb8280 Mar 11 01:26:43 cosmo /kernel: usbd_ar_pipe: pipe=0xc0eb8280 xfer=0xc0eb8200 (methods=0xc04aafe0) usbctl info : The Labjack is device 2 below. # usbctl USB device 1: 9 USB device 2: 0 2 USB devices found DEVICE addr 1 DEVICE descriptor: bLength=18 bDescriptorType=device(1) bcdUSB=1.00 bDeviceClass=9 bDeviceSubClass=0 bDeviceProtocol=0 bMaxPacketSize=64 idVendor=0x0000 idProduct=0x0000 bcdDevice=100 iManufacturer=1(SiS) iProduct=2(OHCI root hub) iSerialNumber=0() bNumConfigurations=1 CONFIGURATION descriptor 0: bLength=9 bDescriptorType=config(2) wTotalLength=25 bNumInterface=1 bConfigurationValue=1 iConfiguration=0() bmAttributes=40 bMaxPower=0 mA INTERFACE descriptor 0: bLength=9 bDescriptorType=interface(4) bInterfaceNumber=0 bAlternateSetting=0 bNumEndpoints=1 bInterfaceClass=9 bInterfaceSubClass=0 bInterfaceProtocol=0 iInterface=0() ENDPOINT descriptor: bLength=7 bDescriptorType=endpoint(5) bEndpointAddress=1-in bmAttributes=interrupt wMaxPacketSize=8 bInterval=255 current configuration 1 HUB descriptor: bDescLength=10 bDescriptorType=41 bNbrPorts=3 wHubCharacteristics=01 bPwrOn2PwrGood=1 bHubContrCurrent=0 DeviceRemovable=0 Hub status 0000 0000 Port 1 status=0303 change=0000 Port 2 status=0100 change=0000 Port 3 status=0100 change=0000 ---------- DEVICE addr 2 DEVICE descriptor: bLength=18 bDescriptorType=device(1) bcdUSB=1.10 bDeviceClass=0 bDeviceSubClass=0 bDeviceProtocol=0 bMaxPacketSize=8 idVendor=0x0cd5 idProduct=0x0001 bcdDevice=5f6 iManufacturer=1() iProduct=2() iSerialNumber=0() bNumConfigurations=1 CONFIGURATION descriptor 0: bLength=9 bDescriptorType=config(2) wTotalLength=41 bNumInterface=1 bConfigurationValue=1 iConfiguration=0() bmAttributes=80 bMaxPower=100 mA INTERFACE descriptor 0: bLength=9 bDescriptorType=interface(4) bInterfaceNumber=0 bAlternateSetting=0 bNumEndpoints=2 bInterfaceClass=3 bInterfaceSubClass=0 bInterfaceProtocol=0 iInterface=0() HID descriptor: bLength=9 bDescriptorType=cs_device(33) bcdHID=1.10 bCountryCode=0 bNumDescriptors=1 bDescriptorType[0]=cs_config(34), wDescriptorLength[0]=75 Report descriptor Usage Page(1) Usage(0) Collection (Application) Usage(0) Usage(0) Logical Min(128) Logical Max(127) Physical Min(19501) Physical Max(17040385) Report size(8) Report count(8) Input (Data, Variable, Absolute, No wrap, Linear, Preferred state, No null position, Bit field) Usage(0) Logical Min(128) Logical Max(127) Physical Min(50726916) Physical Max(117703688) Report size(8) Report count(8) Output (Data, Variable, Absolute, No wrap, Linear, Preferred state, No null position, Non volatile, Bit field) Usage(0) Logical Min(128) Logical Max(127) Physical Min(50463744) Physical Max(117702918) Report size(8) Report count(128) Feature (Data, Variable, Absolute, No wrap, Linear, Preferred state, No null position, Non volatile, Bit field) End Collection ENDPOINT descriptor: bLength=7 bDescriptorType=endpoint(5) bEndpointAddress=1-in bmAttributes=interrupt wMaxPacketSize=8 bInterval=10 ENDPOINT descriptor: bLength=7 bDescriptorType=endpoint(5) bEndpointAddress=2-out bmAttributes=interrupt wMaxPacketSize=8 bInterval=10 current configuration 1 ----------
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSI.4.58L.0403102353310.12783>