Add enabled USB interfaces in PHY.

Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
This commit is contained in:
Pol Henarejos
2025-03-22 23:24:36 +01:00
parent f1b1382300
commit c185b35ca3
2 changed files with 25 additions and 1 deletions

View File

@@ -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;
}