[Linuxwacom-devel] BuiltIn flag set automatically, but based on what?
Hi all, I've been wondering, the BuiltIn flag (discussed earlier) is also set automatically on Linux in get_device_info() in libwacom/libwacom.c: 113 static gboolean 114 get_device_info (const char *path, ... 121 { ... 157 /* Is the device builtin? */ 158 devname = g_udev_device_get_name (device); 159 if (devname != NULL) { 160 char *sysfs_path, *contents; 161 162 sysfs_path = g_build_filename (/sys/class/input, devname, device/properties, NULL); 163 if (g_file_get_contents (sysfs_path, contents, NULL, NULL)) { 164 int flag; 165 166 /* 0x01: POINTER flag 167 * 0x02: DIRECT flag */ 168 flag = atoi(contents); 169 *builtin = (flag 0x02) == 0x02 ? IS_BUILTIN_TRUE : IS_BUILTIN_FALSE; 170 g_free (contents); 171 } 172 g_free (sysfs_path); 173 } So I have been wondering about that flag 0x02used here. /usr/include/linux/input.h has the following: 155 /* 156 * Device properties and quirks 157 */ 158 159 #define INPUT_PROP_POINTER 0x00/* needs a pointer */ 160 #define INPUT_PROP_DIRECT 0x01/* direct input devices */ 161 #define INPUT_PROP_BUTTONPAD0x02/* has button(s) under pad */ 162 #define INPUT_PROP_SEMI_MT 0x03/* touch rectangle only */ 163 164 #define INPUT_PROP_MAX 0x1f 165 #define INPUT_PROP_CNT (INPUT_PROP_MAX + 1) 166 But there INPUT_PROP_DIRECT is 0x01 not 0x02 (0x02 is BUTTONPAD). Is really 0x02 what we want here? And if I am misunderstanding, why not using definitions names rather than cryptic bit flags directly? Cheers, Olivier -- Don't let slow site performance ruin your business. Deploy New Relic APM Deploy New Relic app performance management and know exactly what is happening inside your Ruby, Python, PHP, Java, and .NET app Try New Relic at no cost today and get our sweet Data Nerd shirt too! http://p.sf.net/sfu/newrelic-dev2dev ___ Linuxwacom-devel mailing list Linuxwacom-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel
Re: [Linuxwacom-devel] [PATCH 0/2] add Integrated feature for ISD
On Mon, Oct 08, 2012 at 06:12:41PM +0200, Olivier Fourdan wrote: Hi Bastien, Bastien Nocera said the following on 10/08/2012 06:06 PM: On Mon, 2012-10-08 at 17:39 +0200, Olivier Fourdan wrote: As discussed on linuxwacom-devel mailing list, add a new Integrated feature for integrated system devices to identify eg. Tablet PC. Olivier Fourdan (2): lib: add Integrated feature data: add the Integrated field to ISD definitions Can't we find a better name than this? It means nothing unless you've been working on Wacom tablets for a long while... TabletPC was suggested, or ISD (but I find the later even more cryptic). ISD has the advantage that people don't know what it is, forcing them to look it up (and hopefully it is documented in the function :) I'm worried that TabletPC will get overloaded with other meanings in the future. Cheers, Peter I did not choose TabletPC because I wasn't sure if all integrated device would be TabletPC. But if TabletPC is preferable, I have no problem changing the names to that. Cheers, Olivier. -- Don't let slow site performance ruin your business. Deploy New Relic APM Deploy New Relic app performance management and know exactly what is happening inside your Ruby, Python, PHP, Java, and .NET app Try New Relic at no cost today and get our sweet Data Nerd shirt too! http://p.sf.net/sfu/newrelic-dev2dev ___ Linuxwacom-devel mailing list Linuxwacom-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel -- Don't let slow site performance ruin your business. Deploy New Relic APM Deploy New Relic app performance management and know exactly what is happening inside your Ruby, Python, PHP, Java, and .NET app Try New Relic at no cost today and get our sweet Data Nerd shirt too! http://p.sf.net/sfu/newrelic-dev2dev ___ Linuxwacom-devel mailing list Linuxwacom-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel
Re: [Linuxwacom-devel] [PATCH 1/1] data: DTI 520 is a screen tablet, set BuiltIn to true
On Mon, Oct 08, 2012 at 05:36:06PM +0200, Olivier Fourdan wrote: From 63a1b7bdcbb4c2522a7b0b996b6a3890571154d6 Mon Sep 17 00:00:00 2001 From: Olivier Fourdan ofour...@redhat.com Date: Mon, 8 Oct 2012 15:57:58 +0200 Subject: [PATCH 1/1] data: DTI 520 is a screen tablet, set BuiltIn to true According the tablet definition and pictures of the DTI 520, this is a screen tablet therefore the BuiltIn flag should be true and not false. --- data/dti-520.tablet |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/data/dti-520.tablet b/data/dti-520.tablet index 21e61d5..e2f20d7 100644 --- a/data/dti-520.tablet +++ b/data/dti-520.tablet @@ -33,7 +33,7 @@ Ring2=false NumStrips=0 # Actually 11 buttons but the two Ctrl ones send the same scancode Buttons=10 -BuiltIn=false +BuiltIn=true [Buttons] Top=F;G;H;I;J -- 1.7.1 Reviewed-by: Peter Hutterer peter.hutte...@who-t.net -- Don't let slow site performance ruin your business. Deploy New Relic APM Deploy New Relic app performance management and know exactly what is happening inside your Ruby, Python, PHP, Java, and .NET app Try New Relic at no cost today and get our sweet Data Nerd shirt too! http://p.sf.net/sfu/newrelic-dev2dev ___ Linuxwacom-devel mailing list Linuxwacom-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel
[Linuxwacom-devel] [PATCH 0/2] add IntegratedIn feature for ISD
Bastien Nocera said the following on 10/08/2012 06:24 PM: [...] Looks to me like builtin is tablet is integrated with the display and ISD is tablet is integrated with the computer. I'm sure we could deprecate the _is_builtin() function, and use a bitmask for this support instead? LIBWACOM_DEVICE_INTEGRATED_WITH_NONE = 0, LIBWACOM_DEVICE_INTEGRATED_WITH_DISPLAY = 1 0, LIBWACOM_DEVICE_INTEGRATED_WITH_COMPUTER = 1 2 I am no big fan of integrated with computer either, why limiting us to computer, I would rather see integrated with system (system being a computer, a handhelp device, etc.) Additionally that matches the ISD definition, integrated system device.. I would like to keep things simple (as always) for both the developer and user of the API, and also avoid complicated or convoluted functions names. IMHO we should keep the database format similar enough to the function names accessing it, ie if we deprecate _is_builtin() in the API it should be also replaced in the database. In a nutshell what I a would do instead is: database definition use something like: IntegratedIn=Display;System for a tablet PC and IntegratedIn=Display for a screen tablet such as a Cintiq. This is now set in the Device section as it's not really a feature (but a characteristic of the device). Now for the API: libwacom_is_builtin() is deprecated in favor of the WacomIntegrationFlags One pain point is the BuiltIn replacement, because BuiltIn is also automatically set from the sysfs device/properties (see my other email about the flags in sysfs), so we need an additional flag WACOM_DEVICE_INTEGRATED_UNSET indicating that the database do not provide the information. In that case, Olivier Fourdan (2): lib: add IntegratedIn to device group data: add the IntegratedIn field to the tablet definitions data/bamboo-2fg-4x5.tablet|2 +- data/bamboo-2fg-6x8.tablet|2 +- data/bamboo-2fg.tablet|2 +- data/bamboo-craft.tablet |2 +- data/bamboo-one.tablet|2 +- data/bamboo-pen.tablet|2 +- data/cintiq-12wx.tablet |2 +- data/cintiq-20wsx.tablet |2 +- data/cintiq-21ux.tablet |2 +- data/cintiq-21ux2.tablet |2 +- data/cintiq-22hd.tablet |2 +- data/cintiq-24hd.tablet |2 +- data/dtf-720.tablet |2 +- data/dti-520.tablet |2 +- data/dtu-1631.tablet |2 +- data/dtu-2231.tablet |2 +- data/generic.tablet |1 + data/graphire-wireless-8x6.tablet |1 - data/isdv4-90.tablet |2 +- data/isdv4-93.tablet |2 +- data/isdv4-e3.tablet |2 +- data/isdv4-e6.tablet |2 +- data/isdv4-ed.tablet |2 +- data/isdv4-ef.tablet |2 +- data/n-trig-pen.tablet|2 +- data/serial-wacf004.tablet|2 +- data/wacom.example| 12 +++ libwacom/libwacom-database.c | 56 ++-- libwacom/libwacom.c | 64 ++--- libwacom/libwacom.h | 23 - libwacom/libwacomint.h| 10 +- 31 files changed, 137 insertions(+), 78 deletions(-) -- Don't let slow site performance ruin your business. Deploy New Relic APM Deploy New Relic app performance management and know exactly what is happening inside your Ruby, Python, PHP, Java, and .NET app Try New Relic at no cost today and get our sweet Data Nerd shirt too! http://p.sf.net/sfu/newrelic-dev2dev ___ Linuxwacom-devel mailing list Linuxwacom-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel
[Linuxwacom-devel] [PATCH 1/2] lib: add IntegratedIn to device group
From de46c3bb8351399c3e2ec02e11f93f0ce6403e5f Mon Sep 17 00:00:00 2001 From: Olivier Fourdan ofour...@redhat.com Date: Mon, 8 Oct 2012 16:00:41 +0200 Subject: [PATCH 1/2] lib: add IntegratedIn to device group to describe integrated system devices and screen tablets. A bit field allows to indentify the level of integration of a device: WACOM_DEVICE_INTEGRATED_NONEdevice is a standalone tablet WACOM_DEVICE_INTEGRATED_DISPLAY device is a screen tablet WACOM_DEVICE_INTEGRATED_SYSTEM device is an ISD such as a tablet PC. WACOM_DEVICE_INTEGRATED_UNSET The information is not set in the database These definitions supercede the previous libwacom_is_builtin() API which is now deprecated. --- libwacom/libwacom-database.c | 56 +--- libwacom/libwacom.c | 64 + libwacom/libwacom.h | 23 ++- libwacom/libwacomint.h | 10 +- 4 files changed, 107 insertions(+), 46 deletions(-) diff --git a/libwacom/libwacom-database.c b/libwacom/libwacom-database.c index d39305d..5ef8201 100644 --- a/libwacom/libwacom-database.c +++ b/libwacom/libwacom-database.c @@ -256,6 +256,14 @@ struct { { Touchstrip2, WACOM_STATUS_LED_TOUCHSTRIP2 } }; +struct { + const char *key; + WacomIntegrationFlags value; +} integration_flags[] = { + { Display, WACOM_DEVICE_INTEGRATED_DISPLAY }, + { System, WACOM_DEVICE_INTEGRATED_SYSTEM } +}; + static void libwacom_parse_buttons_key(WacomDevice *device, GKeyFile *keyfile, @@ -327,8 +335,7 @@ libwacom_parse_tablet_keyfile(const char *path) gboolean rc; char *class; char *match; - char **styli_list; - char **leds_list; + char **string_list; keyfile = g_key_file_new(); @@ -359,25 +366,42 @@ libwacom_parse_tablet_keyfile(const char *path) device-width = g_key_file_get_integer(keyfile, DEVICE_GROUP, Width, NULL); device-height = g_key_file_get_integer(keyfile, DEVICE_GROUP, Height, NULL); + device-integration_flags = WACOM_DEVICE_INTEGRATED_UNSET; + string_list = g_key_file_get_string_list(keyfile, DEVICE_GROUP, IntegratedIn, NULL, NULL); + if (string_list) { + guint i, n; + + device-integration_flags = WACOM_DEVICE_INTEGRATED_NONE; + for (i = 0; string_list[i]; i++) { + for (n = 0; n G_N_ELEMENTS (integration_flags); n++) { +if (!strcmp(string_list[i], integration_flags[n].key)) { + device-integration_flags |= integration_flags[n].value; + break; +} + } + } + g_strfreev (string_list); + } + class = g_key_file_get_string(keyfile, DEVICE_GROUP, Class, NULL); device-cls = libwacom_class_string_to_enum(class); g_free(class); - styli_list = g_key_file_get_string_list(keyfile, DEVICE_GROUP, Styli, NULL, NULL); - if (styli_list) { + string_list = g_key_file_get_string_list(keyfile, DEVICE_GROUP, Styli, NULL, NULL); + if (string_list) { GArray *array; guint i; array = g_array_new (FALSE, FALSE, sizeof(int)); device-num_styli = 0; - for (i = 0; styli_list[i]; i++) { - glong long_value = strtol (styli_list[i], NULL, 0); + for (i = 0; string_list[i]; i++) { + glong long_value = strtol (string_list[i], NULL, 0); int int_value = long_value; g_array_append_val (array, int_value); device-num_styli++; } - g_strfreev (styli_list); + g_strfreev (string_list); device-supported_styli = (int *) g_array_free (array, FALSE); } else { device-supported_styli = g_new (int, 2); @@ -399,15 +423,12 @@ libwacom_parse_tablet_keyfile(const char *path) if (g_key_file_get_boolean(keyfile, FEATURES_GROUP, Ring2, NULL)) device-features |= FEATURE_RING2; - if (g_key_file_get_boolean(keyfile, FEATURES_GROUP, BuiltIn, NULL)) - device-features |= FEATURE_BUILTIN; - if (g_key_file_get_boolean(keyfile, FEATURES_GROUP, Reversible, NULL)) device-features |= FEATURE_REVERSIBLE; - if (device-features FEATURE_BUILTIN + if (device-integration_flags WACOM_DEVICE_INTEGRATED_DISPLAY device-features FEATURE_REVERSIBLE) - g_warning (Tablet '%s' is both reversible and builtin. This is impossible, libwacom_get_match(device)); + g_warning (Tablet '%s' is both reversible and integrated in screen. This is impossible, libwacom_get_match(device)); if (!(device-features FEATURE_RING) (device-features FEATURE_RING2)) @@ -425,22 +446,23 @@ libwacom_parse_tablet_keyfile(const char *path) libwacom_parse_buttons(device, keyfile); } - leds_list = g_key_file_get_string_list(keyfile, FEATURES_GROUP, StatusLEDs, NULL, NULL); - if (leds_list) { + string_list = g_key_file_get_string_list(keyfile, FEATURES_GROUP, StatusLEDs, NULL, NULL); + if (string_list) { GArray *array; guint i, n; + array = g_array_new (FALSE, FALSE, sizeof(WacomStatusLEDs)); device-num_leds = 0; - for (i = 0; leds_list[i]; i++) { + for (i = 0; string_list[i]; i++) { for (n = 0; n
[Linuxwacom-devel] [PATCH 2/2] data: add the IntegratedIn field to the tablet definitions
From 360a45826f509efaa76007c145c4d9c26312ea62 Mon Sep 17 00:00:00 2001 From: Olivier Fourdan ofour...@redhat.com Date: Mon, 8 Oct 2012 16:02:39 +0200 Subject: [PATCH 2/2] data: add the IntegratedIn field to the tablet definitions If set, IntegratedIn sp[ecifies if the device is integrated in the Display (screen tablet) and/or the system (ISD, TabletPC). --- data/bamboo-2fg-4x5.tablet|2 +- data/bamboo-2fg-6x8.tablet|2 +- data/bamboo-2fg.tablet|2 +- data/bamboo-craft.tablet |2 +- data/bamboo-one.tablet|2 +- data/bamboo-pen.tablet|2 +- data/cintiq-12wx.tablet |2 +- data/cintiq-20wsx.tablet |2 +- data/cintiq-21ux.tablet |2 +- data/cintiq-21ux2.tablet |2 +- data/cintiq-22hd.tablet |2 +- data/cintiq-24hd.tablet |2 +- data/dtf-720.tablet |2 +- data/dti-520.tablet |2 +- data/dtu-1631.tablet |2 +- data/dtu-2231.tablet |2 +- data/generic.tablet |1 + data/graphire-wireless-8x6.tablet |1 - data/isdv4-90.tablet |2 +- data/isdv4-93.tablet |2 +- data/isdv4-e3.tablet |2 +- data/isdv4-e6.tablet |2 +- data/isdv4-ed.tablet |2 +- data/isdv4-ef.tablet |2 +- data/n-trig-pen.tablet|2 +- data/serial-wacf004.tablet|2 +- data/wacom.example| 12 +--- 27 files changed, 30 insertions(+), 32 deletions(-) diff --git a/data/bamboo-2fg-4x5.tablet b/data/bamboo-2fg-4x5.tablet index 96804bd..a52b249 100644 --- a/data/bamboo-2fg-4x5.tablet +++ b/data/bamboo-2fg-4x5.tablet @@ -14,10 +14,10 @@ DeviceMatch=usb:056a:00d1 Class=Bamboo Width=6 Height=4 +IntegratedIn=None [Features] Stylus=true Reversible=true Touch=true Buttons=4 -BuiltIn=false diff --git a/data/bamboo-2fg-6x8.tablet b/data/bamboo-2fg-6x8.tablet index 0f204ea..c43d59c 100644 --- a/data/bamboo-2fg-6x8.tablet +++ b/data/bamboo-2fg-6x8.tablet @@ -14,10 +14,10 @@ DeviceMatch=usb:056a:00d3 Class=Bamboo Width=9 Height=5 +IntegratedIn=None [Features] Stylus=true Reversible=true Touch=true Buttons=4 -BuiltIn=false diff --git a/data/bamboo-2fg.tablet b/data/bamboo-2fg.tablet index 6037775..d09d0b6 100644 --- a/data/bamboo-2fg.tablet +++ b/data/bamboo-2fg.tablet @@ -13,10 +13,10 @@ DeviceMatch=usb:056a:00d0 Class=Bamboo Width=5 Height=3 +IntegratedIn=None [Features] Stylus=false Reversible=true Touch=true Buttons=4 -BuiltIn=false diff --git a/data/bamboo-craft.tablet b/data/bamboo-craft.tablet index 8dba88c..459920b 100644 --- a/data/bamboo-craft.tablet +++ b/data/bamboo-craft.tablet @@ -14,10 +14,10 @@ DeviceMatch=usb:056a:00d2 Class=Bamboo Width=6 Height=4 +IntegratedIn=None [Features] Stylus=true Reversible=true Touch=true Buttons=4 -BuiltIn=false diff --git a/data/bamboo-one.tablet b/data/bamboo-one.tablet index feacf54..690e95b 100644 --- a/data/bamboo-one.tablet +++ b/data/bamboo-one.tablet @@ -5,6 +5,7 @@ DeviceMatch=usb:056a:0069 Class=Bamboo Width=5 Height=4 +IntegratedIn=None [Features] Reversible=true @@ -13,4 +14,3 @@ Touch=false Ring=false NumStrips=0 Buttons=0 -BuiltIn=false diff --git a/data/bamboo-pen.tablet b/data/bamboo-pen.tablet index a5b5aea..736010c 100644 --- a/data/bamboo-pen.tablet +++ b/data/bamboo-pen.tablet @@ -13,10 +13,10 @@ DeviceMatch=usb:056a:00d4 Class=Bamboo Width=6 Height=4 +IntegratedIn=None [Features] Stylus=true Reversible=true Touch=false Buttons=0 -BuiltIn=false diff --git a/data/cintiq-12wx.tablet b/data/cintiq-12wx.tablet index 4cb4f27..29ee809 100644 --- a/data/cintiq-12wx.tablet +++ b/data/cintiq-12wx.tablet @@ -37,12 +37,12 @@ DeviceMatch=usb:056a:00c6 Width=10 Height=7 Styli=0x913;0x91b;0x813;0x81b;0x823;0x82b;0x801;0x885; +IntegratedIn=Display [Features] Stylus=true NumStrips=2 Buttons=10 -BuiltIn=true [Buttons] Left=A;B;C;D;I diff --git a/data/cintiq-20wsx.tablet b/data/cintiq-20wsx.tablet index 3cc6c23..4bc91d0 100644 --- a/data/cintiq-20wsx.tablet +++ b/data/cintiq-20wsx.tablet @@ -40,13 +40,13 @@ Class=Cintiq Width=17 Height=11 Styli=0x913;0x91b;0x813;0x81b;0x823;0x82b;0x801;0x885; +IntegratedIn=Display [Features] Reversible=false Stylus=true NumStrips=2 Buttons=14 -BuiltIn=true [Buttons] Left=A;B;C;D;I;K;L diff --git a/data/cintiq-21ux.tablet b/data/cintiq-21ux.tablet index 30d3922..1c353a4 100644 --- a/data/cintiq-21ux.tablet +++ b/data/cintiq-21ux.tablet @@ -33,13 +33,13 @@ Class=Cintiq Width=17 Height=13 Styli=0x913;0x91b;0x813;0x81b;0x823;0x82b;0x801;0x885; +IntegratedIn=Display [Features] Reversible=false Stylus=true NumStrips=2 Buttons=8 -BuiltIn=true [Buttons] Left=A;B;C;D diff --git a/data/cintiq-21ux2.tablet b/data/cintiq-21ux2.tablet index 85f2686..734f9f3 100644 ---
Re: [Linuxwacom-devel] [PATCH 0/2] add IntegratedIn feature for ISD
On Tue, 2012-10-09 at 16:23 +0200, Olivier Fourdan wrote: Bastien Nocera said the following on 10/08/2012 06:24 PM: [...] Looks to me like builtin is tablet is integrated with the display and ISD is tablet is integrated with the computer. I'm sure we could deprecate the _is_builtin() function, and use a bitmask for this support instead? LIBWACOM_DEVICE_INTEGRATED_WITH_NONE = 0, LIBWACOM_DEVICE_INTEGRATED_WITH_DISPLAY = 1 0, LIBWACOM_DEVICE_INTEGRATED_WITH_COMPUTER = 1 2 I am no big fan of integrated with computer either, why limiting us to computer, I would rather see integrated with system (system being a computer, a handhelp device, etc.) Additionally that matches the ISD definition, integrated system device.. I would like to keep things simple (as always) for both the developer and user of the API, and also avoid complicated or convoluted functions names. IMHO we should keep the database format similar enough to the function names accessing it, ie if we deprecate _is_builtin() in the API it should be also replaced in the database. In a nutshell what I a would do instead is: database definition use something like: IntegratedIn=Display;System for a tablet PC and IntegratedIn=Display for a screen tablet such as a Cintiq. This is now set in the Device section as it's not really a feature (but a characteristic of the device). Now for the API: libwacom_is_builtin() is deprecated in favor of the WacomIntegrationFlags One pain point is the BuiltIn replacement, because BuiltIn is also automatically set from the sysfs device/properties (see my other email about the flags in sysfs), so we need an additional flag WACOM_DEVICE_INTEGRATED_UNSET indicating that the database do not provide the information. In that case, WACOM_DEVICE_INTEGRATED_UNSET = -1 Then. The compiler will make it an int instead of an unsigned int. -- Don't let slow site performance ruin your business. Deploy New Relic APM Deploy New Relic app performance management and know exactly what is happening inside your Ruby, Python, PHP, Java, and .NET app Try New Relic at no cost today and get our sweet Data Nerd shirt too! http://p.sf.net/sfu/newrelic-dev2dev ___ Linuxwacom-devel mailing list Linuxwacom-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel
Re: [Linuxwacom-devel] [PATCH 0/2] add IntegratedIn feature for ISD
Bastien Nocera said the following on 10/09/2012 05:18 PM: WACOM_DEVICE_INTEGRATED_UNSET = -1 Then. The compiler will make it an int instead of an unsigned int. Humm, nope, not what I want. -1 will have all bits set to 1 if I a not mistaken, so that means all the bits mask will return true, which is not suited. Of course we could test specifically for -1, but using a specific bit for UNSET has an additional benefit imhop, it indicates that the info is not from the database itself. Cheers, Olivier. -- Don't let slow site performance ruin your business. Deploy New Relic APM Deploy New Relic app performance management and know exactly what is happening inside your Ruby, Python, PHP, Java, and .NET app Try New Relic at no cost today and get our sweet Data Nerd shirt too! http://p.sf.net/sfu/newrelic-dev2dev ___ Linuxwacom-devel mailing list Linuxwacom-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel
Re: [Linuxwacom-devel] [PATCH 0/2] add IntegratedIn feature for ISD
On Tue, 2012-10-09 at 17:23 +0200, Olivier Fourdan wrote: Bastien Nocera said the following on 10/09/2012 05:18 PM: WACOM_DEVICE_INTEGRATED_UNSET = -1 Then. The compiler will make it an int instead of an unsigned int. Humm, nope, not what I want. -1 will have all bits set to 1 if I a not mistaken, so that means all the bits mask will return true, which is not suited. Of course we could test specifically for -1, but using a specific bit for UNSET has an additional benefit imhop, it indicates that the info is not from the database itself. Then use 0 for unset, and something else for none... -- Don't let slow site performance ruin your business. Deploy New Relic APM Deploy New Relic app performance management and know exactly what is happening inside your Ruby, Python, PHP, Java, and .NET app Try New Relic at no cost today and get our sweet Data Nerd shirt too! http://p.sf.net/sfu/newrelic-dev2dev ___ Linuxwacom-devel mailing list Linuxwacom-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel
Re: [Linuxwacom-devel] [PATCH 0/2] add IntegratedIn feature for ISD
Bastien Nocera said the following on 10/09/2012 05:37 PM: On Tue, 2012-10-09 at 17:23 +0200, Olivier Fourdan wrote: Bastien Nocera said the following on 10/09/2012 05:18 PM: WACOM_DEVICE_INTEGRATED_UNSET = -1 Then. The compiler will make it an int instead of an unsigned int. Humm, nope, not what I want. -1 will have all bits set to 1 if I a not mistaken, so that means all the bits mask will return true, which is not suited. Of course we could test specifically for -1, but using a specific bit for UNSET has an additional benefit imhop, it indicates that the info is not from the database itself. Then use 0 for unset, and something else for none... What would be the benefit of that? 0 is not a bit, so we loose the additional benefit of being able to tell the info is not from the database (even if that's not a crucial feature, I fail to understand why it needs to be changed). Cheers, Olivier. -- Don't let slow site performance ruin your business. Deploy New Relic APM Deploy New Relic app performance management and know exactly what is happening inside your Ruby, Python, PHP, Java, and .NET app Try New Relic at no cost today and get our sweet Data Nerd shirt too! http://p.sf.net/sfu/newrelic-dev2dev ___ Linuxwacom-devel mailing list Linuxwacom-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel
Re: [Linuxwacom-devel] [PATCH 0/2] add Integrated feature for ISD
On Mon, Oct 8, 2012 at 9:24 AM, Bastien Nocera had...@hadess.net wrote: On Mon, 2012-10-08 at 18:12 +0200, Olivier Fourdan wrote: Hi Bastien, Bastien Nocera said the following on 10/08/2012 06:06 PM: On Mon, 2012-10-08 at 17:39 +0200, Olivier Fourdan wrote: As discussed on linuxwacom-devel mailing list, add a new Integrated feature for integrated system devices to identify eg. Tablet PC. Olivier Fourdan (2): lib: add Integrated feature data: add the Integrated field to ISD definitions Can't we find a better name than this? It means nothing unless you've been working on Wacom tablets for a long while... TabletPC was suggested, or ISD (but I find the later even more cryptic). I did not choose TabletPC because I wasn't sure if all integrated device would be TabletPC. But if TabletPC is preferable, I have no problem changing the names to that. Looks to me like builtin is tablet is integrated with the display and ISD is tablet is integrated with the computer. I agree with Bastien. builtin == tablet is integrated with the display == INPUT_PROP_DIRECT (defined in the kernel) I'm sure we could deprecate the _is_builtin() function, and use a bitmask for this support instead? LIBWACOM_DEVICE_INTEGRATED_WITH_NONE = 0, LIBWACOM_DEVICE_INTEGRATED_WITH_DISPLAY = 1 0, LIBWACOM_DEVICE_INTEGRATED_WITH_COMPUTER = 1 2 I don't care which term/function name we use as long as they are consistent with what defined in the kernel/driver. Plus, they are documented. ;-). Ping -- Don't let slow site performance ruin your business. Deploy New Relic APM Deploy New Relic app performance management and know exactly what is happening inside your Ruby, Python, PHP, Java, and .NET app Try New Relic at no cost today and get our sweet Data Nerd shirt too! http://p.sf.net/sfu/newrelic-dev2dev ___ Linuxwacom-devel mailing list Linuxwacom-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel
Re: [Linuxwacom-devel] [PATCH 0/2] add Integrated feature for ISD
Hi Ping, Ping Cheng said the following on 10/09/2012 07:21 PM: On Mon, Oct 8, 2012 at 9:24 AM, Bastien Nocerahad...@hadess.net wrote: On Mon, 2012-10-08 at 18:12 +0200, Olivier Fourdan wrote: [...] Looks to me like builtin is tablet is integrated with the display and ISD is tablet is integrated with the computer. I agree with Bastien. builtin == tablet is integrated with the display == INPUT_PROP_DIRECT (defined in the kernel) That's the other thread I started, indeed (BuiltIn flag set automatically, but based on what?) INPUT_PROP_DIRECT is defined as 0x01 in linux/input.h and the libwacom code checks for 0x02: linux/input.h: #define INPUT_PROP_DIRECT 0x01/* direct input devices */ in get_device_info() in libwacom/libwacom.c: sysfs_path = g_build_filename (/sys/class/input, devname, device/properties, NULL); if (g_file_get_contents (sysfs_path,contents, NULL, NULL)) { int flag; /* 0x01: POINTER flag * 0x02: DIRECT flag */ flag = atoi(contents); *builtin = (flag 0x02) == 0x02 ? IS_BUILTIN_TRUE : IS_BUILTIN_FALSE; g_free (contents); } Why is that different? 0x02 would be INPUT_PROP_BUTTONPAD according to linux/input.h I'm sure we could deprecate the _is_builtin() function, and use a bitmask for this support instead? LIBWACOM_DEVICE_INTEGRATED_WITH_NONE = 0, LIBWACOM_DEVICE_INTEGRATED_WITH_DISPLAY = 1 0, LIBWACOM_DEVICE_INTEGRATED_WITH_COMPUTER = 1 2 I don't care which term/function name we use as long as they are consistent with what defined in the kernel/driver. Why would that need to match the kernel definitions? Would DIRECT be more explicit than e.g. INTEGRATED_WITH_DISPLAY? And what would be the kernel equivalent of ISD in terms of kernel then? Plus, they are documented. What I found for kernel is: http://permalink.gmane.org/gmane.linux.kernel.input/21661 http://comments.gmane.org/gmane.linux.kernel.input/23241 But there's nothing about ISD (which is what the proposed patches are about actually), so I am not sure I understand the need to follow the kernel naming convention for libwacom. Corollary question, if ISD and screen tablet can be deduced from the device properties in kernel, why do we need to have those in the database? Cheers, Olivier. -- Don't let slow site performance ruin your business. Deploy New Relic APM Deploy New Relic app performance management and know exactly what is happening inside your Ruby, Python, PHP, Java, and .NET app Try New Relic at no cost today and get our sweet Data Nerd shirt too! http://p.sf.net/sfu/newrelic-dev2dev ___ Linuxwacom-devel mailing list Linuxwacom-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel
Re: [Linuxwacom-devel] BuiltIn flag set automatically, but based on what?
On Tue, Oct 9, 2012 at 2:14 AM, Olivier Fourdan ofour...@redhat.com wrote: Hi all, I've been wondering, the BuiltIn flag (discussed earlier) is also set automatically on Linux in get_device_info() in libwacom/libwacom.c: 113 static gboolean 114 get_device_info (const char *path, ... 121 { ... 157 /* Is the device builtin? */ 158 devname = g_udev_device_get_name (device); 159 if (devname != NULL) { 160 char *sysfs_path, *contents; 161 162 sysfs_path = g_build_filename (/sys/class/input, devname, device/properties, NULL); 163 if (g_file_get_contents (sysfs_path, contents, NULL, NULL)) { 164 int flag; 165 166 /* 0x01: POINTER flag 167 * 0x02: DIRECT flag */ 168 flag = atoi(contents); 169 *builtin = (flag 0x02) == 0x02 ? IS_BUILTIN_TRUE : IS_BUILTIN_FALSE; 170 g_free (contents); 171 } 172 g_free (sysfs_path); 173 } So I have been wondering about that flag 0x02used here. /usr/include/linux/input.h has the following: 155 /* 156 * Device properties and quirks 157 */ 158 159 #define INPUT_PROP_POINTER 0x00/* needs a pointer */ 160 #define INPUT_PROP_DIRECT 0x01/* direct input devices */ 161 #define INPUT_PROP_BUTTONPAD0x02/* has button(s) under pad */ 162 #define INPUT_PROP_SEMI_MT 0x03/* touch rectangle only */ 163 164 #define INPUT_PROP_MAX 0x1f 165 #define INPUT_PROP_CNT (INPUT_PROP_MAX + 1) 166 But there INPUT_PROP_DIRECT is 0x01 not 0x02 (0x02 is BUTTONPAD). Is really 0x02 what we want here? And if I am misunderstanding, why not using definitions names rather than cryptic bit flags directly? Cheers, Olivier INPUT_PROP_* aren't bit flags -- they're bit positions. That is, if bit number INPUT_PROP_DIRECT is set, then it's a direct input device. Or, put differently (and grabbing descriptions from event-codes.txt): if (flag (1 INPUT_PROP_POINTER)) { // The INPUT_PROP_POINTER property indicates that the device is not transposed // on the screen and thus requires use of an on-screen pointer to trace user's // movements. Typical pointer devices: touchpads, tablets, mice; non-pointer // device: touchscreen. } if (flag (1 INPUT_PROP_DIRECT)) { // The INPUT_PROP_DIRECT property indicates that device coordinates should be // directly mapped to screen coordinates (not taking into account trivial // transformations, such as scaling, flipping and rotating). Non-direct input // devices require non-trivial transformation, such as absolute to relative // transformation for touchpads. Typical direct input devices: touchscreens, // drawing tablets; non-direct devices: touchpads, mice. } Note that INPUT_PROP_DIRECT is specified to be set for both touchscreens (e.g. Cintiq, tablet PC) *and* for drawing tablets (e.g. Intuos, Bamboo). To properly ensure that you're getting a touchscreen, you need to make sure that its DIRECT and non-POINTER. Because of this, the libwacom code technically isn't correct; the only reason it doesn't think an Intuos is built-in is because the guidelines weren't clear when my kernel patches were accepted and so they don't have the DIRECT flag set. To be correct and use the defines instead of hex codes, it should probably be written more like: int hw_flags = atoi(contents); int direct_flag = (1 INPUT_PROP_DIRECT); int pointer_flag = (1 INPUT_PROP_POINTER); *builtin = (hw_flags (direct_flag | pointer_flag) == direct_flag) ? IS_BUILTIN_TRUE : IS_BUILTIN_FALSE; Jason --- When you're rife with devastation / There's a simple explanation: You're a toymaker's creation / Trapped inside a crystal ball. And whichever way he tilts it / Know that we must be resilient We won't let them break our spirits / As we sing our silly song. -- Don't let slow site performance ruin your business. Deploy New Relic APM Deploy New Relic app performance management and know exactly what is happening inside your Ruby, Python, PHP, Java, and .NET app Try New Relic at no cost today and get our sweet Data Nerd shirt too! http://p.sf.net/sfu/newrelic-dev2dev ___ Linuxwacom-devel mailing list Linuxwacom-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel
Re: [Linuxwacom-devel] [PATCH 0/2] add Integrated feature for ISD
On Tue, Oct 9, 2012 at 11:32 AM, Olivier Fourdan ofour...@redhat.com wrote: Hi Ping, Ping Cheng said the following on 10/09/2012 07:21 PM: On Mon, Oct 8, 2012 at 9:24 AM, Bastien Nocerahad...@hadess.net wrote: On Mon, 2012-10-08 at 18:12 +0200, Olivier Fourdan wrote: [...] Looks to me like builtin is tablet is integrated with the display and ISD is tablet is integrated with the computer. I agree with Bastien. builtin == tablet is integrated with the display == INPUT_PROP_DIRECT (defined in the kernel) That's the other thread I started, indeed (BuiltIn flag set automatically, but based on what?) INPUT_PROP_DIRECT is defined as 0x01 in linux/input.h and the libwacom code checks for 0x02: linux/input.h: #define INPUT_PROP_DIRECT 0x01/* direct input devices */ in get_device_info() in libwacom/libwacom.c: sysfs_path = g_build_filename (/sys/class/input, devname, device/properties, NULL); if (g_file_get_contents (sysfs_path,contents, NULL, NULL)) { int flag; /* 0x01: POINTER flag * 0x02: DIRECT flag */ flag = atoi(contents); *builtin = (flag 0x02) == 0x02 ? IS_BUILTIN_TRUE : IS_BUILTIN_FALSE; g_free (contents); } Why is that different? 0x02 would be INPUT_PROP_BUTTONPAD according to linux/input.h I'm sure we could deprecate the _is_builtin() function, and use a bitmask for this support instead? LIBWACOM_DEVICE_INTEGRATED_WITH_NONE = 0, LIBWACOM_DEVICE_INTEGRATED_WITH_DISPLAY = 1 0, LIBWACOM_DEVICE_INTEGRATED_WITH_COMPUTER = 1 2 I don't care which term/function name we use as long as they are consistent with what defined in the kernel/driver. Why would that need to match the kernel definitions? Would DIRECT be more explicit than e.g. INTEGRATED_WITH_DISPLAY? And what would be the kernel equivalent of ISD in terms of kernel then? Plus, they are documented. What I found for kernel is: http://permalink.gmane.org/gmane.linux.kernel.input/21661 http://comments.gmane.org/gmane.linux.kernel.input/23241 The kernel's definitions aren't what we want anyway. DIRECT essentially means treat my coordinates as absolute and POINTER means there is no physical object above the screen which can act as a pointer. As Jeff points out in the first link, it'd be nicer if they actually meant I am built into a screen and you should display an on-screen pointer since that's what most drivers and utilities care about. But there's nothing about ISD (which is what the proposed patches are about actually), so I am not sure I understand the need to follow the kernel naming convention for libwacom. There's no way to get ISD status from the kernel, AFAIK. You can try to do things heuristically, but you probably won't have much luck. A serial connection almost certainly means ISD, unless you're using the third-party serial Intuos kernel driver. A USB connection almost certianly means non-ISD, unless you're using one of a very few tablet PCs with a USB digitizer. Corollary question, if ISD and screen tablet can be deduced from the device properties in kernel, why do we need to have those in the database? The screen tablet property was added to the database before the logic to read it from the kernel was in place. Its mostly vestigial now (and should be correctly detected if left unspecified) but I wouldn't nuke support for it just in case. Jason --- When you're rife with devastation / There's a simple explanation: You're a toymaker's creation / Trapped inside a crystal ball. And whichever way he tilts it / Know that we must be resilient We won't let them break our spirits / As we sing our silly song. Cheers, Olivier. -- Don't let slow site performance ruin your business. Deploy New Relic APM Deploy New Relic app performance management and know exactly what is happening inside your Ruby, Python, PHP, Java, and .NET app Try New Relic at no cost today and get our sweet Data Nerd shirt too! http://p.sf.net/sfu/newrelic-dev2dev ___ Linuxwacom-devel mailing list Linuxwacom-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel
Re: [Linuxwacom-devel] [PATCH 0/2] add Integrated feature for ISD
On Tue, Oct 9, 2012 at 11:32 AM, Olivier Fourdan ofour...@redhat.com wrote: Ping Cheng said the following on 10/09/2012 07:21 PM: builtin == tablet is integrated with the display == INPUT_PROP_DIRECT (defined in the kernel) That's the other thread I started, indeed (BuiltIn flag set automatically, but based on what?) I replied before I read through the message. You have a valid point. Why is that different? 0x02 would be INPUT_PROP_BUTTONPAD according to linux/input.h Why would that need to match the kernel definitions? Would DIRECT be more explicit than e.g. INTEGRATED_WITH_DISPLAY? And what would be the kernel equivalent of ISD in terms of kernel then? As Jason pointed out, kernel INPUT_PROP_* is not enough to resolve our integrated/DISPLAY/SYSTEM issue. We need to update the code for it. And extra information is needed. What I found for kernel is: http://permalink.gmane.org/gmane.linux.kernel.input/21661 http://comments.gmane.org/gmane.linux.kernel.input/23241 But there's nothing about ISD (which is what the proposed patches are about actually), so I am not sure I understand the need to follow the kernel naming convention for libwacom. Corollary question, if ISD and screen tablet can be deduced from the device properties in kernel, why do we need to have those in the database? Obviously there was a reason to have it in the database. We just forgot the reason ;). Ping -- Don't let slow site performance ruin your business. Deploy New Relic APM Deploy New Relic app performance management and know exactly what is happening inside your Ruby, Python, PHP, Java, and .NET app Try New Relic at no cost today and get our sweet Data Nerd shirt too! http://p.sf.net/sfu/newrelic-dev2dev ___ Linuxwacom-devel mailing list Linuxwacom-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel