[haiku-bugs] Re: [Haiku] #7354: usb_hid tablet support

  • From: "caz_haiku" <trac@xxxxxxxxxxxx>
  • Date: Sun, 13 Mar 2011 01:28:02 -0000

#7354: usb_hid tablet support
---------------------------+-----------------------
   Reporter:  lt_henry     |      Owner:  mmlr
       Type:  enhancement  |     Status:  new
   Priority:  normal       |  Milestone:  R1
  Component:  Drivers/USB  |    Version:  R1/alpha2
 Resolution:               |   Keywords:  usb_hid
 Blocked By:               |   Blocking:
Has a Patch:  1            |   Platform:  All
---------------------------+-----------------------

Comment (by caz_haiku):

 mmlr,  Good work on usb_hid by the way.  i've looked at the
 HIDCollection.cpp and HIDParser.cpp.  In HIDParser.cpp when an
 ITEM_TYPE_LOCAL is detected and then the item->tag is an
 ITEM_TAG_LOCAL_USAGE should the code be as follows,
 :)
 value->u.s.usage_page = globalState.usage_page;[[BR]]
 value->u.s.usage_id = data;

 The code as it is now is[[BR]]
 value->u.extended = data;

 As far as i understand when an ITEM_TAG_LOCAL_USAGE is declared then it
 should have the usage page of the previously declared global usage page(Am
 i right ?).  Also when a new HIDCollection is created when the item->tag
 is ITEM_TAG_MAIN_COLLECTION the localstate is always empty when it's
 created for the first time.  This happens in the following situation,

 USAGE_PAGE(Generic Desktop) type global[[BR]]
 USAGE(GamePad) type local[[BR]]
 Then when an item of ITEM_TAG_MAIN_COLLECTION is found for the first time,
 the localState.usage_stack is passed to HIDCollection but it's empty
 because the localState.usage_stack hasn't been initialized to point to
 usageStack.[[BR]]

 I've modified the code as follows,
 if (item->tag == ITEM_TAG_MAIN_COLLECTION) {[[BR]]
 localState.usage_stack = usageStack;[[BR]]
 localState.usage_stack_used = usageStackUsed;[[BR]]
 // then the code continues as normal.[[BR]]

 By doing this modification the HIDCollection now at least has access to
 the correct USAGE_PAGE and USAGE_ID for the devices type we are trying to
 get.

-- 
Ticket URL: <http://dev.haiku-os.org/ticket/7354#comment:5>
Haiku <http://dev.haiku-os.org>
Haiku - the operating system.

Other related posts: