Add a new WBUSTYPE_I2C and other supporting changes to allow libwacom
to recognize a tablet definition which has "i2c" for the bus (instead
of e.g. "usb").

Signed-off-by: Jason Gerecke <jason.gere...@wacom.com>
---
 libwacom/libwacom-database.c | 4 ++++
 libwacom/libwacom.c          | 7 ++++++-
 libwacom/libwacom.h          | 3 ++-
 3 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/libwacom/libwacom-database.c b/libwacom/libwacom-database.c
index 2da4504..ed67de9 100644
--- a/libwacom/libwacom-database.c
+++ b/libwacom/libwacom-database.c
@@ -103,6 +103,8 @@ bus_from_str (const char *str)
                return WBUSTYPE_SERIAL;
        if (strcmp (str, "bluetooth") == 0)
                return WBUSTYPE_BLUETOOTH;
+       if (strcmp (str, "i2c") == 0)
+               return WBUSTYPE_I2C;
        return WBUSTYPE_UNKNOWN;
 }
 
@@ -119,6 +121,8 @@ bus_to_str (WacomBusType bus)
                return "serial";
        case WBUSTYPE_BLUETOOTH:
                return "bluetooth";
+       case WBUSTYPE_I2C:
+               return "i2c";
        }
        g_assert_not_reached ();
 }
diff --git a/libwacom/libwacom.c b/libwacom/libwacom.c
index 87efbd0..ba61764 100644
--- a/libwacom/libwacom.c
+++ b/libwacom/libwacom.c
@@ -140,6 +140,10 @@ get_bus_vid_pid (GUdevDevice  *device,
                *bus = WBUSTYPE_BLUETOOTH;
                retval = TRUE;
                break;
+       case 24:
+               *bus = WBUSTYPE_I2C;
+               retval = TRUE;
+               break;
        }
 
 out:
@@ -267,7 +271,7 @@ get_device_info (const char            *path,
                g_object_unref (parent);
        }
 
-       /* Parse the PRODUCT attribute (for Bluetooth and USB) */
+       /* Parse the PRODUCT attribute (for Bluetooth, USB, I2C) */
        retval = get_bus_vid_pid (device, bus, vendor_id, product_id, error);
        if (retval)
                goto out;
@@ -729,6 +733,7 @@ libwacom_print_device_description(int fd, const WacomDevice 
*device)
                        case WBUSTYPE_BLUETOOTH:        bus_name = "bluetooth"; 
break;
                        case WBUSTYPE_USB:              bus_name = "usb";       
break;
                        case WBUSTYPE_SERIAL:           bus_name = "serial";    
break;
+                       case WBUSTYPE_I2C:              bus_name = "i2c";       
break;
                        case WBUSTYPE_UNKNOWN:          bus_name = "unknown";   
break;
                        default:                        g_assert_not_reached(); 
break;
                }
diff --git a/libwacom/libwacom.h b/libwacom/libwacom.h
index a0778c5..3d3cbb1 100644
--- a/libwacom/libwacom.h
+++ b/libwacom/libwacom.h
@@ -114,7 +114,8 @@ typedef enum {
        WBUSTYPE_UNKNOWN,               /**< Unknown/unsupported bus type */
        WBUSTYPE_USB,           /**< USB tablet */
        WBUSTYPE_SERIAL,                /**< Serial tablet */
-       WBUSTYPE_BLUETOOTH              /**< Bluetooth tablet */
+       WBUSTYPE_BLUETOOTH,             /**< Bluetooth tablet */
+       WBUSTYPE_I2C,           /**< I2C tablet */
 } WacomBusType;
 
 /**
-- 
2.4.3


------------------------------------------------------------------------------
_______________________________________________
Linuxwacom-devel mailing list
Linuxwacom-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel

Reply via email to