common: Make IEEE1284 ID manipulation code non-static.
This commit is contained in:
parent
320551c61e
commit
0dfd40efe0
|
@ -31,7 +31,7 @@
|
|||
#include <errno.h>
|
||||
#include <signal.h>
|
||||
|
||||
#define BACKEND_VERSION "0.96"
|
||||
#define BACKEND_VERSION "0.97"
|
||||
#ifndef URI_PREFIX
|
||||
#error "Must Define URI_PREFIX"
|
||||
#endif
|
||||
|
@ -107,7 +107,7 @@ static int lookup_printer_type(struct dyesub_backend *backend, uint16_t idVendor
|
|||
|
||||
/* Interface **MUST** already be claimed! */
|
||||
#define ID_BUF_SIZE 2048
|
||||
static char *get_device_id(struct libusb_device_handle *dev, int iface)
|
||||
char *get_device_id(struct libusb_device_handle *dev, int iface)
|
||||
{
|
||||
int length;
|
||||
char *buf = malloc(ID_BUF_SIZE + 1);
|
||||
|
@ -157,14 +157,7 @@ done:
|
|||
}
|
||||
|
||||
/* Used with the IEEE1284 deviceid string parsing */
|
||||
struct deviceid_dict {
|
||||
char *key;
|
||||
char *val;
|
||||
};
|
||||
|
||||
#define MAX_DICT 32
|
||||
|
||||
static int parse1284_data(const char *device_id, struct deviceid_dict* dict)
|
||||
int parse1284_data(const char *device_id, struct deviceid_dict* dict)
|
||||
{
|
||||
char *ptr;
|
||||
char key[256];
|
||||
|
@ -215,7 +208,7 @@ static int parse1284_data(const char *device_id, struct deviceid_dict* dict)
|
|||
return num;
|
||||
}
|
||||
|
||||
static char *dict_find(const char *key, int dlen, struct deviceid_dict* dict)
|
||||
char *dict_find(const char *key, int dlen, struct deviceid_dict* dict)
|
||||
{
|
||||
while(dlen) {
|
||||
if (!strcmp(key, dict->key))
|
||||
|
|
|
@ -109,6 +109,16 @@
|
|||
/* To cheat the compiler */
|
||||
#define UNUSED(expr) do { (void)(expr); } while (0)
|
||||
|
||||
/* IEEE1284 ID processing */
|
||||
struct deviceid_dict {
|
||||
char *key;
|
||||
char *val;
|
||||
};
|
||||
#define MAX_DICT 32
|
||||
int parse1284_data(const char *device_id, struct deviceid_dict* dict);
|
||||
char *dict_find(const char *key, int dlen, struct deviceid_dict* dict);
|
||||
char *get_device_id(struct libusb_device_handle *dev, int iface);
|
||||
|
||||
/* To enumerate supported devices */
|
||||
enum {
|
||||
P_UNKNOWN = 0,
|
||||
|
|
Loading…
Reference in New Issue