Skip to content

Commit

Permalink
anlogicCable: refresh with new VID
Browse files Browse the repository at this point in the history
  • Loading branch information
trabucayre committed Feb 23, 2025
1 parent 7ed6260 commit 4b008a0
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions src/anlogicCable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@

using namespace std;

#define ANLOGICCABLE_VID 0x0547
#define ANLOGICCABLE_PID 0x1002
#define ANLOGICCABLE_VIDv1 0x336C
#define ANLOGICCABLE_VIDv2 0x336C
#define ANLOGICCABLE_PID 0x1002

#define ANLOGICCABLE_CONF_EP 0x08
#define ANLOGICCABLE_WRITE_EP 0x06
Expand Down Expand Up @@ -54,12 +55,19 @@ AnlogicCable::AnlogicCable(uint32_t clkHZ):
throw std::exception();
}

/* First: Try with original (old) VID */
dev_handle = libusb_open_device_with_vid_pid(usb_ctx,
ANLOGICCABLE_VID, ANLOGICCABLE_PID);
ANLOGICCABLE_VIDv1, ANLOGICCABLE_PID);
/* If not found: try with new VID */
if (!dev_handle) {
cerr << "fails to open device" << endl;
libusb_exit(usb_ctx);
throw std::exception();
dev_handle = libusb_open_device_with_vid_pid(usb_ctx,
ANLOGICCABLE_VIDv2, ANLOGICCABLE_PID);

if (!dev_handle) {
cerr << "fails to open device" << endl;
libusb_exit(usb_ctx);
throw std::exception();
}
}

ret = libusb_claim_interface(dev_handle, 0);
Expand Down

0 comments on commit 4b008a0

Please sign in to comment.