Add USB debug command to return sensor ID.

This commit is contained in:
iabdalkader 2020-02-03 23:18:29 +02:00
parent 49416a5bc0
commit 5d4ef2632d
2 changed files with 14 additions and 1 deletions

View File

@ -84,6 +84,13 @@ void usbdbg_data_in(void *buffer, int length)
break;
}
case USBDBG_SENSOR_ID: {
int sensor_id = sensor_get_id();
memcpy(buffer, &sensor_id, 4);
cmd = USBDBG_NONE;
break;
}
case USBDBG_TX_BUF: {
uint8_t *tx_buf = usb_cdc_tx_buf(length);
memcpy(buffer, tx_buf, length);
@ -341,6 +348,11 @@ void usbdbg_control(void *buffer, uint8_t request, uint32_t length)
xfer_length = length;
break;
case USBDBG_SENSOR_ID:
xfer_bytes = 0;
xfer_length = length;
break;
default: /* error */
cmd = USBDBG_NONE;
break;

View File

@ -48,7 +48,8 @@ enum usbdbg_cmd {
USBDBG_SYS_RESET =0x0C,
USBDBG_FB_ENABLE =0x0D,
USBDBG_TX_BUF_LEN =0x8E,
USBDBG_TX_BUF =0x8F
USBDBG_TX_BUF =0x8F,
USBDBG_SENSOR_ID =0x90
};
void usbdbg_init();
bool usbdbg_script_ready();