From e69c401eb0daf76b1ee524d8d92b005a463f9cd0 Mon Sep 17 00:00:00 2001 From: Marcus Meissner Date: Sat, 14 Jan 2006 15:01:45 +0000 Subject: [PATCH] added "idlist" mode to print "vendor:product name" git-svn-id: https://svn.code.sf.net/p/gphoto/code/trunk/libgphoto2@8488 67ed7778-7388-44ab-90cf-0a291f65f57c --- packaging/generic/print-camera-list.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/packaging/generic/print-camera-list.c b/packaging/generic/print-camera-list.c index d8d7730dd..66d84ce49 100644 --- a/packaging/generic/print-camera-list.c +++ b/packaging/generic/print-camera-list.c @@ -246,6 +246,21 @@ human_camera_func (const func_params_t *params, } +static int +idlist_camera_func (const func_params_t *params, + const int i, + const CameraAbilities *a) +{ + if (a->usb_vendor) { /* usb product id may be zero! */ + printf("%04x:%04x %s\n", + a->usb_vendor, + a->usb_product, + a->model); + } + return 0; +} + + static int udev_begin_func (const func_params_t *params) { @@ -536,6 +551,14 @@ static const output_format_t formats[] = { camera_func: udev_camera_func, end_func: udev_end_func }, + {name: "idlist", + descr: "list of IDs and names", + help: "grep for an ID to find the device name", + paramdescr: NULL, + begin_func: empty_begin_func, + camera_func: idlist_camera_func, + end_func: empty_end_func + }, {NULL, NULL, NULL, NULL, NULL, NULL, NULL} };