mirror of
https://github.com/polhenarejos/pico-keys-sdk
synced 2026-06-17 20:07:09 +02:00
Add enabled USB interfaces in PHY.
Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
This commit is contained in:
16
src/fs/phy.c
16
src/fs/phy.c
@@ -65,6 +65,11 @@ int phy_serialize_data(const phy_data_t *phy, uint8_t *data, uint16_t *len) {
|
||||
*p++ = 4;
|
||||
p += put_uint32_t_be(phy->enabled_curves, p);
|
||||
}
|
||||
if (phy->enabled_usb_itf_present) {
|
||||
*p++ = PHY_ENABLED_USB_ITF;
|
||||
*p++ = 1;
|
||||
*p++ = phy->enabled_usb_itf;
|
||||
}
|
||||
|
||||
*len = p - data;
|
||||
return PICOKEY_OK;
|
||||
@@ -129,11 +134,22 @@ int phy_unserialize_data(const uint8_t *data, uint16_t len, phy_data_t *phy) {
|
||||
phy->enabled_curves_present = true;
|
||||
}
|
||||
break;
|
||||
|
||||
case PHY_ENABLED_USB_ITF:
|
||||
if (tlen == 1) {
|
||||
phy->enabled_usb_itf = *p++;
|
||||
phy->enabled_usb_itf_present = true;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
p += tlen;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!phy_data.enabled_usb_itf_present) {
|
||||
phy_data.enabled_usb_itf = PHY_USB_ITF_CCID | PHY_USB_ITF_WCID | PHY_USB_ITF_HID | PHY_USB_ITF_KB;
|
||||
phy_data.enabled_usb_itf_present = true;
|
||||
}
|
||||
return PICOKEY_OK;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user