here it is the read part of the skeleton driver:
static ssize_t skel_read(struct file *file, char *buffer, size_t
count, loff_t *ppos)
{
struct usb_skel *dev;
int retval = -1;
int bytes_read;
dev = (struct usb_skel *)file->private_data;
/* do a blocking bulk read to get data from the device */
retval = usb_bulk_msg(dev->udev,
usb_rcvbulkpipe(dev->udev,
dev->bulk_in_endpointAddr),
dev->bulk_in_buffer,
min(dev->bulk_in_size, count),
&bytes_read, 0);
/* if the read was successful, copy the data to userspace */
if (!retval) {
if (copy_to_user(buffer, dev->bulk_in_buffer, bytes_read))
retval = -EFAULT;
else
retval = bytes_read;
}
return retval;
}
note that i found out just from few seconds that the read works right
when it is alone i.e. when the host is sending nothing to the gadget
but if l let the host sends something to the gagdet then the gagdet
sends hello to the host it does not work right and returns 5 in the
first time then it returns -1 forever. i dont know why it should
returns 5 and stops .
On 4/24/07, Oliver Neukum <[EMAIL PROTECTED]> wrote:
> Am Dienstag, 24. April 2007 19:28 schrieb Wael Adel:
> > > My crystal ball is damp today. Please send the source.
> >
> >
> >
> >
> > here is the total source code of the host side:
>
> I need your driver code. From your description of the output
> it is clear that you are getting errors on subsequent reads. As
> you are not evaluating errno, it is unclear which error it is.
>
> Regards
> Oliver
>
> --
> SUSE LINUX Products GmbH, GF: Markus Rex, HRB 16746 (AG Nürnberg)
> This signature is a legal requirement
>
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
[email protected]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel