mirror of
https://github.com/polhenarejos/pico-keys-sdk
synced 2026-05-28 17:11:23 +02:00
Added support for dynamic USB_VID / USB_PID.
It can be changed on runtime without rebuilding or patching. Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
This commit is contained in:
@@ -26,7 +26,9 @@
|
||||
#include "pico_keys.h"
|
||||
#include "usb.h"
|
||||
#include "apdu.h"
|
||||
#ifndef ENABLE_EMULATION
|
||||
#include "tusb.h"
|
||||
#endif
|
||||
|
||||
// For memcpy
|
||||
#include <string.h>
|
||||
@@ -158,8 +160,10 @@ queue_t usb_to_card_q;
|
||||
queue_t card_to_usb_q;
|
||||
#endif
|
||||
|
||||
#ifndef ENABLE_EMULATION
|
||||
extern uint16_t usb_vid, usb_pid;
|
||||
extern tusb_desc_device_t desc_device;
|
||||
#endif
|
||||
void usb_init()
|
||||
{
|
||||
#ifndef ENABLE_EMULATION
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
#endif
|
||||
#include "pico_keys_version.h"
|
||||
#include "usb.h"
|
||||
#include "pico_keys.h"
|
||||
|
||||
#ifndef USB_VID
|
||||
#define USB_VID 0xFEFF
|
||||
@@ -39,11 +40,14 @@
|
||||
|
||||
#define MAX_USB_POWER 1
|
||||
|
||||
uint16_t usb_vid = USB_VID;
|
||||
uint16_t usb_pid = USB_PID;
|
||||
|
||||
|
||||
//--------------------------------------------------------------------+
|
||||
// Device Descriptors
|
||||
//--------------------------------------------------------------------+
|
||||
tusb_desc_device_t const desc_device = {
|
||||
tusb_desc_device_t desc_device = {
|
||||
.bLength = sizeof(tusb_desc_device_t),
|
||||
.bDescriptorType = TUSB_DESC_DEVICE,
|
||||
.bcdUSB = (USB_BCD),
|
||||
|
||||
Reference in New Issue
Block a user