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

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

Comment (by mmlr):

 Replying to [comment:8 caz_haiku]:
 > After your modifications the collection now has the correct usagepage
 and usageid

 Good, so the other change you had in there first wasn't needed apparently
 and no need for any device workarounds.

 >  I want access to the UsagePage and UsageId in the collection so to
 check the device type,  is this acceptable?
 > {{{
 > if(collection->UsagePage() != B_HID_USAGE_PAGE_GENERIC_DESKTOP
 >               || collection->UsageID() != B_HID_UID_GD_GAMEPAD) return
 NULL;
 > }}}

 Yes that's perfectly fine and how it was intended to be used. I just never
 added those getters because I didn't use them anywhere back then.

 Replying to [comment:9 Disreali]:
 > Should the gamepad related stuff go on ticket:4499 or possible a
 separate enhancement ticket?

 I don't really mind either way. Both tablet and gamepad will need some
 common changes and there will be a device class driver for each. Shouldn't
 be a huge number of patches in the end, so I think we're fine
 consolidating both in this ticket.

 Replying to [comment:10 lt_henry]:
 > I've updated usb hid patch. This version is cleaner, there are no
 unnecessary trace outputs, and there are some improvements regarding haiku
 code guideline. Still far from perfect, of course. Next day I will update
 input server side.

 Looks better already, but there are still serious coding style issues. The
 code itself looks fine as far as I see from looking over it. One thing
 I've noticed though: You extract the tip and barrel switch and store them
 in bit 0 and 1 of buttons, but then loop through the generic buttons and
 add them as well with "(button->UsageID() - 1)" which would overwrite the
 tip and barrel again if there are any buttons (as their usage is 1 based
 resulting in button 0 going to bit 0 as well). So I wonder, is that just
 an oversight or is the whole generic button handling just a leftover from
 the mouse driver? If so it should just be removed completely.

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

Other related posts: