4
votes

I will try to describe my problem as clearly as possible. I am trying to get a touchscreen device working with Android. the device is a USB device and I have it working correctly in various OSs (Windows, Mac OS X, Ubuntu). In Android 4.0.4 I seem to be having a problem. There is some touch response, but it is not correct. the touchscreen manifests itself as a touchpad rather than an absolute touchscreen, also, touches are not correctly occurring.

I have been looking at the various HID descriptors and have found the following that may be causing an issue with Android:

Interface 0 HID Report Descriptor Mouse
Item Tag (Value)    Raw Data
Usage Page (Generic Desktop)    05 01 
Usage (Mouse)   09 02 
Collection (Application)    A1 01 
    Usage (Pointer) 09 01 
    Collection (Physical)   A1 00 
        Usage Page (Digitizer)  05 0D 
        Usage (Touch)   09 33 
        Usage Minimum (Digitizer)   19 01 
        Usage Maximum (Digitizer)   29 01 
        Logical Minimum (0) 15 00 
        Logical Maximum (1) 25 01 
        Report Count (1)    95 01 
        Report Size (1) 75 01 
        Input (Data,Var,Abs,NWrp,Lin,Pref,NNul,Bit) 81 02 
        Report Count (1)    95 01 
        Report Size (7) 75 07 
        Input (Cnst,Ary,Abs)    81 01 
        Usage Page (Generic Desktop)    05 01 
        Usage (X)   09 30 
        Usage (Y)   09 31 
        Logical Minimum (0) 15 00 
        Logical Maximum (1024)  26 00 04 
        Physical Minimum (16)   35 10 
        Physical Maximum (1024) 46 00 04 
        Unit (None) 65 00 
        Report Size (16)    75 10 
        Report Count (2)    95 02 
        Input (Data,Var,Abs,NWrp,Lin,NPrf,Null,Bit) 81 62 
    End Collection  C0 
End Collection

Now it looks like the device is reporting as both a digitiser and a touch device? The device is only a single touch "point and press" device, and reports absolute X and Y coordinates.

I'm wondering if android get confused reading this report and as such loads a digitiser/tablet configuration rather than the touchscreen one? There are some pointers here http://source.android.com/tech/input/touch-devices.html, but I don't really understand where these things are being reported/defined?

Any help would be greatly appreciated. I can send more info from HID reports if necessary.

2

2 Answers

2
votes

Based on my analysis i am giving this suggestion. Take the factor of logical maximum to physical maximum for both X and Y.

factorValue = Logical Maximum/Physica Maximum

Multiply this factorValue with the raw coordinates which are coming from touch screen and try sending to android.

1
votes

Generally it is critical to use a mouse device that sends absolute coordinates. For example on Linux this will not work due to bugs and misdesigns in X11.

Your descriptor is surely wrong. You cannot mix mouse and digitizer.
They are two different device categories. A digitizer may be a touchscreen or a pen, but not a mouse. You are risking that a driver does not know what to do with your device. Your descriptor is neither fish nor fowl.

You are mixing up different things: Usage Page "Generic Desktop" with Usage Page "Digitizer".

To go sure in my project I do not use a hand-made descriptor. I finally cloned a real touchscreen from ELO Touchsystems. That works on all operating systems where I tested it. I cannot say if it works also on Android.

But you can simply try my descriptor: http://www.codeproject.com/Articles/1001891/A-USB-HID-Keyboard-Mouse-Touchscreen-emulator-with