pixma_bjnp.c pixma_bjnp.h pixma_bjnp_private.h: Added support for Canon laser multi-functionals using the mfnp protool over port 8610.

Improved debug logging to be more reeadable
merge-requests/1/head
Louis Lagendijk 2014-02-10 23:53:04 +01:00
rodzic 56b186e225
commit 77a1d1cdbc
3 zmienionych plików z 337 dodań i 182 usunięć

Plik diff jest za duży Load Diff

Wyświetl plik

@ -96,7 +96,7 @@ sanei_bjnp_find_devices (const char **conf_devices,
* Where: * Where:
* method = bjnp * method = bjnp
* hostname = resolvable name or IP-address * hostname = resolvable name or IP-address
* port = 8612 for a scanner * port = 8612 for a bjnp scanner, 8610 for a mfnp device
* An example could look like this: bjnp://host.domain:8612 * An example could look like this: bjnp://host.domain:8612
* *
* @param devname name of the device to open * @param devname name of the device to open

Wyświetl plik

@ -75,6 +75,7 @@
#define BJNP_SERIAL_MAX 16 /* maximum length of serial number */ #define BJNP_SERIAL_MAX 16 /* maximum length of serial number */
#define BJNP_NO_DEVICES 16 /* max number of open devices */ #define BJNP_NO_DEVICES 16 /* max number of open devices */
#define BJNP_SCAN_BUF_MAX 65536 /* size of scanner data intermediate buffer */ #define BJNP_SCAN_BUF_MAX 65536 /* size of scanner data intermediate buffer */
#define BJNP_BLOCKSIZE_START 512 /* startsize for last block detection */
/* timers */ /* timers */
#define BJNP_BROADCAST_INTERVAL 10 /* ms between broadcasts */ #define BJNP_BROADCAST_INTERVAL 10 /* ms between broadcasts */
@ -109,15 +110,34 @@
/* port numbers */ /* port numbers */
typedef enum bjnp_port_e typedef enum bjnp_port_e
{ {
BJNP_PORT_BROADCAST_BASE = 8610, MFNP_PORT_SCAN = 8610,
BJNP_PORT_PRINT = 8611, BJNP_PORT_PRINT = 8611,
BJNP_PORT_SCAN = 8612, BJNP_PORT_SCAN = 8612,
BJNP_PORT_3 = 8613, BJNP_PORT_3 = 8613,
BJNP_PORT_4 = 8614 BJNP_PORT_4 = 8614
} bjnp_port_t; } bjnp_port_t;
#define BJNP_METHOD "bjnp" typedef enum
#define BJNP_STRING "BJNP" {
PROTOCOL_BJNP = 0,
PROTOCOL_MFNP = 1,
PROTOCOL_NONE =2
} bjnp_protocol_t;
typedef struct
{
bjnp_protocol_t protocol_version;
int default_port;
char * proto_string;
char * method_string;
} bjnp_protocol_defs_t;
bjnp_protocol_defs_t bjnp_protocol_defs[] =
{
{PROTOCOL_BJNP, BJNP_PORT_SCAN,"BJNP", "bjnp"},
{PROTOCOL_MFNP, MFNP_PORT_SCAN,"MFNP", "mfnp"},
{PROTOCOL_NONE, -1, NULL, NULL}
};
/* commands */ /* commands */
typedef enum bjnp_cmd_e typedef enum bjnp_cmd_e
@ -168,7 +188,7 @@ struct __attribute__ ((__packed__)) DISCOVER_RESPONSE
struct BJNP_command response; /* reponse header */ struct BJNP_command response; /* reponse header */
char unknown1[4]; /* 00 01 08 00 */ char unknown1[4]; /* 00 01 08 00 */
char mac_len; /* length of mac address */ char mac_len; /* length of mac address */
char addr_len; /* length od address field */ char addr_len; /* length of address field */
unsigned char mac_addr[6]; /* printers mac address */ unsigned char mac_addr[6]; /* printers mac address */
union { union {
struct __attribute__ ((__packed__)) { struct __attribute__ ((__packed__)) {
@ -251,8 +271,18 @@ struct __attribute__ ((__packed__)) POLL_RESPONSE
struct __attribute__ ((__packed__)) IDENTITY struct __attribute__ ((__packed__)) IDENTITY
{ {
struct BJNP_command cmd; struct BJNP_command cmd;
uint16_t id_len; /* length of identity */ union __attribute__ ((__packed__))
char id[BJNP_IEEE1284_MAX]; /* identity */ {
struct __attribute__ ((__packed__)) payload_s
{
uint16_t id_len; /* length of identity */
char id[BJNP_IEEE1284_MAX]; /* identity */
} bjnp;
struct __attribute__ ((__packed__)) mfnp
{
char id[BJNP_IEEE1284_MAX];
} mfnp;
} payload;
}; };
@ -314,6 +344,10 @@ typedef enum
typedef struct device_s typedef struct device_s
{ {
int open; /* connection to scanner is opened */ int open; /* connection to scanner is opened */
/* protocol version */
int protocol;
char *protocol_string;
/* sockets */ /* sockets */