usb_driver hotplug probe callback

Sudip Mukherjee sudipm.mukherjee at gmail.com
Fri Aug 15 00:05:57 EDT 2014


On Aug 15, 2014 8:28 AM, "Jaret Flores" <jarflores at gmail.com> wrote:
>
> Well...I guess I've learned my lesson.  I apologize for asking the
> previous question related to the Eudyptula Challenge.  I did not read
> the August 2014 status report well enough and did not realize it was
> against the rules to ask questions the community.  It was not my
> intention to start off my interactions with the community on the wrong
> foot.
>

Its part of the fun to find out yourself how to do this task. i have taken
the longest time and maximum number of attempts for this task.but when
finally little tells you  that task is complete , you will get a feeling of
achievement and you will also say "sh** .. it was this easy...".
i hope i have not broken the rules by replying....


> If it is any consolation, the main reason I asked is that I thought
> there might be an outside module, or something else, in the kernel
> affecting my particular usb driver module.  Since this (possible)
> "outside interference" wasn't directly related to the understanding of
> code within the module itself (which I wrote on my own), I thought it
> would OK to get some input on where to go.
>
> My apologies again for the question and I hope I can interact with you
> all in a more positive light in the future.
> -Jaret
>
> On Thu, Aug 14, 2014 at 3:21 PM, Jaret Flores <jarflores at gmail.com> wrote:
> > I know I am not supposed to get too much help on the eudyptula
> > challenges, but I can't seem to figure this last thing out.
> >
> > The goal is to write (the skeleton of) a usb driver module that loads
> > and registers the driver when a usb keyboard is plugged in.  What I
> > have so far does exactly that except that the struct usb_driver:
> >
> > 1) probe function is not called (neither via keyboard plugin nor when
> > module is loaded manually with modprobe).
> > 2) disconnect function is called only after the module is unloaded
> > (with rmmod) AND THEN the keyboard is unplugged.
> >
> > From ldd3:
> > for probe: "This function is called by the USB core when it thinks it
> > has a struct usb_interface that this driver can handle."
> > for disconnect: "This function is called by the USB core when the
> > struct usb_interface has been removed from the system or when the
> > driver is being unloaded from the USB core."
> >
> > From the quotes, it seems the kernel does not think my driver is valid
> > to handle the keyboard (though 2 may not actually be abnormal
> > behavior).  I am thinking, perhaps the struct usb_device_id table is
> > wrong or incomplete:
> >
> > static struct usb_device_id hw_id_table[] = {
> > {USB_INTERFACE_INFO(USB_INTERFACE_CLASS_HID,
> >         USB_INTERFACE_SUBCLASS_BOOT, USB_INTERFACE_PROTOCOL_KEYBOARD)},
> > {}
> > };
> >
> > MODULE_DEVICE_TABLE(usb, hw_id_table);
> >
> > There is also a USB_DEVICE_INFO() macro, but I cannot seem to find a
> > file analogous to include/uapi/linux/hid.h which (would) define the
> > arguments to USB_DEVICE_INFO().  Is this the problem?  Or am I missing
> > something else?
> >
> > Thanks for the info,
> > Jaret
>
> _______________________________________________
> Kernelnewbies mailing list
> Kernelnewbies at kernelnewbies.org
> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20140815/f33589f0/attachment-0001.html 


More information about the Kernelnewbies mailing list