kernelnewbies.kernelnewbies.org archive mirror
 help / color / mirror / Atom feed
* Cannot read using USB Skeleton Driver
@ 2011-09-15 13:32 Felix Varghese
  2011-09-16  7:01 ` Greg KH
  0 siblings, 1 reply; 11+ messages in thread
From: Felix Varghese @ 2011-09-15 13:32 UTC (permalink / raw)
  To: kernelnewbies

Hi,

I have been trying to communicate with a custom usb device from a
SAM9G20-EK board using the usb-skeleton.c driver example in the linux
source. I modified the driver to add my device's vendor and product
id. The USB device enumerates with two bulk endpoints - one IN and one
OUT. The (modified) skel driver successfully detects my device and I
get a minor number allocated. After creating a device file with that
minor number, I am able to write into the device by typing 'echo "HI"
> /dev/mydevice'. I verified that this data arrives at my device
intact. Next, I started sending data back from the device and tried to
read it back using 'cat /dev/mydevice'. The problem is that read not
only doesn't work, but also makes the app get totally stuck. Ctrl-C
doesn't work and I have to reboot the board.

Some debugging using printk's led me to the following snippet which
seems to be causing the hang. If I change the wait to a
wait_for_completion_interruptible, Ctrl-C starts working, but still no
data is received.

if (!dev->processed_urb) {
		/*
		 * the URB hasn't been processed
		 * do it now
		 */
		wait_for_completion(&dev->bulk_in_completion);
		dev->bulk_in_copied = 0;
		dev->processed_urb = 1;
	}

Oh, btw I am using linux kernel 2.6.39.4. Any Ideas anyone??

Regards,
Felix.

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2011-09-21 16:00 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-09-15 13:32 Cannot read using USB Skeleton Driver Felix Varghese
2011-09-16  7:01 ` Greg KH
2011-09-16 11:29   ` Felix Varghese
2011-09-16 14:31     ` Greg KH
2011-09-19  5:43       ` Felix Varghese
2011-09-19 12:38         ` Greg KH
2011-09-19 13:21           ` Felix Varghese
2011-09-19 13:46             ` Greg KH
2011-09-20  3:49               ` Felix Varghese
2011-09-21 13:29                 ` Felix Varghese
2011-09-21 16:00                   ` Greg KH

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).