From 587c25825c6d3e4867f84f7530dc242ff4ecae0a Mon Sep 17 00:00:00 2001 From: Julien BLACHE Date: Mon, 3 Jul 2006 17:51:32 +0000 Subject: [PATCH] sane-desc.c: Fix a typo in the udev header. --- ChangeLog | 3 ++ tools/sane-desc.c | 84 +++++++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 84 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index c38723cf8..70a9adf54 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,6 @@ +2006-07-03 Julien Blache + * tools/sane-desc.c: Fix a typo in the udev header. + 2006-07-03 Henning Meier-Geinitz * configure configure.in: Changed version to 1.0.18-cvs. Enabled diff --git a/tools/sane-desc.c b/tools/sane-desc.c index a02ac9f44..beff29e8c 100644 --- a/tools/sane-desc.c +++ b/tools/sane-desc.c @@ -76,7 +76,8 @@ typedef enum output_mode output_mode_usermap, output_mode_db, output_mode_udev, - output_mode_plist + output_mode_plist, + output_mode_clist } output_mode; @@ -292,7 +293,7 @@ print_usage (char *program_name) "(multiple directories can be concatenated by \":\")\n"); printf (" -m|--mode mode " "Output mode (ascii, html-backends-split, html-mfgs,\n" - " xml, statistics, usermap, db, udev, plist)\n"); + " xml, statistics, usermap, db, udev, plist, clist)\n"); printf (" -t|--title \"title\" The title used for HTML pages\n"); printf (" -i|--intro \"intro\" A short description of the " "contents of the page\n"); @@ -394,6 +395,11 @@ get_options (int argc, char **argv) DBG_INFO ("Output mode: %s\n", optarg); mode = output_mode_plist; } + else if (strcmp (optarg, "clist") == 0) + { + DBG_INFO ("Output mode: %s\n", optarg); + mode = output_mode_clist; + } else { DBG_ERR ("Unknown output mode: %s\n", optarg); @@ -3156,7 +3162,7 @@ print_udev_header (void) "# To add a USB device, add a rule to the list below between the SUBSYSTEM...\n" "# and LABEL... lines.\n" "#\n" - "# To run a script when your device is plugged in, add RUN=\"/path/to/script\"\n" + "# To run a script when your device is plugged in, add RUN+=\"/path/to/script\"\n" "# to the appropriate rule.\n"); printf ("#\n" @@ -3227,6 +3233,75 @@ print_plist (void) printf ("\n"); } +static void +print_clist (void) +{ + backend_entry *be = first_backend; + + static const char *status_string[] = { + "*unknown*", + "unsupported", + "untested", + "minimal", + "basic", + "good", + "complete" + }; + + printf("struct usb_scanner {\n"); + printf(" unsigned short vid;\n"); + printf(" unsigned short pid;\n"); + printf(" char *be;\n"); + printf(" char *status;\n"); + printf(" char *model;\n"); + printf("};\n"); + printf("\n"); + printf("struct usb_scanner supported_usb_scanners[] = {\n"); + + while (be) + { + type_entry *type = be->type; + + while (type) + { + mfg_entry *mfg = type->mfg; + model_entry *model; + + if (!mfg) + { + type = type->next; + continue; + } + + mfg = type->mfg; + while (mfg) + { + model = mfg->model; + if (model) + { + while (model) + { + if (model->usb_vendor_id && model->usb_product_id) + { + printf(" { %s, %s, \"%s\", \"%s\", \"%s %s\" },\n", + model->usb_vendor_id, model->usb_product_id, be->name, + status_string[model->status], mfg->name, model->name); + } + model = model->next; + } /* while (model) */ + } /* if (model) */ + mfg = mfg->next; + } /* while (mfg) */ + type = type->next; + } /* while (type) */ + be = be->next; + } /* while (be) */ + + printf(" { 0, 0, NULL, NULL, NULL }\n"); + printf("};\n"); +} + + int main (int argc, char **argv) { @@ -3269,6 +3344,9 @@ main (int argc, char **argv) case output_mode_plist: print_plist (); break; + case output_mode_clist: + print_clist (); + break; default: DBG_ERR ("Unknown output mode\n"); return 1;