summaryrefslogtreecommitdiffstats
path: root/backend_shinkos2145.c
diff options
context:
space:
mode:
authorSolomon Peachy <pizza@shaftnet.org>2019-05-09 12:39:18 -0400
committerSolomon Peachy <pizza@shaftnet.org>2019-05-09 12:39:18 -0400
commitc87fe6cdcc1026d8e87663a85d059a695ee4a301 (patch)
tree6bac5d8d92b8e5870f13485e9f575a1348e100cf /backend_shinkos2145.c
parent0e085409ccc074b86c0e76a08341ddfc874a524c (diff)
downloadselphy_print-c87fe6cdcc1026d8e87663a85d059a695ee4a301.tar.gz
selphy_print-c87fe6cdcc1026d8e87663a85d059a695ee4a301.tar.bz2
selphy_print-c87fe6cdcc1026d8e87663a85d059a695ee4a301.zip
shinko: Extract more common code.
Diffstat (limited to 'backend_shinkos2145.c')
-rw-r--r--backend_shinkos2145.c45
1 files changed, 4 insertions, 41 deletions
diff --git a/backend_shinkos2145.c b/backend_shinkos2145.c
index 78d20b2..573aeca 100644
--- a/backend_shinkos2145.c
+++ b/backend_shinkos2145.c
@@ -341,15 +341,6 @@ struct s2145_status_hdr {
#define RESULT_SUCCESS 0x01
#define RESULT_FAIL 0x02
-#define ERROR_NONE 0x00
-#define ERROR_INVALID_PARAM 0x01
-#define ERROR_MAIN_APP_INACTIVE 0x02
-#define ERROR_COMMS_TIMEOUT 0x03
-#define ERROR_MAINT_NEEDED 0x04
-#define ERROR_BAD_COMMAND 0x05
-#define ERROR_PRINTER 0x11
-#define ERROR_BUFFER_FULL 0x21
-
static char *error_codes(uint8_t major, uint8_t minor)
{
switch(major) {
@@ -548,28 +539,6 @@ static char *error_codes(uint8_t major, uint8_t minor)
}
}
-static char *error_str(uint8_t v) {
- switch (v) {
- case ERROR_NONE:
- return "None";
- case ERROR_INVALID_PARAM:
- return "Invalid Command Parameter";
- case ERROR_MAIN_APP_INACTIVE:
- return "Main App Inactive";
- case ERROR_COMMS_TIMEOUT:
- return "Main Communication Timeout";
- case ERROR_MAINT_NEEDED:
- return "Maintenance Needed";
- case ERROR_BAD_COMMAND:
- return "Inappropriate Command";
- case ERROR_PRINTER:
- return "Printer Error";
- case ERROR_BUFFER_FULL:
- return "Buffer Full";
- default:
- return "Unknown";
- }
-}
#define STATUS_READY 0x00
#define STATUS_INIT_CPU 0x31
@@ -707,16 +676,10 @@ struct s2145_modelname_resp {
uint8_t modelname[40];
} __attribute__((packed));
-struct s2145_error_item {
- uint8_t major;
- uint8_t minor;
- uint32_t print_counter;
-} __attribute__((packed));
-
struct s2145_errorlog_resp {
struct s2145_status_hdr hdr;
uint8_t count;
- struct s2145_error_item items[10]; /* Not all necessarily used */
+ struct sinfonia_error_item items[10]; /* Not all necessarily used */
} __attribute__((packed));
struct s2145_fwinfo_resp {
@@ -815,7 +778,7 @@ static int get_status(struct shinkos2145_ctx *ctx)
resp->hdr.error = resp->hdr.status;
INFO(" Error 0x%02x (%s) 0x%02x/0x%02x (%s)\n",
resp->hdr.error,
- error_str(resp->hdr.error),
+ sinfonia_error_str(resp->hdr.error),
resp->hdr.printer_major,
resp->hdr.printer_minor, error_codes(resp->hdr.printer_major, resp->hdr.printer_minor));
}
@@ -1596,7 +1559,7 @@ top:
sts->hdr.error = sts->hdr.status;
INFO(" Error 0x%02x (%s) 0x%02x/0x%02x (%s)\n",
sts->hdr.error,
- error_str(sts->hdr.error),
+ sinfonia_error_str(sts->hdr.error),
sts->hdr.printer_major,
sts->hdr.printer_minor, error_codes(sts->hdr.printer_major, sts->hdr.printer_minor));
}
@@ -1608,7 +1571,7 @@ top:
printer_error:
ERROR("Printer reported error: %#x (%s) status: %#x (%s) -> %#x.%#x (%s)\n",
sts->hdr.error,
- error_str(sts->hdr.error),
+ sinfonia_error_str(sts->hdr.error),
sts->hdr.status,
status_str(sts->hdr.status),
sts->hdr.printer_major, sts->hdr.printer_minor,