History log of /haiku-fatelf/src/add-ons/kernel/drivers/input/usb_hid/HIDParser.cpp
Revision Date Author Comments
# 9aec639d 04-Jun-2011 Michael Lotz <mmlr@mlotz.ch>

Add a PrintToStream() method to HIDParser that prints the resulting reports and
the root collection.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41922 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 305aff3f 28-May-2011 Michael Lotz <mmlr@mlotz.ch>

* Changed the way how devices are enumerated and protocol handlers are added to
handle the different device classes. Handlers are now added based on the
application collections that the HID descriptor describes instead of by
enumerating the different report items inside the reports. This means that a
device is now logically treated as a mouse when it comes with an application
collection that designates it as a mouse, instead of when there is a report
that contains an X and a Y axis. This resolves the conflicts that gamepads
and joysticks were added as mice due to them containing such elements. This
therefore fixes #4499 and opens up the way to properly handle other device
types like joysticks (#7429), gamepads, tablets (#7354, #5989 and #7481) and
so on. I'll work on gamepads/joysticks next and see where we stand for tablets
later.
* Added a few enumeration functions to HIDCollection to support the above.
* Fix the root collection handling. A device doesn't describe a single root
collection and then adds everything as a child. Instead it just has multiple
collections on level 0. We account for that now by always creating an empty
logical collection as the root collection where all the collections of the
descriptor get added.
* Rename the {Mouse|Keyboard}Device.{cpp|h} to
{Mouse|Keyboard}ProtocolHandler.{cpp|h} as that more clearly describes their
purpose. These classes are protocol handlers, i.e. they handle the ioctl based
mouse and keyboard protocol between the driver and the input_server add-ons.
* Change a lot of stuff to use references instead of pointers where it makes
sense (not necessarily complete yet).

I've tested this successfully on a keyboard with extended keys, a combo device
with a keyboard with extended keys and a mouse, a mouse and a gamepad (that now
doesn't do anything anymore) and found no regressions. However, since there are
a lot of very varied ways how to describe such functions with HID, it's not too
unlikely that some more curiously described devices will now stop working. These
have to be handled case by case and their usages have to be added to the added
to the appropriate handlers (or new handlers have to be written). Please test
and create bug reports (preferrably including the report descriptor that is
written out to /tmp).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41794 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 6e499760 14-Mar-2011 Michael Lotz <mmlr@mlotz.ch>

* Since the usages of the local state are now processed also for collections
there is no need to do the usage page and usage id handling anymore.
* As this also removes the only use of the global state it is removed as well.
* Try the usage maximum as a fallback as well and print something if none of the
usage sources are valid and the collection ends up without a proper usage.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@40954 a95241bf-73f2-0310-859d-f6bbb57e9c96


# baba9584 14-Mar-2011 Michael Lotz <mmlr@mlotz.ch>

Do the usage preprocessing also for collections. While the collection handles
the conversion, it makes it easier to do it for all items the same. This fixes
the missing initialization of the usage stack as pointed out by caz_haiku in
#7354, thanks for the pointer!


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@40953 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 6391a799 14-Mar-2011 Michael Lotz <mmlr@mlotz.ch>

* Correct case for long items (didn't matter as no long items are defined).
* Move the main data declaration to where it's used.
* Tiny cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@40952 a95241bf-73f2-0310-859d-f6bbb57e9c96


# beaabe98 20-Dec-2010 Michael Lotz <mmlr@mlotz.ch>

Fix CID 9580 although it is harmless as the _Reset() call before parsing does
initialize the member.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39910 a95241bf-73f2-0310-859d-f6bbb57e9c96


# fd97180e 26-Jan-2010 Michael Lotz <mmlr@mlotz.ch>

Make the HID parser usable standalone in userland.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35305 a95241bf-73f2-0310-859d-f6bbb57e9c96


# c9c3b32d 21-Aug-2009 Michael Lotz <mmlr@mlotz.ch>

Rework incoming report handling. We need to notify all reports when one comes in
because all reports schedule transfers on the same endpoint and therefore need
to possibly reschedule. Previously if we got a report that we didn't listen on
all further reports would stop, because noone would schedule a new transfer.
This fixes extra keys not working on my natural keyboard.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32580 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 8e1857f7 26-Jul-2009 Michael Lotz <mmlr@mlotz.ch>

* Completely rework the USB HID driver to make use of the HID framework
introduced earlier.
* Reworked the previous device classes to make them ProtocolHandlers handling
their respective input_server <-> driver protocol.
* Implement setting report item data and building/sending reports based on that.
* Remove the old HID parsing code.

This enables us to use all HID devices as we now parse and use the HID
descriptors/reports. Non-boot-porotocol devices should therefore work.

The next step will be to implement a generic input/output framework in userland
that can communicate with a generic protocol handler in usb_hid. This will then
enable applications to make use of all the non-mapped HID stuff directly.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31790 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 5ba33c51 21-May-2009 Michael Lotz <mmlr@mlotz.ch>

* Integrate reports/items some more.
* Reorganize how items are added to collections.
* Make collections useful for enumeration through that.
* Added printing out of collections, reports and report items for easier
verification of report parsing.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30821 a95241bf-73f2-0310-859d-f6bbb57e9c96


# aaeffcf7 07-May-2009 Michael Lotz <mmlr@mlotz.ch>

Adding missing license headers.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30665 a95241bf-73f2-0310-859d-f6bbb57e9c96


# e7fcf08d 07-May-2009 Michael Lotz <mmlr@mlotz.ch>

Adding a complete HID parser and report handling facility. This is generic code,
so should be reusable for bluethooth HID as well (which is the same). The only
missing part so far is the logical collections that would allow nicer
enumeration of the report structure but is otherwise not useful. It should
support all of the HID specs except for usage aliases (even long items that
aren't actually defined should just work if they ever are). Not integrated into
the USB specific device framework and there are no actual drivers making use
of provided functionallity. The parsing was tested and works for all of the 3
devices I had available, but actual interpretation of data is not tested as the
driver side is missing. Will close that gap as a next step and then port the
mouse and keyboard drivers to that framework. Eventually a generic driver that
makes unknown fields available to userland apps in some way should be fairly
easy to implement with that.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30664 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 9aec639d128b09e0ad0dcfcd0e065315832caaec 04-Jun-2011 Michael Lotz <mmlr@mlotz.ch>

Add a PrintToStream() method to HIDParser that prints the resulting reports and
the root collection.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41922 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 305aff3f787ca5d2e0e5ef44fe3487ca3fb7adae 28-May-2011 Michael Lotz <mmlr@mlotz.ch>

* Changed the way how devices are enumerated and protocol handlers are added to
handle the different device classes. Handlers are now added based on the
application collections that the HID descriptor describes instead of by
enumerating the different report items inside the reports. This means that a
device is now logically treated as a mouse when it comes with an application
collection that designates it as a mouse, instead of when there is a report
that contains an X and a Y axis. This resolves the conflicts that gamepads
and joysticks were added as mice due to them containing such elements. This
therefore fixes #4499 and opens up the way to properly handle other device
types like joysticks (#7429), gamepads, tablets (#7354, #5989 and #7481) and
so on. I'll work on gamepads/joysticks next and see where we stand for tablets
later.
* Added a few enumeration functions to HIDCollection to support the above.
* Fix the root collection handling. A device doesn't describe a single root
collection and then adds everything as a child. Instead it just has multiple
collections on level 0. We account for that now by always creating an empty
logical collection as the root collection where all the collections of the
descriptor get added.
* Rename the {Mouse|Keyboard}Device.{cpp|h} to
{Mouse|Keyboard}ProtocolHandler.{cpp|h} as that more clearly describes their
purpose. These classes are protocol handlers, i.e. they handle the ioctl based
mouse and keyboard protocol between the driver and the input_server add-ons.
* Change a lot of stuff to use references instead of pointers where it makes
sense (not necessarily complete yet).

I've tested this successfully on a keyboard with extended keys, a combo device
with a keyboard with extended keys and a mouse, a mouse and a gamepad (that now
doesn't do anything anymore) and found no regressions. However, since there are
a lot of very varied ways how to describe such functions with HID, it's not too
unlikely that some more curiously described devices will now stop working. These
have to be handled case by case and their usages have to be added to the added
to the appropriate handlers (or new handlers have to be written). Please test
and create bug reports (preferrably including the report descriptor that is
written out to /tmp).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41794 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 6e499760b3237ba6706ad54c6cf4143e12a00e50 14-Mar-2011 Michael Lotz <mmlr@mlotz.ch>

* Since the usages of the local state are now processed also for collections
there is no need to do the usage page and usage id handling anymore.
* As this also removes the only use of the global state it is removed as well.
* Try the usage maximum as a fallback as well and print something if none of the
usage sources are valid and the collection ends up without a proper usage.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@40954 a95241bf-73f2-0310-859d-f6bbb57e9c96


# baba9584ddf642a8b470ddf3cb58154b1fdeba4d 14-Mar-2011 Michael Lotz <mmlr@mlotz.ch>

Do the usage preprocessing also for collections. While the collection handles
the conversion, it makes it easier to do it for all items the same. This fixes
the missing initialization of the usage stack as pointed out by caz_haiku in
#7354, thanks for the pointer!


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@40953 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 6391a7995712a9c6ed54d2bfdee6057a721059b5 14-Mar-2011 Michael Lotz <mmlr@mlotz.ch>

* Correct case for long items (didn't matter as no long items are defined).
* Move the main data declaration to where it's used.
* Tiny cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@40952 a95241bf-73f2-0310-859d-f6bbb57e9c96


# beaabe98d10816531aedc6fd6a2bc1f858603878 20-Dec-2010 Michael Lotz <mmlr@mlotz.ch>

Fix CID 9580 although it is harmless as the _Reset() call before parsing does
initialize the member.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39910 a95241bf-73f2-0310-859d-f6bbb57e9c96


# fd97180e27b7d0d36876e8c04329fe11a1bd243d 26-Jan-2010 Michael Lotz <mmlr@mlotz.ch>

Make the HID parser usable standalone in userland.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35305 a95241bf-73f2-0310-859d-f6bbb57e9c96


# c9c3b32d3bb966e3851915bc03251b3dc4b5fad1 21-Aug-2009 Michael Lotz <mmlr@mlotz.ch>

Rework incoming report handling. We need to notify all reports when one comes in
because all reports schedule transfers on the same endpoint and therefore need
to possibly reschedule. Previously if we got a report that we didn't listen on
all further reports would stop, because noone would schedule a new transfer.
This fixes extra keys not working on my natural keyboard.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32580 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 8e1857f79521285ff4ecf2ab2a258191dd4aa0a8 26-Jul-2009 Michael Lotz <mmlr@mlotz.ch>

* Completely rework the USB HID driver to make use of the HID framework
introduced earlier.
* Reworked the previous device classes to make them ProtocolHandlers handling
their respective input_server <-> driver protocol.
* Implement setting report item data and building/sending reports based on that.
* Remove the old HID parsing code.

This enables us to use all HID devices as we now parse and use the HID
descriptors/reports. Non-boot-porotocol devices should therefore work.

The next step will be to implement a generic input/output framework in userland
that can communicate with a generic protocol handler in usb_hid. This will then
enable applications to make use of all the non-mapped HID stuff directly.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31790 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 5ba33c51f2ce94cddeed22b796bac9123cf296a9 21-May-2009 Michael Lotz <mmlr@mlotz.ch>

* Integrate reports/items some more.
* Reorganize how items are added to collections.
* Make collections useful for enumeration through that.
* Added printing out of collections, reports and report items for easier
verification of report parsing.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30821 a95241bf-73f2-0310-859d-f6bbb57e9c96


# aaeffcf7a6e28d2fda83bf59f370319805073449 07-May-2009 Michael Lotz <mmlr@mlotz.ch>

Adding missing license headers.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30665 a95241bf-73f2-0310-859d-f6bbb57e9c96


# e7fcf08d7661a3e0bd0684cd171d1f20a0c1f01a 07-May-2009 Michael Lotz <mmlr@mlotz.ch>

Adding a complete HID parser and report handling facility. This is generic code,
so should be reusable for bluethooth HID as well (which is the same). The only
missing part so far is the logical collections that would allow nicer
enumeration of the report structure but is otherwise not useful. It should
support all of the HID specs except for usage aliases (even long items that
aren't actually defined should just work if they ever are). Not integrated into
the USB specific device framework and there are no actual drivers making use
of provided functionallity. The parsing was tested and works for all of the 3
devices I had available, but actual interpretation of data is not tested as the
driver side is missing. Will close that gap as a next step and then port the
mouse and keyboard drivers to that framework. Eventually a generic driver that
makes unknown fields available to userland apps in some way should be fairly
easy to implement with that.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30664 a95241bf-73f2-0310-859d-f6bbb57e9c96