[haiku-commits] r38615 - haiku/trunk/src/add-ons/input_server/devices/wacom

  • From: mattmadia@xxxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Sun, 12 Sep 2010 14:42:17 +0200 (CEST)

Author: mmadia
Date: 2010-09-12 14:42:17 +0200 (Sun, 12 Sep 2010)
New Revision: 38615
Changeset: http://dev.haiku-os.org/changeset/38615
Ticket: http://dev.haiku-os.org/ticket/6108

Modified:
   haiku/trunk/src/add-ons/input_server/devices/wacom/TabletDevice.cpp
   haiku/trunk/src/add-ons/input_server/devices/wacom/TabletDevice.h
Log:
Patch by idefix: Add support for five different Bamboo devices. Closes #6108.


Modified: haiku/trunk/src/add-ons/input_server/devices/wacom/TabletDevice.cpp
===================================================================
--- haiku/trunk/src/add-ons/input_server/devices/wacom/TabletDevice.cpp 
2010-09-12 12:35:01 UTC (rev 38614)
+++ haiku/trunk/src/add-ons/input_server/devices/wacom/TabletDevice.cpp 
2010-09-12 12:42:17 UTC (rev 38615)
@@ -223,6 +223,21 @@
                case 0xB2:
                        SetDevice(60960.0, 45720.0, DEVICE_INTUOS3);
                        break;
+               case 0xD0:      // Wacom Bamboo 2FG (from Linux Wacom Project)
+                       SetDevice(14720.0, 9200.0, DEVICE_BAMBOO_PT);
+                       break;
+               case 0xD1:      // Wacom BambooFun 2FG 4x5 (from Linux Wacom 
Project)
+                       SetDevice(14720.0, 9200.0, DEVICE_BAMBOO_PT);
+                       break;
+               case 0xD2:      // Wacom Bamboo Craft (from Linux Wacom Project)
+                       SetDevice(14720.0, 9200.0, DEVICE_BAMBOO_PT);
+                       break;
+               case 0xD3:      // Wacom BambooFun 2FG 6x8 (from Linux Wacom 
Project)
+                       SetDevice(21648.0, 13530.0, DEVICE_BAMBOO_PT);
+                       break;
+               case 0xD4:      // Wacom Bamboo 4x5 (from Linux Wacom Project)
+                       SetDevice(14720.0, 9200.0, DEVICE_BAMBOO_PT);
+                       break;
                default:
                        status = B_BAD_VALUE;
                        break;
@@ -243,8 +258,8 @@
 
 // ReadData
 void
-TabletDevice::ReadData(const uchar* data, bool& hasContact, uint32& mode,
-       uint32& buttons, float& x, float& y, float& pressure,
+TabletDevice::ReadData(const uchar* data, int dataBytes, bool& hasContact,
+       uint32& mode, uint32& buttons, float& x, float& y, float& pressure,
        int32& clicks, int32& eraser, float& wheelX, float& wheelY,
        float& tiltX, float& tiltY) const
 {
@@ -302,6 +317,25 @@
 
                        break;
                }
+               case DEVICE_BAMBOO_PT:
+               {
+                       if (dataBytes < 20) {   // ignore touch-packets
+                               xPos = data[3] << 8 | data[2];
+                               yPos = data[5] << 8 | data[4];
+       
+                               hasContact = (data[1] & 0x10) && (data[1] & 
0x20);              
+       
+                               uint16 pressureData = data[7] << 8 | data[6];
+                               pressure = (float)pressureData / 1023.0;
+                               eraser = (data[1] & 0x08);
+       
+                               firstButton = (data[1] & 0x01);
+                               secondButton = (data[1] & 0x02);
+                               thirdButton = (data[1] & 0x04);
+       
+                               break;
+                       }
+               }
                case DEVICE_INTUOS:
                case DEVICE_INTUOS3:
                case DEVICE_CINTIQ:
@@ -598,7 +632,7 @@
                        float tiltX = 0.0;
                        float tiltY = 0.0;
                        // let the device extract all information from the data
-                       tabletDevice->ReadData(data, hasContact, mode, buttons,
+                       tabletDevice->ReadData(data, dataBytes, hasContact, 
mode, buttons,
                                                                   x, y, 
pressure, clicks, eraser,
                                                                   wheelX, 
wheelY, tiltX, tiltY);
                        if (hasContact) {
@@ -766,6 +800,23 @@
                case 0xB2:
                        *name = "Wacom Intuos3 9x12 USB";
                        break;
+
+               case 0xD0:
+                       *name = "Wacom Bamboo 2FG USB";
+                       break;
+               case 0xD1:
+                       *name = "Wacom BambooFun 2FG 4x5\" USB";
+                       break;
+               case 0xD2:
+                       *name = "Wacom Bamboo Craft USB";
+                       break;
+               case 0xD3:
+                       *name = "Wacom BambooFun 2FG 6x8\" USB";
+                       break;
+               case 0xD4:
+                       *name = "Wacom Bamboo 4x5\" USB";
+                       break;
+
                default:
                        *name = "<unkown wacom tablet>";
                        break;

Modified: haiku/trunk/src/add-ons/input_server/devices/wacom/TabletDevice.h
===================================================================
--- haiku/trunk/src/add-ons/input_server/devices/wacom/TabletDevice.h   
2010-09-12 12:35:01 UTC (rev 38614)
+++ haiku/trunk/src/add-ons/input_server/devices/wacom/TabletDevice.h   
2010-09-12 12:42:17 UTC (rev 38615)
@@ -31,6 +31,7 @@
                                                                        uint32 
mode = DEVICE_INTUOS);
 
                        void                            ReadData(const uchar* 
data,
+                                                                       int 
dataBytes,
                                                                        bool& 
hasContact,
                                                                        uint32& 
mode,
                                                                        uint32& 
buttons,
@@ -76,6 +77,7 @@
                DEVICE_PENSTATION,
                DEVICE_CINTIQ,
                DEVICE_BAMBOO,
+               DEVICE_BAMBOO_PT,
        };
 
        enum {


Other related posts:

  • » [haiku-commits] r38615 - haiku/trunk/src/add-ons/input_server/devices/wacom - mattmadia