Download your favorite Linux distribution at LQ ISO.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 10-24-2006, 01:07 AM   #1
Registered: Dec 2005
Distribution: Gentoo
Posts: 87

Rep: Reputation: 16
usb_bulk_read() - open error 11 Resource temporarily unavailable

I've succeeded with usb_bulk_write() but can't utilize usb_bulk_read(). It returns an error open error 11 Resource temporarily unavailable.

Here is the output of
cat /prog/bus/usb/devices:
T:  Bus=01 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#=  4 Spd=12  MxCh= 0
D:  Ver= 1.10 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=16 #Cfgs=  1
P:  Vendor=1664 ProdID=d100 Rev= 2.00
S:  Manufacturer=Argox Informations
S:  Product=CRD -10
S:  SerialNumber=60227075  
C:* #Ifs= 1 Cfg#= 1 Atr=80 MxPwr=100mA
I:  If#= 0 Alt= 0 #EPs= 2 Cls=03(HID  ) Sub=00 Prot=00 Driver=(none)
E:  Ad=82(I) Atr=03(Int.) MxPS=  64 Ivl=1ms
E:  Ad=02(O) Atr=03(Int.) MxPS=  64 Ivl=1ms
The source code that utilizes the mentioned functions:
#include <usbpp.h> 
#include <stdio.h>
#include <iostream.h>
#include <errno.h> 
#define VENDOR_ARGOX 0x1664 
#define DEVICE_PT 0xd100 
int main(void)
struct usb_bus *bus; 
struct usb_device *dev;
int n,m,ret; 
char string[256];
usb_dev_handle *udev;
for (bus = usb_busses; bus; bus = bus->next) { 
for (dev = bus->devices; dev; dev = dev->next) {
if (dev->descriptor.idVendor==VENDOR_ARGOX) 
if (dev->descriptor.idProduct==DEVICE_PT){  
udev = usb_open(dev);
if (udev) { 
printf("found argox_PT dev-%s on bus-%s\n",dev->filename,bus->dirname); 
usb_detach_kernel_driver_np(udev, 0); 
usb_set_configuration(udev, 1);
if (dev->descriptor.iManufacturer) { 
usb_get_string_simple(udev, dev->descriptor.iManufacturer, string, sizeof(string));
if (ret > 0)
printf("- Manufacturer : %s\n", string);
printf("- Unable to fetch manufacturer string\n"); 
if (dev->descriptor.iProduct) { 
ret = usb_get_string_simple(udev, dev->descriptor.iProduct, string, sizeof(string));
if (ret > 0)
printf("- Product : %s\n", string);
printf("- Unable to fetch product string\n");
if (dev->descriptor.iSerialNumber) { 
ret = usb_get_string_simple(udev, dev->descriptor.iSerialNumber, string, sizeof(string));
if (ret > 0) 
printf("- Serial Number: %s\n", string);
printf("- Unable to fetch serial number string\n");
ret = usb_claim_interface(udev,0); 
if (ret>=0) printf("device claimed!\n"); 
else printf("open error %d %s\n", errno, strerror(errno));
unsigned int WRITE=dev->config[0].interface[0].altsetting[0].endpoint[1].bEndpointAddress;
unsigned int READ=dev->config[0].interface[0].altsetting[0].endpoint[0].bEndpointAddress;
char * buff = new char[10];
delete [] buff; 
char bufferout[]={0x1b,0x02,0x00,0x00,0x00,0x04,0x01,0x00,0x00,0x00,0x02,0x1b,0x3f,0x00};
char bufferin[256];
int sizein=dev->config[0].interface[0].altsetting[0].endpoint[1].wMaxPacketSize;
int sizeout=dev->config[0].interface[0].altsetting[0].endpoint[0].wMaxPacketSize;
int pts=dev->config[0].interface[0].altsetting[0].endpoint[0].bInterval;
int i; 
printf("WRITE TO %02xh READ FROM %02xh\n SIZEIN %d SIZEOUT %d\n PTS %d\n",WRITE,READ,sizein,sizeout,pts);
for (i=0;i<14;i++){
ret=usb_interrupt_write(udev, WRITE, buff, 1, 100);
if (ret>=0) printf("buf=%02x, transfered %d bytes \n",*buff+i,ret); 
else printf("open error %d %s\n", errno, strerror(errno));
for (i=0;i<14;i++){
ret=usb_interrupt_read(udev, READ, buff, 1, 100);
if (ret>=0) {printf("buf=%02x, read %d bytes \n",*buff+i,ret); bufferin[i]=*buff;}
else printf("open error %d %s\n", errno, strerror(errno));
for(i=0;i<14;i++) printf("read:%02x \n",bufferin[i]);
usb_close (udev);
else continue;
return 0;
Got no ideas of what am I doing wrong. Anyone faced such a problem, please give a hint.


linux, usb

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
E: Could not get lock /var/lib/dpkg/lock - open (11 Resource temporarily unavailable) phreakshew Linux - Newbie 24 04-12-2019 10:42 AM
Cifs "mount error 11 = Resource temporarily unavailable" humbletech99 Linux - Networking 1 09-26-2006 12:04 PM
Sendmail Error Deferred: Resource temporarily unavailable shawnbishop Linux - Software 3 03-19-2006 01:00 PM
Siocsifflags: Resource Temporarily Unavailable camapa Linux - Networking 0 09-24-2005 07:58 PM
SIOCSIFFLAGS: Resource temporarily unavailable bleef Linux - Networking 2 05-14-2001 10:54 PM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 04:09 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration