Skip to contentSkip to conversation

USB mouse protocol,

DISCUSSION xerces8 3 participants 5 messages Apr 30, 2008 – May 1, 2008 1 message not in the archive HID

lore
Share & tools
lore

xerces8

author
#0 lore raw

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 [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#1 lore raw
Quoted 8 lines · 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.).

Quoted 5 lines

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.

Quoted 2 lines

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

Signature · 2 lines
Vojtech Pavlik
Director SuSE Labs
author
#3 lore raw
In reply to a message not in the archive
Quoted 12 lines · Vojtech Pavlik
Quoted 11 lines · 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.

Quoted 6 lines
Quoted 2 lines

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 ?

Quoted 6 lines
Quoted 2 lines

- 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 [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#4 lore raw
Quoted 17 lines · On Wed, Apr 30, 2008 at 04:07:06PM +0200, xerces8 wrote:
Quoted 15 lines · Vojtech Pavlik
Quoted 13 lines · 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 ?

Quoted 6 lines
Quoted 3 lines

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.

Quoted 9 lines
Quoted 7 lines
Quoted 3 lines

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

Signature · 2 lines
Vojtech Pavlik
Director SuSE Labs
#5 lore raw
Quoted 17 lines · Vojtech Pavlik
Quoted 16 lines · On Wed, Apr 30, 2008 at 04:07:06PM +0200, xerces8 wrote:
Quoted 14 lines · Vojtech Pavlik
Quoted 13 lines · 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 ?

Quoted 7 lines
Quoted 5 lines
Quoted 3 lines

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

Signature · 1 line
Anssi Hannula