* USB Device Driver
@ 2012-01-22 14:27 prathamesh deshpande
2012-01-22 19:26 ` Greg KH
0 siblings, 1 reply; 6+ messages in thread
From: prathamesh deshpande @ 2012-01-22 14:27 UTC (permalink / raw)
To: kernelnewbies
I am experimenting with a USB device and studied the steps given in
Linux Device Drivers book.
I have just started kernel programming and am new in this area.
This is what I tried to do:
I "make" it, then install the module: # insmod trial.ko. Connect the
pendrive. I checked the /var/log/messages...seemed fine:
Jan 21 00:30:10 prathamesh-laptop kernel: [10508.290016]
usbcore:registered new interface driver prathamesh driver
Jan 21 00:31:57 prathamesh-laptop kernel: [10615.120142] usb
1-1:newhigh speed USB device using ehci_hcd and address 11
Jan 21 00:31:57 prathamesh-laptop kernel: [10615.273792] usb
1-1:configuration #1 chosen from 1 choice
The USB device gets detected and also the individual bulk_in and
bulk_out endpoints show no error.
But when we AND both endpoints, error occurs (line no. 354 trial.c )
on the terminal :-
if (!(dev->bulk_in_endpointAddr && dev->bulk_out_endpointAddr))
{
printk(KERN_ALERT "\nTHIS IS THE POINT OF ERROR\n");
err("Could not find both bulk-in and bulk-out endpoints");
goto error;
}
I see my files created in /sys/bus/usb/drivers.. and a file
/dev/prathamesh driver which i can access i guess.
Do I need to read/write to this file so that the data gets reflected
in the USB using cp command ( however it didn't happen though ) ?
I also chmod 777 ( read write and execute permissions ) to
/dev/prathamesh driver already.
I also tried echo "1" > /dev/prathamesh driver but nothing happened. I
am not able to figure out what to do next.
I also see a file /sys/bus/usb/drivers/prathamesh\ driver/module/
initstate which contains "live" when my driver is loaded.
Also, /sys/bus/usb/drivers/prathamesh driver/6-1:1.2 which has ep_04
( out_endpoint ) and ep_84 ( in_endpoint )directories which contains
information about endpoints.
I've attached the folder containing code ( 'trial.c' ) and 'Makefile'
and the error messages ( dmseg | tail -n 50 ).
Can someone please help and tell me what to do next ?
I mean how do I transfer data to my driver so that it gets reflected in my USB ?
Thank you and regards,
Prathamesh
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Code.tar.gz
Type: application/x-gzip
Size: 4274 bytes
Desc: not available
Url : http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20120122/7abe32bf/attachment-0001.gz
-------------- next part --------------
A non-text attachment was scrubbed...
Name: dmesg | tail -n 50
Type: application/octet-stream
Size: 3421 bytes
Desc: not available
Url : http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20120122/7abe32bf/attachment-0001.obj
^ permalink raw reply [flat|nested] 6+ messages in thread
* USB Device Driver
2012-01-22 14:27 prathamesh deshpande
@ 2012-01-22 19:26 ` Greg KH
0 siblings, 0 replies; 6+ messages in thread
From: Greg KH @ 2012-01-22 19:26 UTC (permalink / raw)
To: kernelnewbies
On Sun, Jan 22, 2012 at 07:57:20PM +0530, prathamesh deshpande wrote:
> I am experimenting with a USB device and studied the steps given in
> Linux Device Drivers book.
> I have just started kernel programming and am new in this area.
>
> This is what I tried to do:
>
> I "make" it, then install the module: # insmod trial.ko. Connect the
> pendrive. I checked the /var/log/messages...seemed fine:
>
> Jan 21 00:30:10 prathamesh-laptop kernel: [10508.290016]
> usbcore:registered new interface driver prathamesh driver
> Jan 21 00:31:57 prathamesh-laptop kernel: [10615.120142] usb
> 1-1:newhigh speed USB device using ehci_hcd and address 11
> Jan 21 00:31:57 prathamesh-laptop kernel: [10615.273792] usb
> 1-1:configuration #1 chosen from 1 choice
>
> The USB device gets detected and also the individual bulk_in and
> bulk_out endpoints show no error.
> But when we AND both endpoints, error occurs (line no. 354 trial.c )
> on the terminal :-
>
> if (!(dev->bulk_in_endpointAddr && dev->bulk_out_endpointAddr))
> {
> printk(KERN_ALERT "\nTHIS IS THE POINT OF ERROR\n");
> err("Could not find both bulk-in and bulk-out endpoints");
> goto error;
> }
First off, what type of device are you trying to write a driver for[1]?
Are you sure you will always have a bulk in and out endpoint on it?
> I see my files created in /sys/bus/usb/drivers.. and a file
> /dev/prathamesh driver which i can access i guess.
"I guess"?
Oh wow, please go re-read the USB chapter for how exactly USB works here
please.
> Do I need to read/write to this file so that the data gets reflected
> in the USB using cp command ( however it didn't happen though ) ?
> I also chmod 777 ( read write and execute permissions ) to
> /dev/prathamesh driver already.
>
> I also tried echo "1" > /dev/prathamesh driver but nothing happened. I
> am not able to figure out what to do next.
Did you hook up the character node callbacks properly? Why are they not
being called? What do you expect to have your driver do with this data?
> I also see a file /sys/bus/usb/drivers/prathamesh\ driver/module/
> initstate which contains "live" when my driver is loaded.
> Also, /sys/bus/usb/drivers/prathamesh driver/6-1:1.2 which has ep_04
> ( out_endpoint ) and ep_84 ( in_endpoint )directories which contains
> information about endpoints.
That's all created automatically by the kernel showing your device,
driver, and module, you don't need to worry about that.
> I've attached the folder containing code ( 'trial.c' ) and 'Makefile'
> and the error messages ( dmseg | tail -n 50 ).
>
> Can someone please help and tell me what to do next ?
> I mean how do I transfer data to my driver so that it gets reflected in my USB ?
Again, what type of device is this?
{please let it not be a usb-storage device...}
greg k-h
^ permalink raw reply [flat|nested] 6+ messages in thread
* USB Device Driver
@ 2014-06-13 7:54 Vlad Ungureanu
2014-06-13 10:14 ` AYAN KUMAR HALDER
2014-06-13 14:13 ` Greg KH
0 siblings, 2 replies; 6+ messages in thread
From: Vlad Ungureanu @ 2014-06-13 7:54 UTC (permalink / raw)
To: kernelnewbies
Hello,
During Google Summer of Code we are developing an USB Device Driver for an
Android phone. Mainly we want to make an ADK driver *switch the phone to ADK
mode or back to normal mode from inside the kernel*. I looked a bit over the
Internet to find a recent example of USB Device Drivers but the ones I have
found are from 2006 or so *old Kernel versions*. Do you guys have a more recent
example, preferably not drivers/usb/usb-skeleton.c .
--
Vlad Ungureanu
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 490 bytes
Desc: Digital signature
Url : http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20140613/dcdc7dd0/attachment.bin
^ permalink raw reply [flat|nested] 6+ messages in thread
* USB Device Driver
2014-06-13 7:54 USB Device Driver Vlad Ungureanu
@ 2014-06-13 10:14 ` AYAN KUMAR HALDER
2014-06-13 14:13 ` Greg KH
1 sibling, 0 replies; 6+ messages in thread
From: AYAN KUMAR HALDER @ 2014-06-13 10:14 UTC (permalink / raw)
To: kernelnewbies
On Fri, Jun 13, 2014 at 1:24 PM, Vlad Ungureanu <vvu@vdev.ro> wrote:
> Hello,
>
> During Google Summer of Code we are developing an USB Device Driver for an
> Android phone. Mainly we want to make an ADK driver *switch the phone to ADK
> mode or back to normal mode from inside the kernel*. I looked a bit over the
> Internet to find a recent example of USB Device Drivers but the ones I have
> found are from 2006 or so *old Kernel versions*. Do you guys have a more recent
> example, preferably not drivers/usb/usb-skeleton.c .
>
If you are talking about a usb device mode driver (to switch the phone
to device mode, when it is connected by a usb to a host machine), then
please refer to drivers/usb/dwc3/core.c (DWC3_MODE_DEVICE) . It is a
usb dual role controller driver.
Regards,
Ayan Kumar Halder
^ permalink raw reply [flat|nested] 6+ messages in thread
* USB Device Driver
2014-06-13 7:54 USB Device Driver Vlad Ungureanu
2014-06-13 10:14 ` AYAN KUMAR HALDER
@ 2014-06-13 14:13 ` Greg KH
2014-06-13 14:21 ` Vlad Ungureanu
1 sibling, 1 reply; 6+ messages in thread
From: Greg KH @ 2014-06-13 14:13 UTC (permalink / raw)
To: kernelnewbies
On Fri, Jun 13, 2014 at 09:54:17AM +0200, Vlad Ungureanu wrote:
> Hello,
>
> During Google Summer of Code we are developing an USB Device Driver for an
> Android phone.
That's great, which project is doing this? What type of USB driver are
you needing to create? A "gadget" or a "normal" driver? What hardware
is this for?
> Mainly we want to make an ADK driver *switch the phone to ADK mode or
> back to normal mode from inside the kernel*.
What's wrong with the ones we already have that do this?
> I looked a bit over the Internet to find a recent example of USB
> Device Drivers but the ones I have found are from 2006 or so *old
> Kernel versions*.
Not much has changed in the USB core to need to update those, what have
you found that is lacking?
> Do you guys have a more recent example, preferably not
> drivers/usb/usb-skeleton.c .
Any reason why usb-skeleton.c isn't a good example? I like it :)
Also, USB specific Linux questions should be asked on the
linux-usb at vger.kernel.org mailing list, as that is where all of the
Linux USB developers are at.
thanks,
greg k-h
^ permalink raw reply [flat|nested] 6+ messages in thread
* USB Device Driver
2014-06-13 14:13 ` Greg KH
@ 2014-06-13 14:21 ` Vlad Ungureanu
0 siblings, 0 replies; 6+ messages in thread
From: Vlad Ungureanu @ 2014-06-13 14:21 UTC (permalink / raw)
To: kernelnewbies
Hello Greg,
I was rushing into posting the mail here, just finished writing up a small
driver that switches my phone into ADK mode. The project is
http://blog.praveenkumar.co.in/2014/05/gsoc-14-proposal-for-beagleorg.html .
The skel helped me in the end. We are trying to develop this driver for the
BeagleBone Black in order to take the framebuffer from it and send it via USB
to an Android device and relay touches back to the board. If we have any more
questions we will go on the USB ML from now on.
Thank you for the help!
> On Fri, Jun 13, 2014 at 09:54:17AM +0200, Vlad Ungureanu wrote:
> > Hello,
> >
> > During Google Summer of Code we are developing an USB Device Driver for an
> > Android phone.
>
> That's great, which project is doing this? What type of USB driver are
> you needing to create? A "gadget" or a "normal" driver? What hardware
> is this for?
>
> > Mainly we want to make an ADK driver *switch the phone to ADK mode or
> > back to normal mode from inside the kernel*.
>
> What's wrong with the ones we already have that do this?
>
> > I looked a bit over the Internet to find a recent example of USB
> > Device Drivers but the ones I have found are from 2006 or so *old
> > Kernel versions*.
>
> Not much has changed in the USB core to need to update those, what have
> you found that is lacking?
>
> > Do you guys have a more recent example, preferably not
> > drivers/usb/usb-skeleton.c .
>
> Any reason why usb-skeleton.c isn't a good example? I like it :)
>
> Also, USB specific Linux questions should be asked on the
> linux-usb at vger.kernel.org mailing list, as that is where all of the
> Linux USB developers are at.
>
> thanks,
>
> greg k-h
--
Vlad Ungureanu
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 490 bytes
Desc: Digital signature
Url : http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20140613/b95013ea/attachment.bin
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2014-06-13 14:21 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-06-13 7:54 USB Device Driver Vlad Ungureanu
2014-06-13 10:14 ` AYAN KUMAR HALDER
2014-06-13 14:13 ` Greg KH
2014-06-13 14:21 ` Vlad Ungureanu
-- strict thread matches above, loose matches on Subject: below --
2012-01-22 14:27 prathamesh deshpande
2012-01-22 19:26 ` 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).