Introduce USB product name as a dynamic field.
Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
This commit is contained in:
parent
86999d8cdd
commit
7805131d92
2 changed files with 15 additions and 0 deletions
11
src/fs/phy.c
11
src/fs/phy.c
|
|
@ -49,6 +49,11 @@ int phy_serialize_data(const phy_data_t *phy, uint8_t *data, uint16_t *len) {
|
|||
*p++ = PHY_UP_BTN;
|
||||
*p++ = phy->up_btn;
|
||||
}
|
||||
if (phy->usb_product_present) {
|
||||
*p++ = PHY_USB_PRODUCT;
|
||||
strcpy((char *)p, phy->usb_product);
|
||||
p += strlen(phy->usb_product);
|
||||
}
|
||||
|
||||
*len = p - data;
|
||||
return PICOKEY_OK;
|
||||
|
|
@ -86,6 +91,12 @@ int phy_unserialize_data(const uint8_t *data, uint16_t len, phy_data_t *phy) {
|
|||
phy->up_btn = *p++;
|
||||
phy->up_btn_present = true;
|
||||
break;
|
||||
case PHY_USB_PRODUCT:
|
||||
memset(phy->usb_product, 0, sizeof(phy->usb_product));
|
||||
strlcpy(phy->usb_product, (const char *)p, sizeof(phy->usb_product));
|
||||
phy->usb_product_present = true;
|
||||
p += strlen(phy->usb_product);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return PICOKEY_OK;
|
||||
|
|
|
|||
|
|
@ -25,6 +25,8 @@
|
|||
#define PHY_LED_BTNESS 0x5
|
||||
#define PHY_OPTS 0x6
|
||||
#define PHY_UP_BTN 0x8
|
||||
#define PHY_USB_PRODUCT 0x9
|
||||
|
||||
|
||||
#define PHY_OPT_WCID 0x1
|
||||
#define PHY_OPT_DIMM 0x2
|
||||
|
|
@ -45,10 +47,12 @@ typedef struct phy_data {
|
|||
uint8_t led_brightness;
|
||||
uint16_t opts;
|
||||
uint8_t up_btn;
|
||||
char usb_product[32];
|
||||
bool vidpid_present;
|
||||
bool led_gpio_present;
|
||||
bool led_brightness_present;
|
||||
bool up_btn_present;
|
||||
bool usb_product_present;
|
||||
} phy_data_t;
|
||||
|
||||
#define PHY_OPT_MASK (PHY_UP_BTN | PHY_OPT_SECURE_LOCK | PHY_OPT_SECURE_BOOT | PHY_OPT_DIMM | PHY_OPT_WCID)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue