|
From: William A. G. <bg...@bi...> - 2002-04-17 02:28:11
|
Guys:
I'm running libusb-0.1.5 on Red Hat's Linux-2.4.18-0.22. My USB
device is a StrongARM SA1110-powered arm-linux system (similar to an
iPAQ), running 2.4.9-rmk2-np1. This device has three endpoints:
control, bulk IN, and bulk OUT.
I can open/close the device, but bulk reads and writes return EBUSY.
Here is my test program (error handling omitted for brevity):
#define VENDOR_ID 0xfff0
#define PRODUCT_ID 0x0001
extern int usb_debug;
int main(int argc, char *argv[])
{
struct usb_device *target;
struct usb_dev_handle *handle;
char cbuf[256];
int ret;
usb_debug = 3;
usb_init();
usb_find_busses();
usb_find_devices();
target = find_target(VENDOR_ID, PRODUCT_ID);
print_configuration(&(target->config[0])); /* from testlibusb */
handle = usb_open(target);
ret = usb_bulk_read(handle, 1, cbuf, sizeof(cbuf) - 1, 1000);
ret = usb_bulk_write(handle, 0x82, "foo\n", 4, 1000);
usb_close(handle);
return 0;
}
The output I get is this:
$ insmod usbserial vendor=0xfff0 product=0x0001 debug=1
Using /lib/modules/2.4.18-0.22/kernel/drivers/usb/serial/usbserial.o
(plug in USB device)
$ tail /var/log/messages
Apr 16 21:29:29 mars kernel: hub.c: USB new device connect on bus2/2, assigned device number 7
Apr 16 21:29:29 mars kernel: usbserial.c: Generic converter detected
Apr 16 21:29:29 mars kernel: usbserial.c: Generic converter now attached to ttyUSB0 (or usb/tts/0 for devfs)
Apr 16 21:29:32 mars /etc/hotplug/usb.agent: ... no modules for USB product fff0/1/1
$ ./usbtest
usb_os_init: Found USB VFS at /proc/bus/usb
usb_find_busses: Skipping non bus directory devices
usb_find_busses: Skipping non bus directory drivers
usb_find_busses: Found 002
usb_find_busses: Found 001
usb_find_devices_on_bus: Found 001 on 001
usb_find_devices_on_bus: Found 001 on 002
usb_find_devices_on_bus: Found 002 on 002
usb_find_devices_on_bus: Found 005 on 002
usb_find_devices_on_bus: Found 006 on 002
usb_find_devices_on_bus: Found 007 on 002
skipped 1 class/vendor specific interface descriptors
wTotalLength: 32
bNumInterfaces: 1
bConfigurationValue: 1
iConfiguration: 0
bmAttributes: 40h
MaxPower: 0
bInterfaceNumber: 0
bAlternateSetting: 0
bNumEndpoints: 2
bInterfaceClass: 255
bInterfaceSubClass: 0
bInterfaceProtocol: 0
iInterface: 4
bEndpointAddress: 01h
bmAttributes: 02h
wMaxPacketSize: 64
bInterval: 0
bRefresh: 0
bSynchAddress: 0
bEndpointAddress: 82h
bmAttributes: 02h
wMaxPacketSize: 64
bInterval: 0
bRefresh: 0
bSynchAddress: 0
USB error: error reading from bulk endpoint 0x82: Device or resource busy
USB error: error writing to bulk endpoint 1: Device or resource busy
From strace:
open("/proc/bus/usb/002/007", O_RDWR) = 3
ioctl(3, USBDEVFS_BULK, 0xbffed9a0) = -1 EBUSY (Device or resource busy)
ioctl(3, USBDEVFS_BULK, 0xbffed9a0) = -1 EBUSY (Device or resource busy)
Does the error message about usb.agent in the logs have anything to do
with this? All I'm trying to do is set up a usbserial link with the
device. What am I missing?
Thanks!
b.g.
--
Bill Gatliff
bg...@bi...
|