Hi all,

I'm having a problem with a USB device created by a person I work with.  The device is 
a simple counter that counts from 0 to 255.  It is implemented as an HiD device.  When 
I use the Hidview tool in Windows, I can grab the counter value from the USB device.  
However, when I run code in Linux, a call to select(...) blocks, waiting for the 
device to become available for reading.  The device has a green LED which blinks 
faster when it is being read, and slowly when not.  When I run the select() code, the 
LED blinks quickly, indicating that it is being read.  The code is as follows:

nt main (int argc, char **argv) {
    fd_set fdset;
     .
     .
     .
    ioctl(fd, HIDIOCGVERSION, &version);
    printf("hiddev driver version is %d.%d.%d\n",
        version >> 16, (version >> 8) & 0xff, version & 0xff);
    ioctl(fd, HIDIOCGDEVINFO, &dinfo);
    printf("HID: bus: %d devnum: %d ifnum: %d\n",
        dinfo.busnum, dinfo.devnum, dinfo.ifnum);
    ioctl(fd, HIDIOCGNAME(sizeof(name)), name);                   // THIS ALL WORKS 
FINE
    printf("HID device name: \"%s\"\n", name);
    ioctl(fd, HIDIOCINITREPORT, 0);
    log_output = stdout;


    FD_ZERO(&fdset);
    fprintf( stderr, "Did the FD_ZERO thang\n" );

    /*
     * This will infinitely wait for data to come off the hid device.
     * It is canceled by ^C.
     */
    while (1) {
        FD_SET(fd, &fdset);
        rd = select(fd+1, &fdset, NULL, NULL, NULL);    // blocks
        .
        .
        .
    }

        .
        .
        .

Basically, I'm not sure if anything works after that because select always blocks.  
Any help is appreciated.  Thanks much,

Aaron Greene


-------------------------------------------------------
This SF.net email is sponsored by:  Etnus, makers of TotalView, The best
thread debugger on the planet. Designed with thread debugging features
you've never dreamed of, try TotalView 6 free at www.etnus.com.
_______________________________________________
[EMAIL PROTECTED]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel
  • [... Aaron Greene
    • ... петр петров
      • ... Alan Stern

Reply via email to