mirror of
https://github.com/polhenarejos/pico-keys-sdk
synced 2026-05-28 17:11:23 +02:00
Use persistent memory for storing dynamic VID/PID.
Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
This commit is contained in:
@@ -265,6 +265,8 @@ void scan_region(bool persistent) {
|
|||||||
void wait_flash_finish();
|
void wait_flash_finish();
|
||||||
#ifndef ENABLE_EMULATION
|
#ifndef ENABLE_EMULATION
|
||||||
extern uint16_t usb_vid, usb_pid;
|
extern uint16_t usb_vid, usb_pid;
|
||||||
|
file_t sef_vp = {.fid = EF_VP, .parent = 5, .name = NULL, .type = FILE_TYPE_INTERNAL_EF | FILE_DATA_FLASH | FILE_PERSISTENT, .data = NULL, .ef_structure = FILE_EF_TRANSPARENT, .acl = {0xff}};
|
||||||
|
file_t *ef_vp = &sef_vp;
|
||||||
#endif
|
#endif
|
||||||
void scan_flash() {
|
void scan_flash() {
|
||||||
initialize_flash(false); //soft initialization
|
initialize_flash(false); //soft initialization
|
||||||
@@ -282,7 +284,6 @@ void scan_flash() {
|
|||||||
scan_region(true);
|
scan_region(true);
|
||||||
scan_region(false);
|
scan_region(false);
|
||||||
#ifndef ENABLE_EMULATION
|
#ifndef ENABLE_EMULATION
|
||||||
file_t *ef_vp = search_dynamic_file(EF_VP);
|
|
||||||
if (file_has_data(ef_vp) && file_get_size(ef_vp) >= 4) {
|
if (file_has_data(ef_vp) && file_get_size(ef_vp) >= 4) {
|
||||||
uint8_t *data = file_get_data(ef_vp);
|
uint8_t *data = file_get_data(ef_vp);
|
||||||
usb_vid = (data[0] << 8) | data[1];
|
usb_vid = (data[0] << 8) | data[1];
|
||||||
|
|||||||
@@ -129,4 +129,8 @@ extern int meta_delete(uint16_t fid);
|
|||||||
extern int meta_add(uint16_t fid, const uint8_t *data, uint16_t len);
|
extern int meta_add(uint16_t fid, const uint8_t *data, uint16_t len);
|
||||||
extern int delete_file(file_t *ef);
|
extern int delete_file(file_t *ef);
|
||||||
|
|
||||||
|
#ifndef ENABLE_EMULATION
|
||||||
|
extern file_t *ef_vp;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#endif // _FILE_H_
|
||||||
|
|||||||
Reference in New Issue
Block a user