usb_driver hotplug probe callback

Jaret Flores jarflores at gmail.com
Thu Aug 14 22:58:10 EDT 2014


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.

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



More information about the Kernelnewbies mailing list