kopia lustrzana https://gitlab.com/sane-project/backends
Group USB devices by vendor in the HAL FDI output.
rodzic
59f6298630
commit
4cb1d28a35
|
@ -1,6 +1,7 @@
|
||||||
2009-01-13 Julien Blache <jb@jblache.org>
|
2009-01-13 Julien Blache <jb@jblache.org>
|
||||||
* tools/sane-desc.c: replace opencoded device permissions and
|
* tools/sane-desc.c: replace opencoded device permissions and
|
||||||
ownership by proper definitions.
|
ownership by proper definitions. Group USB devices by vendor in
|
||||||
|
the HAL FDI output.
|
||||||
All of the above based on a patch contributed by Dieter Jurzitza.
|
All of the above based on a patch contributed by Dieter Jurzitza.
|
||||||
|
|
||||||
2009-01-10 m. allan noah <kitno455 a t gmail d o t com>
|
2009-01-10 m. allan noah <kitno455 a t gmail d o t com>
|
||||||
|
|
|
@ -3285,40 +3285,66 @@ static void
|
||||||
print_hal (int new)
|
print_hal (int new)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
SANE_Bool in_match;
|
||||||
|
char *last_vendor;
|
||||||
usbid_type *usbid = create_usbids_table ();
|
usbid_type *usbid = create_usbids_table ();
|
||||||
|
|
||||||
printf ("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
|
printf ("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
|
||||||
printf ("<deviceinfo version=\"0.2\">\n");
|
printf ("<deviceinfo version=\"0.2\">\n");
|
||||||
printf (" <device>\n");
|
printf (" <device>\n");
|
||||||
|
|
||||||
if (new)
|
if (new)
|
||||||
printf (" <match key=\"info.subsystem\" string=\"usb\">\n");
|
printf (" <match key=\"info.subsystem\" string=\"usb\">\n");
|
||||||
else
|
else
|
||||||
printf (" <match key=\"info.bus\" string=\"usb\">\n");
|
printf (" <match key=\"info.bus\" string=\"usb\">\n");
|
||||||
|
|
||||||
|
last_vendor = "";
|
||||||
|
in_match = SANE_FALSE;
|
||||||
while (usbid)
|
while (usbid)
|
||||||
{
|
{
|
||||||
manufacturer_model_type * name = usbid->name;
|
manufacturer_model_type * name = usbid->name;
|
||||||
|
|
||||||
|
if (strcmp(last_vendor, usbid->usb_vendor_id) != 0)
|
||||||
|
{
|
||||||
|
if (in_match)
|
||||||
|
printf (" </match>\n");
|
||||||
|
|
||||||
|
printf (" <match key=\"usb.vendor_id\" int=\"%s\">\n", usbid->usb_vendor_id);
|
||||||
|
last_vendor = usbid->usb_vendor_id;
|
||||||
|
in_match = SANE_TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
i = 0;
|
i = 0;
|
||||||
printf (" <!-- ");
|
printf (" <!-- ");
|
||||||
while (name)
|
while (name)
|
||||||
{
|
{
|
||||||
if ((name != usbid->name) && (i > 0))
|
if ((name != usbid->name) && (i > 0))
|
||||||
printf (" | ");
|
printf (" | ");
|
||||||
|
|
||||||
printf ("%s", name->name);
|
printf ("%s", name->name);
|
||||||
name = name->next;
|
name = name->next;
|
||||||
i++;
|
i++;
|
||||||
|
|
||||||
|
if ((i == 3) && (name != NULL))
|
||||||
|
{
|
||||||
|
printf("\n ");
|
||||||
|
i = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
printf (" -->\n");
|
printf (" -->\n");
|
||||||
printf (" <match key=\"usb.vendor_id\" int=\"%s\">\n", usbid->usb_vendor_id);
|
|
||||||
printf (" <match key=\"usb.product_id\" int=\"%s\">\n", usbid->usb_product_id);
|
printf (" <match key=\"usb.product_id\" int=\"%s\">\n", usbid->usb_product_id);
|
||||||
printf (" <append key=\"info.capabilities\" type=\"strlist\">scanner</append>\n");
|
printf (" <append key=\"info.capabilities\" type=\"strlist\">scanner</append>\n");
|
||||||
printf (" <merge key=\"scanner.access_method\" type=\"string\">proprietary</merge>\n");
|
printf (" <merge key=\"scanner.access_method\" type=\"string\">proprietary</merge>\n");
|
||||||
printf (" </match>\n");
|
printf (" </match>\n");
|
||||||
printf (" </match>\n");
|
|
||||||
usbid = usbid->next;
|
usbid = usbid->next;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (in_match)
|
||||||
|
printf (" </match>\n");
|
||||||
|
|
||||||
printf (" </match>\n");
|
printf (" </match>\n");
|
||||||
|
|
||||||
printf (" </device>\n");
|
printf (" </device>\n");
|
||||||
printf ("</deviceinfo>\n");
|
printf ("</deviceinfo>\n");
|
||||||
}
|
}
|
||||||
|
|
Ładowanie…
Reference in New Issue