Skip to content

Commit 667f8de

Browse files
authored
Merge pull request #606 from germaneguise/feature/dirtyjtag-custom-vid-pid
dirtyjtag: Allow custom VID/PID via command line options
2 parents ac3ed12 + c1c6e43 commit 667f8de

File tree

4 files changed

+5
-6
lines changed

4 files changed

+5
-6
lines changed

src/dirtyJtag.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ enum dirtyJtagSig {
6262
SIG_SRST = (1 << 6)
6363
};
6464

65-
DirtyJtag::DirtyJtag(uint32_t clkHZ, int8_t verbose):
65+
DirtyJtag::DirtyJtag(uint32_t clkHZ, int8_t verbose, uint16_t vid, uint16_t pid):
6666
_verbose(verbose),
6767
dev_handle(NULL), usb_ctx(NULL), _tdi(0), _tms(0)
6868
{
@@ -73,8 +73,7 @@ DirtyJtag::DirtyJtag(uint32_t clkHZ, int8_t verbose):
7373
throw std::exception();
7474
}
7575

76-
dev_handle = libusb_open_device_with_vid_pid(usb_ctx,
77-
DIRTYJTAG_VID, DIRTYJTAG_PID);
76+
dev_handle = libusb_open_device_with_vid_pid(usb_ctx, vid, pid);
7877
if (!dev_handle) {
7978
cerr << "fails to open device" << endl;
8079
libusb_exit(usb_ctx);

src/dirtyJtag.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
class DirtyJtag : public JtagInterface {
2121
public:
22-
DirtyJtag(uint32_t clkHZ, int8_t verbose);
22+
DirtyJtag(uint32_t clkHZ, int8_t verbose, uint16_t vid = 0x1209, uint16_t pid = 0xC0CA);
2323
virtual ~DirtyJtag();
2424

2525
int setClkFreq(uint32_t clkHZ) override;

src/jtag.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ Jtag::Jtag(const cable_t &cable, const jtag_pins_conf_t *pin_conf,
139139
break;
140140
case MODE_DIRTYJTAG:
141141
#ifdef ENABLE_DIRTYJTAG
142-
_jtag = new DirtyJtag(clkHZ, verbose);
142+
_jtag = new DirtyJtag(clkHZ, verbose, cable.vid, cable.pid);
143143
#else
144144
std::cerr << "Jtag: support for dirtyJtag cable was not enabled at compile time" << std::endl;
145145
throw std::exception();

src/xvc_server.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ XVC_server::XVC_server(int port, const cable_t & cable,
6060
new CH552_jtag(cable.config, dev, serial, clkHZ, _verbose);
6161
break;
6262
case MODE_DIRTYJTAG:
63-
_jtag = new DirtyJtag(clkHZ, _verbose);
63+
_jtag = new DirtyJtag(clkHZ, _verbose, cable.vid, cable.pid);
6464
break;
6565
case MODE_JLINK:
6666
_jtag = new Jlink(clkHZ, _verbose);

0 commit comments

Comments
 (0)