summaryrefslogtreecommitdiff
path: root/firmware
diff options
context:
space:
mode:
Diffstat (limited to 'firmware')
-rw-r--r--firmware/include/openpcd.h2
-rw-r--r--firmware/src/os/usbcmd_generic.c11
2 files changed, 13 insertions, 0 deletions
diff --git a/firmware/include/openpcd.h b/firmware/include/openpcd.h
index cdfb7a7..0cceb53 100644
--- a/firmware/include/openpcd.h
+++ b/firmware/include/openpcd.h
@@ -45,8 +45,10 @@ enum openpcd_cmd_class {
#define OPENPCD_CLS2CMD(x) (x << 4)
+/* Generic */
#define OPENPCD_CMD_GET_VERSION (0x1|OPENPCD_CLS2CMD(OPENPCD_CMD_CLS_GENERIC))
#define OPENPCD_CMD_SET_LED (0x2|OPENPCD_CLS2CMD(OPENPCD_CMD_CLS_GENERIC))
+#define OPENPCD_CMD_GET_SERIAL (0x3|OPENPCD_CLS2CMD(OPENPCD_CMD_CLS_GENERIC))
/* CMD_CLS_RC632 */
#define OPENPCD_CMD_WRITE_REG (0x1|OPENPCD_CLS2CMD(OPENPCD_CMD_CLS_RC632))
diff --git a/firmware/src/os/usbcmd_generic.c b/firmware/src/os/usbcmd_generic.c
index 9dec14e..386692b 100644
--- a/firmware/src/os/usbcmd_generic.c
+++ b/firmware/src/os/usbcmd_generic.c
@@ -31,6 +31,17 @@ static int gen_usb_rx(struct req_ctx *rctx)
DEBUGP("SET LED(%u,%u) ", poh->reg, poh->val);
led_switch(poh->reg, poh->val);
break;
+ case OPENPCD_CMD_GET_SERIAL:
+ DEBUGP("GET SERIAL ");
+ poh->flags |= OPENPCD_FLAG_RESPOND;
+#ifdef PCD
+ rctx->tot_len += 4;
+ rc632_get_serial(NULL, (u_int32_t *)poh->data);
+#else
+ /* FIXME: where to get serial in PICC case */
+ return USB_ERR(USB_ERR_CMD_NOT_IMPL);
+#endif
+ break;
default:
DEBUGP("UNKNOWN ");
return USB_ERR(USB_ERR_CMD_UNKNOWN);
personal git repositories of Harald Welte. Your mileage may vary