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_BUTTONPAD            0x02    /* 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

Reply via email to