mirror of
https://github.com/polhenarejos/pico-keys-sdk
synced 2026-05-28 17:11:23 +02:00
Add PHY options and PHY_WCID.
Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
This commit is contained in:
@@ -73,8 +73,11 @@
|
|||||||
#define PHY_PID 0x2
|
#define PHY_PID 0x2
|
||||||
#define PHY_LED_GPIO 0x4
|
#define PHY_LED_GPIO 0x4
|
||||||
#define PHY_LED_MODE 0x5
|
#define PHY_LED_MODE 0x5
|
||||||
|
#define PHY_OPTS 0x6
|
||||||
|
|
||||||
#define PHY_MAX_SIZE 6
|
#define PHY_OPT_WCID 0x1
|
||||||
|
|
||||||
|
#define PHY_MAX_SIZE 8
|
||||||
|
|
||||||
#define MAX_DEPTH 4
|
#define MAX_DEPTH 4
|
||||||
|
|
||||||
|
|||||||
@@ -163,14 +163,23 @@ queue_t card_to_usb_q;
|
|||||||
|
|
||||||
#ifndef ENABLE_EMULATION
|
#ifndef ENABLE_EMULATION
|
||||||
extern tusb_desc_device_t desc_device;
|
extern tusb_desc_device_t desc_device;
|
||||||
|
bool enable_wcid = false;
|
||||||
#endif
|
#endif
|
||||||
void usb_init() {
|
void usb_init() {
|
||||||
#ifndef ENABLE_EMULATION
|
#ifndef ENABLE_EMULATION
|
||||||
uint16_t usb_vid = USB_VID, usb_pid = USB_PID;
|
uint16_t usb_vid = USB_VID, usb_pid = USB_PID;
|
||||||
if (file_has_data(ef_phy) && file_get_size(ef_phy) >= 4) {
|
if (file_has_data(ef_phy)) {
|
||||||
uint8_t *data = file_get_data(ef_phy);
|
uint8_t *data = file_get_data(ef_phy);
|
||||||
usb_vid = (data[PHY_VID] << 8) | data[PHY_VID+1];
|
if (file_get_size(ef_phy) >= 4) {
|
||||||
usb_pid = (data[PHY_PID] << 8) | data[PHY_PID+1];
|
usb_vid = (data[PHY_VID] << 8) | data[PHY_VID+1];
|
||||||
|
usb_pid = (data[PHY_PID] << 8) | data[PHY_PID+1];
|
||||||
|
}
|
||||||
|
if (file_get_size(ef_phy) >= 8) {
|
||||||
|
uint16_t opts = (data[PHY_OPTS] << 8) | data[PHY_OPTS+1];
|
||||||
|
if (opts & PHY_OPT_WCID) {
|
||||||
|
enable_wcid = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
desc_device.idVendor = usb_vid;
|
desc_device.idVendor = usb_vid;
|
||||||
desc_device.idProduct = usb_pid;
|
desc_device.idProduct = usb_pid;
|
||||||
|
|||||||
Reference in New Issue
Block a user