udev: add ALPS firmware detection and size properties

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
This commit is contained in:
Peter Hutterer 2015-06-30 13:00:10 +10:00
parent b06a1be013
commit a74dcf965a
2 changed files with 30 additions and 0 deletions

View file

@ -22,6 +22,10 @@ libinput:name:*AlpsPS/2 ALPS DualPoint TouchPad:dmi:*
libinput:name:*AlpsPS/2 ALPS GlidePoint:dmi:*
LIBINPUT_MODEL_ALPS_TOUCHPAD=1
libinput:name:*AlpsPS/2 ALPS DualPoint TouchPad:fwversion:8
libinput:name:*AlpsPS/2 ALPS GlidePoint:fwversion:8
LIBINPUT_ATTR_SIZE_HINT=100x55
##########################################
# Apple
##########################################

View file

@ -50,9 +50,35 @@ prop_value(struct udev_device *device,
return prop_value;
}
static void
handle_touchpad_alps(struct udev_device *device)
{
const char *product;
int bus, vid, pid, version;
product = prop_value(device, "PRODUCT");
if (!product)
return;
if (sscanf(product, "%x/%x/%x/%x", &bus, &vid, &pid, &version) != 4)
return;
/* ALPS' firmware version is the PID */
if (pid)
printf("LIBINPUT_MODEL_FIRMWARE_VERSION=%d\n", pid);
}
static void
handle_touchpad(struct udev_device *device)
{
const char *name = NULL;
name = prop_value(device, "NAME");
if (!name)
return;
if (strstr(name, "AlpsPS/2 ALPS") != NULL)
handle_touchpad_alps(device);
}
int main(int argc, char **argv)