dirtyjtag: Allow custom VID/PID via command line options

Pass cable.vid and cable.pid to DirtyJtag constructor instead of using
hardcoded DIRTYJTAG_VID/PID. This allows users to use DirtyJTAG-compatible
firmware with custom USB VID/PID using the --vid and --pid flags:

  openFPGALoader -c dirtyJtag --vid 0x1337 --pid 0x0001 bitstream.fs

This is useful for custom DirtyJTAG implementations, embedded microcontrollers
with built-in JTAG adapters, or devices that use MS OS 2.0 descriptors for
automatic WinUSB driver loading with different VID/PID.

The default VID/PID (0x1209:0xC0CA) is preserved for backward compatibility.
This commit is contained in:
germaneguise
2025-12-27 16:12:31 +09:00
parent ac3ed1266d
commit c1c6e438a5
4 changed files with 5 additions and 6 deletions
+2 -3
View File
@@ -62,7 +62,7 @@ enum dirtyJtagSig {
SIG_SRST = (1 << 6)
};
DirtyJtag::DirtyJtag(uint32_t clkHZ, int8_t verbose):
DirtyJtag::DirtyJtag(uint32_t clkHZ, int8_t verbose, uint16_t vid, uint16_t pid):
_verbose(verbose),
dev_handle(NULL), usb_ctx(NULL), _tdi(0), _tms(0)
{
@@ -73,8 +73,7 @@ DirtyJtag::DirtyJtag(uint32_t clkHZ, int8_t verbose):
throw std::exception();
}
dev_handle = libusb_open_device_with_vid_pid(usb_ctx,
DIRTYJTAG_VID, DIRTYJTAG_PID);
dev_handle = libusb_open_device_with_vid_pid(usb_ctx, vid, pid);
if (!dev_handle) {
cerr << "fails to open device" << endl;
libusb_exit(usb_ctx);