Testing Sanity

The core task of software development is sanity testing.

  • warning: Creating default object from empty value in /home2/thepalls/public_html/cgpsoftware/modules/taxonomy/taxonomy.pages.inc on line 34.
  • warning: Parameter 2 to gmap_gmap() expected to be a reference, value given in /home2/thepalls/public_html/cgpsoftware/includes/module.inc on line 483.
  • strict warning: Non-static method view::load() should not be called statically in /home2/thepalls/public_html/cgpsoftware/sites/all/modules/views/views.module on line 879.

input devices

Posted by cgp

So, now that I've got my firmware up to date, I'm ready to hookup the touchscreen to my Android device. The hardware manufacturer doesn't seem to have done any work to get it ready to work with Android, so I'm going to end up doing some of that manually. I hooked up the monitor via a powered USB hub. We hope to use it in the kitchen for the kids to keep track of chores and todo's etc. We'll see how well it ends up being used.

So, in the input Android documentation it gives you the following hint:

The input system is part of the window manager. To dump its state, run the following command:

  adb shell su -- dumpsys window >e:\shell_dump.txt 

It states you should end up with some lines that look like:

...
Event Hub State:
  BuiltInKeyboardId: -1
  Devices:
    3: tuna-gpio-keypad
...
    5: Tuna Headset Jack
...

This didn't end up being the case for me. My output ended up being mostly all about -- well, windows. (see attachment)

Getevent is very helpful

So, I dug around a little more and found Getevent, which was exactly what I was looking for. In particular, in the section "Showing Device Capabilities", there is the command:

adb shell su -- getevent -p

This gave me what I was looking for:

add device 1: /dev/input/event4
  name:     "USBest Technology SiS HID Touch Controller"
  events:
    KEY (0001): 014a 
    ABS (0003): 0000  : value 0, min 0, max 4095, fuzz 0, flat 0, resolution 0
                0001  : value 0, min 0, max 4095, fuzz 0, flat 0, resolution 0

So, now I knew the internal touchscreen controller on the monitor. This will provide excellent fodder for seeing if others have setup a similar controller for Android or Ubuntu etc... 

There is even more information to be had on the same page. I can get the human readable labels for event which will end up getting used if I log the output:

adb shell su -- getevent -lp /dev/input/event1

which yields:

add device 1: /dev/input/event4
  name:     "USBest Technology SiS HID Touch Controller"
  events:
    KEY (0001): BTN_TOUCH            
    ABS (0003): ABS_X                 : value 0, min 0, max 4095, fuzz 0, flat 0, resolution 0
                ABS_Y                 : value 0, min 0, max 4095, fuzz 0, flat 0, resolution 0
                ABS_Z                 : value 0, min 0, max 4095, fuzz 0, flat 0, resolution 0
                ABS_RX                : value 0, min 0, max 4095, fuzz 0, flat 0, resolution 0
                ABS_RY                : value 0, min 0, max 4095, fuzz 0, flat 0, resolution 0
                ABS_RZ                : value 0, min 0, max 4095, fuzz 0, flat 0, resolution 0
                ABS_THROTTLE          : value 0, min 0, max 4095, fuzz 0, flat 0, resolution 0
                ABS_RUDDER            : value 0, min 0, max 4095, fuzz 0, flat 0, resolution 0
                ABS_WHEEL             : value 0, min 0, max 4095, fuzz 0, flat 0, resolution 0
                ABS_GAS               : value 0, min 0, max 4095, fuzz 0, flat 0, resolution 0
                ABS_BRAKE             : value 0, min 0, max 4095, fuzz 0, flat 0, resolution 0
                000b                  : value 0, min 0, max 4095, fuzz 0, flat 0, resolution 0
                000c                  : value 0, min 0, max 4095, fuzz 0, flat 0, resolution 0
                000d                  : value 0, min 0, max 4095, fuzz 0, flat 0, resolution 0
                000e                  : value 0, min 0, max 4095, fuzz 0, flat 0, resolution 0
                000f                  : value 0, min 0, max 4095, fuzz 0, flat 0, resolution 0
                ABS_HAT0X             : value 0, min 0, max 4095, fuzz 0, flat 0, resolution 0
                ABS_HAT0Y             : value 0, min 0, max 4095, fuzz 0, flat 0, resolution 0
                ABS_HAT1X             : value 0, min 0, max 4095, fuzz 0, flat 0, resolution 0
                ABS_HAT1Y             : value 0, min 0, max 4095, fuzz 0, flat 0, resolution 0
                ABS_MISC              : value 0, min 0, max 255, fuzz 0, flat 0, resolution 0
                0029                  : value 0, min 0, max 255, fuzz 0, flat 0, resolution 0
                002a                  : value 0, min 0, max 255, fuzz 0, flat 0, resolution 0
                002b                  : value 0, min 0, max 255, fuzz 0, flat 0, resolution 0
                002c                  : value 0, min 0, max 255, fuzz 0, flat 0, resolution 0
                002d                  : value 0, min 0, max 255, fuzz 0, flat 0, resolution 0
                002e                  : value 0, min 0, max 255, fuzz 0, flat 0, resolution 0
                ABS_MT_SLOT           : value 0, min 0, max 255, fuzz 0, flat 0, resolution 0
                ABS_MT_TOUCH_MAJOR    : value 0, min 0, max 255, fuzz 0, flat 0, resolution 0
                ABS_MT_TOUCH_MINOR    : value 0, min 0, max 255, fuzz 0, flat 0, resolution 0
                ABS_MT_WIDTH_MAJOR    : value 0, min 0, max 10, fuzz 0, flat 0, resolution 0
                ABS_MT_WIDTH_MINOR    : value 0, min 0, max 65535, fuzz 0, flat 0, resolution 0
    MSC (0004): MSC_SCAN             
  input props:
    <none>

Most events have a label, but not everything. When I capture the output, I can see the device doing things: (take note that your device ID matches when using this commend)

adb shell su -- getevent -lt /dev/input/event4

which when I touched the screen yielded:

[     396.439831] EV_MSC       MSC_SCAN             000d0042            
[     396.439846] EV_KEY       BTN_TOUCH            DOWN                
[     396.439880] EV_ABS       ABS_X                00000639            
[     396.439897] EV_ABS       ABS_Y                0000086a            
[     396.439910] EV_MSC       MSC_SCAN             000d0042            
[     396.439913] EV_KEY       BTN_TOUCH            UP                  
[     396.439929] EV_ABS       ABS_Z                0000000c            
[     396.439940] EV_ABS       ABS_RX               00000004            
[     396.439968] EV_ABS       002a                 000000ff            
[     396.439976] EV_ABS       ABS_RY               0000ffff            
[     396.439984] EV_ABS       ABS_RZ               0000ffff            
[     396.440009] EV_ABS       002b                 000000ff            
[     396.440023] EV_ABS       ABS_THROTTLE         0000ffff            
[     396.440044] EV_ABS       ABS_RUDDER           0000ffff            
[     396.440070] EV_ABS       002c                 000000ff            
[     396.440080] EV_ABS       ABS_WHEEL            0000ffff            
[     396.440089] EV_ABS       ABS_GAS              000000ff            
[     396.440125] EV_ABS       ABS_BRAKE            0000ffff            
[     396.440138] EV_ABS       000b                 0000ffff            
[     396.440158] EV_ABS       002e                 000000ff            
[     396.440168] EV_ABS       000c                 0000ffff            
[     396.440178] EV_ABS       000d                 0000ffff            
[     396.440203] EV_ABS       000e                 0000ffff            
[     396.440216] EV_ABS       000f                 0000ffff            
[     396.440237] EV_ABS       ABS_MT_TOUCH_MAJOR   00000004            

(I didn't include everything, but I did attach it.)

So, this was the first indication I had that the monitor was working at all. Up until this point, I hadn't seen Android react to me touching the screen. When I saw this I tried a lot more monkeying around with the screen. I managed to get the Android to show me some type of hover event when I placed all 10 fingers on the device. It wasn't centered on my fingers either. I thought maybe it needed calibration but after installing a couple of Android calibration apps I was unable to make any additional headway.

So, currently I'm reading about Touch Devices and Input Device Configuration Files and digging into why it seems what is being touched on the screen isn't mapping into the OS. I'm sure there will also be some googling of the "USBest Technology SiS HID Touch Controller" as well. I think I've seen some remarks with regards to this controller being used with other tablets, so this can't be too exotic. 

Digging into the details of hardware on Android is surprisingly easy. I'm impressed that I can pull up as much information as I can about various devices and even OS state so easily. I guess a lot of my success probably has to do with the generic nature of USB as much as the nature of Android though. Looking forward to digging in further and figuring out this hang up though.