LJ Archive

Listing 3. The usb_bulk_msg Function

/* do an immediate bulk read to get data from
   the device */
retval = usb_bulk_msg (skel->dev,
                       usb_rcvbulkpipe (skel->dev,
                       skel->bulk_in_endpointAddr),
                       skel->bulk_in_buffer,
                       skel->bulk_in_size,
                       &count, HZ*10);
/* if the read was successful, copy the data
   to user space */
if (!retval) {
        if (copy_to_user
             (buffer, skel->bulk_in_buffer, count))
                retval = -EFAULT;
        else
                retval = count;
}
LJ Archive