fprint-list: Add SPI devices to supported list
This will make them show up on the website.
This commit is contained in:
parent
dbd89929b9
commit
145f7287fa
1 changed files with 76 additions and 23 deletions
|
@ -28,8 +28,8 @@
|
||||||
|
|
||||||
GHashTable *printed = NULL;
|
GHashTable *printed = NULL;
|
||||||
|
|
||||||
static GList *
|
static void
|
||||||
insert_drivers (GList *list)
|
insert_drivers (GList **usb_list, GList **spi_list)
|
||||||
{
|
{
|
||||||
g_autoptr(GArray) drivers = fpi_get_driver_types ();
|
g_autoptr(GArray) drivers = fpi_get_driver_types ();
|
||||||
gint i;
|
gint i;
|
||||||
|
@ -41,8 +41,9 @@ insert_drivers (GList *list)
|
||||||
g_autoptr(FpDeviceClass) cls = g_type_class_ref (driver);
|
g_autoptr(FpDeviceClass) cls = g_type_class_ref (driver);
|
||||||
const FpIdEntry *entry;
|
const FpIdEntry *entry;
|
||||||
|
|
||||||
if (cls->type != FP_DEVICE_TYPE_USB)
|
switch (cls->type)
|
||||||
continue;
|
{
|
||||||
|
case FP_DEVICE_TYPE_USB:
|
||||||
|
|
||||||
for (entry = cls->id_table; entry->vid; entry++)
|
for (entry = cls->id_table; entry->vid; entry++)
|
||||||
{
|
{
|
||||||
|
@ -58,17 +59,52 @@ insert_drivers (GList *list)
|
||||||
|
|
||||||
g_hash_table_insert (printed, key, GINT_TO_POINTER (1));
|
g_hash_table_insert (printed, key, GINT_TO_POINTER (1));
|
||||||
|
|
||||||
list = g_list_prepend (list, g_strdup_printf ("%s | %s\n", key, cls->full_name));
|
*usb_list = g_list_prepend (*usb_list,
|
||||||
|
g_strdup_printf ("%s | %s\n", key, cls->full_name));
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case FP_DEVICE_TYPE_UDEV:
|
||||||
|
for (entry = cls->id_table; entry->udev_types; entry++)
|
||||||
|
{
|
||||||
|
char *key;
|
||||||
|
|
||||||
|
/* Need SPI device */
|
||||||
|
if ((entry->udev_types & FPI_DEVICE_UDEV_SUBTYPE_SPIDEV) == 0)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
key = g_strdup_printf ("SPI:%s:%04x:%04x", entry->spi_acpi_id, entry->hid_id.vid, entry->hid_id.pid);
|
||||||
|
|
||||||
|
if (g_hash_table_lookup (printed, key) != NULL)
|
||||||
|
{
|
||||||
|
g_free (key);
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
return list;
|
g_hash_table_insert (printed, key, GINT_TO_POINTER (1));
|
||||||
|
|
||||||
|
if (entry->udev_types & FPI_DEVICE_UDEV_SUBTYPE_HIDRAW)
|
||||||
|
*spi_list = g_list_prepend (*spi_list,
|
||||||
|
g_strdup_printf ("%s | %04x:%04x | %s\n", entry->spi_acpi_id, entry->hid_id.vid, entry->hid_id.pid, cls->full_name));
|
||||||
|
else
|
||||||
|
*spi_list = g_list_prepend (*spi_list,
|
||||||
|
g_strdup_printf ("%s | - | %s\n", entry->spi_acpi_id, cls->full_name));
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case FP_DEVICE_TYPE_VIRTUAL:
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
main (int argc, char **argv)
|
main (int argc, char **argv)
|
||||||
{
|
{
|
||||||
GList *list, *l;
|
GList *usb_list = NULL;
|
||||||
|
GList *spi_list = NULL;
|
||||||
|
GList *l;
|
||||||
|
|
||||||
setlocale (LC_ALL, "");
|
setlocale (LC_ALL, "");
|
||||||
|
|
||||||
|
@ -83,19 +119,36 @@ main (int argc, char **argv)
|
||||||
g_print ("\n");
|
g_print ("\n");
|
||||||
g_print ("This is a list of supported devices in libfprint's development version. Those drivers might not all be available in the stable, released version. If in doubt, contact your distribution or systems integrator for details.\n");
|
g_print ("This is a list of supported devices in libfprint's development version. Those drivers might not all be available in the stable, released version. If in doubt, contact your distribution or systems integrator for details.\n");
|
||||||
g_print ("\n");
|
g_print ("\n");
|
||||||
|
|
||||||
|
insert_drivers (&usb_list, &spi_list);
|
||||||
|
|
||||||
g_print ("## USB devices\n");
|
g_print ("## USB devices\n");
|
||||||
g_print ("\n");
|
g_print ("\n");
|
||||||
g_print ("USB ID | Driver\n");
|
g_print ("USB ID | Driver\n");
|
||||||
g_print ("------------ | ------------\n");
|
g_print ("------------ | ------------\n");
|
||||||
|
|
||||||
list = NULL;
|
usb_list = g_list_sort (usb_list, (GCompareFunc) g_strcmp0);
|
||||||
list = insert_drivers (list);
|
for (l = usb_list; l != NULL; l = l->next)
|
||||||
|
|
||||||
list = g_list_sort (list, (GCompareFunc) g_strcmp0);
|
|
||||||
for (l = list; l != NULL; l = l->next)
|
|
||||||
g_print ("%s", (char *) l->data);
|
g_print ("%s", (char *) l->data);
|
||||||
|
g_print ("\n");
|
||||||
|
|
||||||
|
g_list_free_full (usb_list, g_free);
|
||||||
|
|
||||||
|
g_print ("## SPI devices\n");
|
||||||
|
g_print ("\n");
|
||||||
|
g_print ("The ACPI ID represents the SPI interface. Some sensors are also connected to a HID device (Human Input Device) for side-channel requests such as resets.\n");
|
||||||
|
g_print ("\n");
|
||||||
|
g_print ("ACPI ID | HID ID | Driver\n");
|
||||||
|
g_print ("------------ | ------------ | ------------\n");
|
||||||
|
|
||||||
|
spi_list = g_list_sort (spi_list, (GCompareFunc) g_strcmp0);
|
||||||
|
for (l = spi_list; l != NULL; l = l->next)
|
||||||
|
g_print ("%s", (char *) l->data);
|
||||||
|
g_print ("\n");
|
||||||
|
|
||||||
|
g_list_free_full (usb_list, g_free);
|
||||||
|
|
||||||
|
|
||||||
g_list_free_full (list, g_free);
|
|
||||||
g_hash_table_destroy (printed);
|
g_hash_table_destroy (printed);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
Loading…
Reference in a new issue