[haiku-development] Re: Tablets and messages

  • From: "mmlr@xxxxxxxx" <mmlr@xxxxxxxx>
  • To: haiku-development@xxxxxxxxxxxxx
  • Date: Thu, 16 Dec 2010 20:07:43 +0100 (CET)

On December 16, 2010 at 8:38 AM Enrique Medina Gremaldos <quiqueiii@xxxxxxxxx>
wrote:
> Ok, so I followed your advices, moved current driver to the trash and
> implemented again as a usb_hid device. I've created a TabletDevice
> subclassing ProtocolHandler and sent absolute coordinates using
> tablet_movement structure instead. From user space land, I've just enabled
> again TabletInputDevice (had to fix a pair of lines to get it working
> again). All of this happened last two nights, so It is impressive to plug
> usb digitizers on haiku and move the stylus around the desktop but still
> tons of things to do, as handling properly clicks and check logs for
> possible errors (there are some uhci token error :S).
 
The UHCI parts are clearly abstracted from the upper layers, so you're not
causing them directly. If it's just the ones that happen on unplug then they can
be ignored. If they're actually problematic then please file a bug report and
add the syslog output with a brief description of when they happen.
 
> The part I do not know how to go on, is the usb_hid detection. Currently If
> device has X and Y items, It is a mouse device  , I obviously hacked this
> part to get tablets working, but It is not clear to me what is the proper
> way to detect a device and instantiate proper subclass (KeyboardDevice,
> MouseDevice, TabletDevice, and maybe TouchScreenDevice :D )
 
I still wonder why you need to separate them at all. They do have X and Y items
which should correctly report HIDReportItem::Relative() == false, so why not
just reuse the whole MouseDevice and unify the mouse_ and tablet_movement
structures (so they have a relative flag that describes whether the data is
absolute or relative) and then fill such a flag according to whether the report
items are relative or not. Unless the TabletInputDevice does other magic missing
from the MouseInputDevice I don't really see why we need two device classes and
two input_server add-ons handling essentially the same data.
 
On the topic of finding the device type: Either you use the HID usage to
determine what type of logical device it is (the descriptors are already parsed,
use HIDCollection to get to the relevant info, you need to add a getter for
fUsage and fType there though). Or, just make the distinction by checking
whether the HIDReportItems you get are relative or not, i.e. "if (xAxis == NULL
|| !xAxis->Relative()) return NULL" in the MouseDevice class and the opposite in
the TabletDevice class.
 
Regards
Michael

Other related posts: