linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* USB mouse protocol,
@ 2008-04-30  9:28 xerces8
  2008-04-30 11:18 ` Vojtech Pavlik
  0 siblings, 1 reply; 5+ messages in thread
From: xerces8 @ 2008-04-30  9:28 UTC (permalink / raw)
  To: vojtech-AlSwsSmVLrQ
  Cc: linux-input-u79uwXL29TY76Z2rM5mHXA,
	linux-usb-u79uwXL29TY76Z2rM5mHXA

Hi!

I'm curious about some details in the protocol used by USB mice.
A cursory look at the "Device Class Definition for HID 1.11" documents
tells me (note this is the first USB technical document I ever read)
that a mouse can tell the host the format (the protocol) used to report
data (movement, button state etc.).

Also a quick look into linuxv2.6.25/drivers/hid/usbhid/usbmouse.c suggests
that 8 bits are used for position.

So my questions are:
 - is the position data always 8 bits wide ?
 - when are reports sent ? Are they polled by host ? Or sent by the device
on its own ?

Thanks for any answers,
David Balazic
 


--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: USB mouse protocol,
  2008-04-30  9:28 USB mouse protocol, xerces8
@ 2008-04-30 11:18 ` Vojtech Pavlik
       [not found]   ` <20080430111816.GA9876-AlSwsSmVLrQ@public.gmane.org>
  0 siblings, 1 reply; 5+ messages in thread
From: Vojtech Pavlik @ 2008-04-30 11:18 UTC (permalink / raw)
  To: xerces8; +Cc: linux-input, linux-usb

On Wed, Apr 30, 2008 at 11:28:59AM +0200, xerces8 wrote:
> Hi!
> 
> I'm curious about some details in the protocol used by USB mice.
> A cursory look at the "Device Class Definition for HID 1.11" documents
> tells me (note this is the first USB technical document I ever read)
> that a mouse can tell the host the format (the protocol) used to report
> data (movement, button state etc.).
> 
> Also a quick look into linuxv2.6.25/drivers/hid/usbhid/usbmouse.c suggests
> that 8 bits are used for position.
> 
> So my questions are:
>  - is the position data always 8 bits wide ?

No. The driver you need to look at is usbhid.ko, not usbmouse - that
only works for the static "HID Boot Protocol", and is only useful in
embedded devices.

>  - when are reports sent ? Are they polled by host ? Or sent by the device
> on its own ?

That depends on how you look at it. The host controller polls the device
at a specified rate - typically 100Hz, but the device decides whether it
will or won't send a report when polled.

-- 
Vojtech Pavlik
Director SuSE Labs

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

* Re: USB mouse protocol,
       [not found]   ` <20080430111816.GA9876-AlSwsSmVLrQ@public.gmane.org>
@ 2008-04-30 14:07     ` xerces8
  2008-04-30 14:12       ` Vojtech Pavlik
  0 siblings, 1 reply; 5+ messages in thread
From: xerces8 @ 2008-04-30 14:07 UTC (permalink / raw)
  To: Vojtech Pavlik
  Cc: linux-input-u79uwXL29TY76Z2rM5mHXA,
	linux-usb-u79uwXL29TY76Z2rM5mHXA

Vojtech Pavlik wrote:

> On Wed, Apr 30, 2008 at 11:28:59AM +0200, xerces8 wrote:
> > Hi!
> > 
> > I'm curious about some details in the protocol used by USB mice.
> > A cursory look at the "Device Class Definition for HID 1.11" documents
> > tells me (note this is the first USB technical document I ever read)
> > that a mouse can tell the host the format (the protocol) used to report
> > data (movement, button state etc.).
> > 
> > Also a quick look into linuxv2.6.25/drivers/hid/usbhid/usbmouse.c suggests
> > that 8 bits are used for position.
> > 
> > So my questions are:
> >  - is the position data always 8 bits wide ?
> 
> No. The driver you need to look at is usbhid.ko, not usbmouse - that
> only works for the static "HID Boot Protocol", and is only useful in
> embedded devices.

Pretty hard to read there... Can I activate some debug output, to see what
my mouse is sending ?

> >  - when are reports sent ? Are they polled by host ? Or sent by the device
> > on its own ?
> 
> That depends on how you look at it. The host controller polls the device
> at a specified rate - typically 100Hz, but the device decides whether it
> will or won't send a report when polled.

100Hz is the linux default ? Is there an USB standard value ?

Regards,
David


--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: USB mouse protocol,
  2008-04-30 14:07     ` xerces8
@ 2008-04-30 14:12       ` Vojtech Pavlik
  2008-05-01 15:29         ` Anssi Hannula
  0 siblings, 1 reply; 5+ messages in thread
From: Vojtech Pavlik @ 2008-04-30 14:12 UTC (permalink / raw)
  To: xerces8; +Cc: linux-input, linux-usb

On Wed, Apr 30, 2008 at 04:07:06PM +0200, xerces8 wrote:
> Vojtech Pavlik wrote:
> 
> > On Wed, Apr 30, 2008 at 11:28:59AM +0200, xerces8 wrote:
> > > Hi!
> > > 
> > > I'm curious about some details in the protocol used by USB mice.
> > > A cursory look at the "Device Class Definition for HID 1.11" documents
> > > tells me (note this is the first USB technical document I ever read)
> > > that a mouse can tell the host the format (the protocol) used to report
> > > data (movement, button state etc.).
> > > 
> > > Also a quick look into linuxv2.6.25/drivers/hid/usbhid/usbmouse.c suggests
> > > that 8 bits are used for position.
> > > 
> > > So my questions are:
> > >  - is the position data always 8 bits wide ?
> > 
> > No. The driver you need to look at is usbhid.ko, not usbmouse - that
> > only works for the static "HID Boot Protocol", and is only useful in
> > embedded devices.
> 
> Pretty hard to read there... Can I activate some debug output, to see what
> my mouse is sending ?

Yes, #define DEBUG and possibly also DEBUG_DATA will do the trick.

> 
> > >  - when are reports sent ? Are they polled by host ? Or sent by the device
> > > on its own ?
> > 
> > That depends on how you look at it. The host controller polls the device
> > at a specified rate - typically 100Hz, but the device decides whether it
> > will or won't send a report when polled.
> 
> 100Hz is the linux default ? Is there an USB standard value ?

100Hz is what mice normally ask for. The frequency is in the endpoint
descriptor provided by the mouse.

-- 
Vojtech Pavlik
Director SuSE Labs

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

* Re: USB mouse protocol,
  2008-04-30 14:12       ` Vojtech Pavlik
@ 2008-05-01 15:29         ` Anssi Hannula
  0 siblings, 0 replies; 5+ messages in thread
From: Anssi Hannula @ 2008-05-01 15:29 UTC (permalink / raw)
  To: Vojtech Pavlik; +Cc: xerces8, linux-input, linux-usb

Vojtech Pavlik wrote:
> On Wed, Apr 30, 2008 at 04:07:06PM +0200, xerces8 wrote:
>> Vojtech Pavlik wrote:
>>
>>> On Wed, Apr 30, 2008 at 11:28:59AM +0200, xerces8 wrote:
>>>> Hi!
>>>>
>>>> I'm curious about some details in the protocol used by USB mice.
>>>> A cursory look at the "Device Class Definition for HID 1.11" documents
>>>> tells me (note this is the first USB technical document I ever read)
>>>> that a mouse can tell the host the format (the protocol) used to report
>>>> data (movement, button state etc.).
>>>>
>>>> Also a quick look into linuxv2.6.25/drivers/hid/usbhid/usbmouse.c suggests
>>>> that 8 bits are used for position.
>>>>
>>>> So my questions are:
>>>>  - is the position data always 8 bits wide ?
>>> No. The driver you need to look at is usbhid.ko, not usbmouse - that
>>> only works for the static "HID Boot Protocol", and is only useful in
>>> embedded devices.
>> Pretty hard to read there... Can I activate some debug output, to see what
>> my mouse is sending ?
> 
> Yes, #define DEBUG and possibly also DEBUG_DATA will do the trick.

Not true anymore on recent kernels. You need to enable CONFIG_HID_DEBUG
and use the debug module parameter (/sys/module/hid/parameters/debug).

-- 
Anssi Hannula

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

end of thread, other threads:[~2008-05-01 15:29 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-04-30  9:28 USB mouse protocol, xerces8
2008-04-30 11:18 ` Vojtech Pavlik
     [not found]   ` <20080430111816.GA9876-AlSwsSmVLrQ@public.gmane.org>
2008-04-30 14:07     ` xerces8
2008-04-30 14:12       ` Vojtech Pavlik
2008-05-01 15:29         ` Anssi Hannula

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).