Skip to content

Commit b768145

Browse files
authored
Merge pull request #33 from keyboardio/configurable-vid-pid
Allow configuration of VID/PID without hacking up the source code
2 parents 2040e7a + 1a92de6 commit b768145

2 files changed

Lines changed: 12 additions & 1 deletion

File tree

README.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,12 @@ This bootloader implements the draft [WebUSB](https://wicg.github.io/webusb/) sp
7878
For a demo implementing dfu-util features in the browser, see https://devanlai.github.io/webdfu/dfu-util/
7979

8080
## USB VID/PID
81-
The USB VID/PID pair ([1209/DB42](http://pid.codes/1209/DB42/)) is allocated through the [pid.codes](http://pid.codes/) open-source USB PID program.
81+
The default USB VID/PID pair ([1209/DB42](http://pid.codes/1209/DB42/)) is allocated through the [pid.codes](http://pid.codes/) open-source USB PID program.
82+
83+
To use a custom VID/PID pair, you need to set the macros `USB_VID` and `USB_PID`. One way to do this is by setting the `DEFS` environment variable when compiling:
84+
85+
DEFS="-DUSB_VID=0x1209 -DUSB_PID=0xCAFE" make
86+
8287

8388
## Licensing
8489
All contents of the dapboot project are licensed under terms that are compatible with the terms of the GNU Lesser General Public License version 3.

src/usb_conf.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,14 @@
2121

2222
#include <libopencm3/usb/usbd.h>
2323

24+
#ifndef USB_VID
2425
#define USB_VID 0x1209
26+
#endif
27+
28+
#ifndef USB_PID
2529
#define USB_PID 0xdb42
30+
#endif
31+
2632
#define USB_CONTROL_BUF_SIZE 1024
2733
#define USB_SERIAL_NUM_LENGTH 24
2834
#define INTF_DFU 0

0 commit comments

Comments
 (0)