added --print-usb-usermap command

git-svn-id: https://svn.code.sf.net/p/gphoto/code/trunk/libgphoto2@2556 67ed7778-7388-44ab-90cf-0a291f65f57c
This commit is contained in:
Hans Ulrich Niedermann
2001-10-16 17:54:07 +00:00
parent d4a8360fb2
commit dd0c9fb0fc
3 changed files with 49 additions and 3 deletions

View File

@@ -1,3 +1,9 @@
2001-10-16 Hans Ulrich Niedermann <gp@n-dimensional.de>
* frontends/command-line/main.c: added package and version to debug msgs
* frontends/command-line/main.c: added --print-usb-usermap command
* frontends/command-line/main.h: added definition name of hotplug script
2001-10-16 Lutz Müller <urc8@rz.uni-karlsruhe.de>
* frontends/command-line/main.c: Use gp_camera_set_abilities.

View File

@@ -66,6 +66,7 @@ OPTION_CALLBACK(help);
OPTION_CALLBACK(version);
OPTION_CALLBACK(shell);
OPTION_CALLBACK(list_cameras);
OPTION_CALLBACK(print_usb_usermap);
OPTION_CALLBACK(auto_detect);
OPTION_CALLBACK(list_ports);
OPTION_CALLBACK(filename);
@@ -116,6 +117,7 @@ Option option[] = {
{"v", "version", "", "Display version and exit", version, 0},
{"h", "help", "", "Displays this help screen", help, 0},
{"", "list-cameras", "", "List supported camera models", list_cameras, 0},
{"", "print-usb-usermap", "", "Create output for usb.usermap", print_usb_usermap, 0},
{"", "list-ports", "", "List supported port devices", list_ports, 0},
{"", "stdout", "", "Send file to stdout", use_stdout, 0},
{"", "stdout-size", "", "Print filesize before data", use_stdout_size,0},
@@ -344,6 +346,42 @@ OPTION_CALLBACK(list_cameras) {
return (GP_OK);
}
/* print_usb_usermap
*
* Print out lines that can be included into usb.usermap
* - for all cams supported by our instance of libgphoto2.
*
* written after list_cameras
*/
OPTION_CALLBACK(print_usb_usermap) {
int x, n;
const char *buf;
CameraAbilities abilities;
cli_debug_print("Listing Cameras");
CHECK_RESULT (n = gp_camera_count ());
for (x = 0; x < n; x++) {
CHECK_RESULT (gp_camera_name (x, &buf));
CHECK_RESULT (gp_camera_abilities (x, &abilities));
if ((abilities.usb_vendor != 0) && (abilities.usb_product != 0)) {
/* FIXME: could there be a usb_vendor or usb_product of 0? */
printf(GP_USB_HOTPLUG_SCRIPT " "
"0x0000 0x%04x 0x%04x 0x0000 "
"0x0000 0x00 0x00 "
"0x00 0x00 0x00 "
"0x00 0x00000000\n",
abilities.usb_vendor, abilities.usb_product);
}
}
return (GP_OK);
}
OPTION_CALLBACK(list_ports)
{
gp_port_info info;
@@ -404,12 +442,12 @@ OPTION_CALLBACK(model)
OPTION_CALLBACK (debug)
{
glob_debug = GP_DEBUG_HIGH;
cli_debug_print("Turning on debug mode");
glob_debug = GP_DEBUG_HIGH;
cli_debug_print(PACKAGE " " VERSION ": " "Turning on debug mode");
gp_debug_set_level (GP_DEBUG_HIGH);
return (GP_OK);
return (GP_OK);
}
OPTION_CALLBACK(quiet)

View File

@@ -7,6 +7,8 @@
#define LONG_OPTION "--"
#define MAX_IMAGE_NUMBER 1024
#define GP_USB_HOTPLUG_SCRIPT "usbcam"
#ifdef WIN32
#include <io.h>
#define VERSION "2"