Input device driver
greg at kroah.com
Sat Sep 30 03:42:08 EDT 2017
On Fri, Sep 29, 2017 at 09:19:05PM -0300, Bruno E. O. Meneguele wrote:
> On 29-09, valdis.kletnieks at vt.edu wrote:
> > On Fri, 29 Sep 2017 19:38:49 -0300, "Bruno E. O. Meneguele" said:
> > > 2) I'm using a USB keyboard as the testing device, and TBH I got
> > > confused if I could actually use the input subsystem for that or I
> > > _should_ use HID instead (considering the keyboard is HID compliant).
> > Step 0: Decide if you're writing an interrupt handling driver, a USB driver, or
> > an HID driver - the three live at different levels of abstraction, and
> > confusing them will also confuse both you and your kernel.
> I don't know why I didn't realize earlier the two counterparts:
> interruption vs USB, USB devices are handled in polling mode, not
> with IRQs.
It's not that simple. USB devices only work when the host asks them for
data, so yes, that can be called "polling", but on the host (i.e. your
computer), IRQs are used to get the data from the USB host controller.
The USB driver is notified with the data from the mouse in IRQ context,
so you do have to be aware of IRQ issues when dealing with USB devices.
best of luck,
More information about the Kernelnewbies