Ticket #4847: 0001-fix-for-older-Wacom-tablet.patch

File 0001-fix-for-older-Wacom-tablet.patch, 2.5 KB (added by Pete, 10 years ago)

Revised git-format patch

  • src/add-ons/input_server/devices/wacom/TabletDevice.cpp

    From 6bba65580a57fe0feffeac5e68267f2f4aae3429 Mon Sep 17 00:00:00 2001
    From: Pete Goodeve <pete.goodeve@computer.org>
    Date: Sat, 27 Sep 2014 17:17:05 -0700
    Subject: [PATCH] fix for older Wacom tablet
    
    ---
     .../input_server/devices/wacom/TabletDevice.cpp    |   28 +++++++++++++++-----
     1 file changed, 21 insertions(+), 7 deletions(-)
    
    diff --git a/src/add-ons/input_server/devices/wacom/TabletDevice.cpp b/src/add-ons/input_server/devices/wacom/TabletDevice.cpp
    index b187573..345b819 100644
    a b TabletDevice::ReadData(const uchar* data, int dataBytes, bool& hasContact,  
    386386                    pressure = 0.0;
    387387                    eraser = 0;
    388388                } else {
    389 //                  eraser = (data[1] & 0x20); // eraser is een tool-id
    390 //                  firstButton = (pressureData > 0) && data[9] <= 0x68;// > 180);
    391 //                  firstButton = (pressureData > 180);
    392                     firstButton = (data[6] > 0);
     389                    firstButton = (data[6] > 2);
     390                        // For Intuos it MUST be >1,
     391                        // but '>1' still gets false actuations (shaking)
    393392                    secondButton = (data[1] & 0x02);
    394393                    thirdButton = (data[1] & 0x04);
    395394                    hasContact = (data[1] & 0x40);
    396                     // convert tilt (-128 ... 127)
    397 //                  int8 tiltDataX = ((data[7] & 0x3f) << 2) | ((data[8] & 0x80) >> 6);
     395                        // TODO: is this meaningful? (always true on Intuos)
     396                    if (fDeviceMode == DEVICE_INTUOS) { // TODO: test perhaps superfluous?
     397                        // Original Intuos protocol:
     398                        //  data[6] is used to signal use of the eraser,
     399                        //  as well as being the high bits of pressure.
     400                        //  While not in contact:
     401                        //   If the pen end is lowermost data[6] = 1;
     402                        //   If the eraser end is down data[6] = 0, and pressure is strictly 0
     403                        //   data[9] (top 5 bits: 0x70..0xd0) indicates height above the tablet.
     404                        eraser = fEraser;
     405                            // keep established value unless not touching pad
     406                        // Eraser state only valid when away from surface
     407                        if (data[6] <= 1 && data[9] > 0x80) {   // not touching tablet
     408                            if (pressureData == 0) eraser = 1;  // strictly 0 means eraser
     409                            else if (pressureData > 6) eraser = 0;  // avoid slop
     410                        }
     411                    }
     412                    // Get raw tilt values (0..54..127)
    398413                    int8 tiltDataX = ((data[7] & 0x3f) << 1) | ((data[8] & 0x80) >> 7);
    399414                    int8 tiltDataY = data[8] & 0x7f;
    400 //                  int8 tiltDataY = 0;
    401415                    // convert to floats
    402416                    tiltX = (float)(tiltDataX - 64) / 64.0;
    403417                    tiltY = (float)(tiltDataY - 64) / 64.0;