changed abilities.(serial, parallel, usb, ...) to just ORing of abilities.port

git-svn-id: https://svn.code.sf.net/p/gphoto/code/trunk/libgphoto2@729 67ed7778-7388-44ab-90cf-0a291f65f57c
This commit is contained in:
Scott Fritzinger
2000-07-20 01:59:23 +00:00
parent cceb770106
commit 8c4bb2b605
8 changed files with 47 additions and 59 deletions

View File

@@ -265,11 +265,7 @@ int camera_abilities (CameraAbilities *abilities, int *count) {
/* What models do we support? */
strcpy(abilities[0].model, "Barbie Camera");
abilities[0].serial = 1;
abilities[0].parallel = 1;
abilities[0].usb = 0;
abilities[0].ieee1394 = 0;
abilities[0].port = GP_PORT_SERIAL;
abilities[0].speed[0] = 57600;
abilities[0].speed[1] = 0;

View File

@@ -37,11 +37,7 @@ int camera_abilities (CameraAbilities *abilities, int *count) {
*count = 1;
strcpy(abilities[0].model, "Directory Browse");
abilities[0].serial = 0;
abilities[0].parallel = 0;
abilities[0].usb = 0;
abilities[0].ieee1394 = 0;
abilities[0].port = GP_PORT_NONE;
abilities[0].speed[0] = 0;
abilities[0].capture = 0;

View File

@@ -98,11 +98,7 @@ int camera_abilities (CameraAbilities *abilities, int *count) {
/* Fill in a template */
strcpy(a.model, "");
a.serial = 1;
a.parallel = 0;
a.usb = 0;
a.ieee1394 = 0;
a.network = 0;
a.port = GP_PORT_SERIAL;
a.speed[0] = 9600;
a.speed[1] = 19200;
a.speed[2] = 38400;

View File

@@ -149,10 +149,7 @@ int camera_abilities (CameraAbilities *abilities, int *count)
int x = 0;
CameraAbilities a;
a.serial = 1;
a.parallel = 0;
a.usb = 0;
a.ieee1394 = 0;
a.port = GP_PORT_SERIAL;
a.speed[0] = 300;
a.speed[1] = 600;
a.speed[2] = 1200;
@@ -641,4 +638,3 @@ int camera_config_set (CameraSetting *conf, int count)
return (GP_ERROR);
}

View File

@@ -365,10 +365,7 @@ int camera_abilities (CameraAbilities *abilities, int *count) {
if a camera supported multiple ways. */
strcpy(abilities[0].model, "Panasonic DC1580");
abilities[0].serial = 1;
abilities[0].parallel = 0;
abilities[0].usb = 0;
abilities[0].ieee1394 = 0;
abilities[0].port = GP_PORT_SERIAL;
abilities[0].speed[0] = 9600;
abilities[0].speed[1] = 19200;
abilities[0].speed[2] = 38400;

View File

@@ -185,33 +185,35 @@ OPTION_CALLBACK(abilities) {
/* Output a parsing friendly abilities table. Split on ":" */
printf("Abilities for camera: : %s\n",
printf("Abilities for camera: : %s\n",
glob_abilities.model);
printf("Serial port support : %s\n",
glob_abilities.serial == 0? "no":"yes");
printf("Parallel port support : %s\n",
glob_abilities.parallel == 0? "no":"yes");
printf("USB support : %s\n",
glob_abilities.usb == 0? "no":"yes");
printf("IEEE1394 support : %s\n",
glob_abilities.ieee1394 == 0? "no":"yes");
printf("Serial port support : %s\n",
SERIAL_SUPPORTED(glob_abilities.port)? "yes":"no");
printf("Parallel port support : %s\n",
PARALLEL_SUPPORTED(glob_abilities.port)? "yes":"no");
printf("USB support : %s\n",
USB_SUPPORTED(glob_abilities.port)? "yes":"no");
printf("IEEE1394 support : %s\n",
IEEE1394_SUPPORTED(glob_abilities.port)? "yes":"no");
printf("Network support : %s\n",
NETWORK_SUPPORTED(glob_abilities.port)? "yes":"no");
if (glob_abilities.speed[0] != 0) {
printf("Transfer speeds supported :\n");
printf("Transfer speeds supported :\n");
do {
printf(" : %i\n", glob_abilities.speed[x]);
printf(" : %i\n", glob_abilities.speed[x]);
x++;
} while (glob_abilities.speed[x]!=0);
}
printf("Capture from computer support : %s\n",
printf("Capture from computer support : %s\n",
glob_abilities.capture == 0? "no":"yes");
printf("Configuration support : %s\n",
printf("Configuration support : %s\n",
glob_abilities.config == 0? "no":"yes");
printf("Delete files on camera support : %s\n",
printf("Delete files on camera support : %s\n",
glob_abilities.file_delete == 0? "no":"yes");
printf("File preview (thumbnail) support : %s\n",
printf("File preview (thumbnail) support : %s\n",
glob_abilities.file_preview == 0? "no":"yes");
printf("File upload support : %s\n",
printf("File upload support : %s\n",
glob_abilities.file_put == 0? "no":"yes");
return (GP_OK);

View File

@@ -15,18 +15,25 @@
/* Physical Connection Types */
typedef enum {
GP_PORT_NONE,
GP_PORT_SERIAL,
GP_PORT_PARALLEL,
GP_PORT_USB,
GP_PORT_IEEE1394,
GP_PORT_NETWORK
GP_PORT_NONE = 1 << 0,
GP_PORT_SERIAL = 1 << 1,
GP_PORT_PARALLEL = 1 << 2,
GP_PORT_USB = 1 << 3,
GP_PORT_IEEE1394 = 1 << 4,
GP_PORT_NETWORK = 1 << 5
} CameraPortType;
/* Some macros for determining what type of ports the camera supports */
#define SERIAL_SUPPORTED(_a) ((_a >> 1)&&0x01)
#define PARALLEL_SUPPORTED(_a) ((_a >> 2)&&0x01)
#define USB_SUPPORTED(_a) ((_a >> 3)&&0x01)
#define IEEE1394_SUPPORTED(_a) ((_a >> 4)&&0x01)
#define NETWORK_SUPPORTED(_a) ((_a >> 5)&&0x01)
typedef enum {
GP_CAPTURE_IMAGE,
GP_CAPTURE_AUDIO,
GP_CAPTURE_VIDEO
GP_CAPTURE_IMAGE = 1 << 0,
GP_CAPTURE_AUDIO = 1 << 1,
GP_CAPTURE_VIDEO = 1 << 2
} CameraCaptureType;
typedef enum {
@@ -103,6 +110,8 @@ typedef struct {
char model[128];
/* can the library support the following: */
int port;
int serial;
int parallel;
int usb;

View File

@@ -10,15 +10,15 @@ int gp_abilities_dump (CameraAbilities *abilities) {
printf("core: Abilities for camera : %s\n",
abilities->model);
printf("core: Serial port support : %s\n",
abilities->serial == 0? "no":"yes");
SERIAL_SUPPORTED(abilities->port)? "yes":"no");
printf("core: Parallel port support : %s\n",
abilities->parallel == 0? "no":"yes");
PARALLEL_SUPPORTED(abilities->port)? "yes":"no");
printf("core: USB support : %s\n",
abilities->usb == 0? "no":"yes");
USB_SUPPORTED(abilities->port)? "yes":"no");
printf("core: IEEE1394 support : %s\n",
abilities->ieee1394 == 0? "no":"yes");
IEEE1394_SUPPORTED(abilities->port)? "yes":"no");
printf("core: Network support : %s\n",
abilities->network == 0? "no":"yes");
NETWORK_SUPPORTED(abilities->port)? "yes":"no");
if (abilities->speed[0] != 0) {
printf("core: Transfer speeds supported :\n");
do {
@@ -43,11 +43,7 @@ int gp_abilities_dump (CameraAbilities *abilities) {
int gp_abilities_clear (CameraAbilities *abilities) {
strcpy(abilities->model, "");
abilities->serial = 0;
abilities->parallel = 0;
abilities->ieee1394 = 0;
abilities->usb = 0;
abilities->network = 0;
abilities->port = 0;
abilities->speed[0] = 0;
abilities->capture = 0;
abilities->config = 0;