I've added a couple extra ioctl's within hiddev.c to allow me to read and
write char arrays but I'm having problems with my read code. Could someone
please tell me what's wrong with the code below, as it always times out even
if I increase the timeout value and I know there's data being send back up
as i have a USB anyliser that can see the data flow between the OS and the
device.

Damien

// hiddev_ioctl

struct dmg_response resp;
int pipe = usb_rcvbulkpipe( dev, 0x01);
int bytes_read = 0;
int bytes_to_read = 64;
int reply;

char * in_buffer = kmalloc( sizeof(char)*64, GFP_KERNEL );

// read
reply = usb_bulk_msg(  dev,             // usb device
                                pipe,                   // pipe
                                in_buffer,              // data buffer
                                bytes_to_read,  // number of bytes to read
(64)
                                &bytes_read,    // number of bytes read
                                10*HZ);         // timeout value (10
seconds)


printk("reply = %d\t bytes_read = %d\n", reply, bytes_read);


// set response
resp.data_length = bytes_read;
if( reply == 0 && bytes_read > 0)
        memcpy(resp.data, in_buffer, bytes_read);


if( copy_to_user( (void *)arg, &resp, sizeof(resp) ) )
        printk("unable to copy to user space\n");


kfree(in_buffer);
return reply;


-------------------------------------------------------
This SF.Net email sponsored by: Free pre-built ASP.NET sites including
Data Reports, E-commerce, Portals, and Forums are available now.
Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01
_______________________________________________
[EMAIL PROTECTED]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to