From: Johannes E. <joh...@er...> - 2003-05-06 23:02:45
|
That's a bug in the current code which happens when a timeout occurs. The code doesn't do any signal handling right now. Are you expecting data to be delivered within 10 seconds (from looking at the call to usb_interrupt_read)? JE On Tue, May 06, 2003, Derek Hansen <de...@wi...> wrote: > I am trying to do an interrupt transfer from a device. I'm using the > usb_interrupt_read() method. When the method runs it prints "Alarm clock" > to the screen and my program terminates. What could be causing this error > and how can I remedy it? > > Here is a cutting of my code: > > struct usb_bus *bus; > struct usb_device *dev; > struct usb_dev_handle * handle; > > int stat; > int interfaceNum; > int altNum; > int endPoint; > int numBytes; > int quit; > > char buf[2048]; > > usb_init(); > > usb_find_busses(); > usb_find_devices(); > > for (bus=usb_get_busses(); bus; bus = bus->next) { > for (dev = bus->devices; dev; dev = dev->next) { > if ((dev->descriptor.idVendor == 0x0c2e)&&(dev->descriptor.idProduct > == 0x0700)) { > printf("*****Found the metrologic scanner*****\n"); > break; > } > } > } > > handle = usb_open(dev); > > stat = usb_set_configuration( handle, > dev->config[0].bConfigurationValue ); > > interfaceNum = dev->config[0].interface[0].altsetting[0].bInterfaceNumber; > stat = usb_claim_interface(handle, interfaceNum); > > altNum = dev->config[0].interface[0].altsetting[0].bAlternateSetting; > stat = usb_set_altinterface(handle, altNum); > > quit = 0; > while ( !quit ) { > printf("Reading from scanner\n"); > > endPoint > =dev->config[0].interface[0].altsetting[0].endpoint[1].bEndpointAddress; > numBytes > =dev->config[0].interface[0].altsetting[0].endpoint[1].wMaxPacketSize; > > printf("%d =ep, %d = bytes\n" ,endPoint, numBytes); > > stat = usb_interrupt_read( handle, endPoint, buf, numBytes, 10000 ); > > printf("Read: %s\n",buf); > > if ( stat<0 ) { > quit = 1; > } > } > > |