Cannot read using USB Skeleton Driver
Greg KH
greg at kroah.com
Fri Sep 16 10:31:44 EDT 2011
On Fri, Sep 16, 2011 at 04:59:08PM +0530, Felix Varghese wrote:
> > What type of device is this you are wishing to write a driver for? That
> > will determine the type of interface you need to use, odds are it is not
> > going to be a simple char device.
>
> The device is a custom USB dongle whose firmware is also under
> development. We are still in the process of deciding what it should
> actually show up as on the linux side but right now, we decided to use
> a character device for simplicity reasons until we have simple two-way
> communication over USB up and running. Since I am writing the firmware
> on the device side too, it had indeed been (and still is) my first
> suspect :). But I checked the code multiple times and now I am
> reasonably sure that I am in fact, doing all that is required to send
> out data properly. Besides, data transfer in the other direction works
> fine. I have registered only one IN and one OUT endpoint apart from
> endpoint 0 and I try to send my data through the IN end-point.
For real simplicity, just use the usb-serial generic interface and you
will get a tty device node created for you that you can read and write
data from.
Just do:
modprobe usb_serial vendor=0x0000 product=0x0000
with the proper vendor and product ids for your device, then plug it in.
No kernel changes needed at all, just have a pair of bulk in/out
endpoints and all will work automatically for you.
But that interface is slow as there is only one urb in flight at any
point in time, so don't rely on that for anything but basic development
and testing.
> I noticed that after making the wait interruptible, if I hit Ctrl-C
> while we are hanging on a read, the device side shows transfer
> complete. So the device, apparently, thinks the data has been sent
> successfully when we have actually aborted the transfer at the other
> end! Shouldn't this mean that something happens after coming out of
> the wait_for_completion that really makes the transfer happen?
Look at the USB data on the wire to make sure that you really are
sending data properly.
good luck,
greg k-h
More information about the Kernelnewbies
mailing list