anlogicCable: refresh with new VID

This commit is contained in:
Gwenhael Goavec-Merou 2025-02-23 08:59:08 +01:00
parent 7ed62601c7
commit 4b008a0196
1 changed files with 14 additions and 6 deletions

View File

@ -17,8 +17,9 @@
using namespace std; using namespace std;
#define ANLOGICCABLE_VID 0x0547 #define ANLOGICCABLE_VIDv1 0x336C
#define ANLOGICCABLE_PID 0x1002 #define ANLOGICCABLE_VIDv2 0x336C
#define ANLOGICCABLE_PID 0x1002
#define ANLOGICCABLE_CONF_EP 0x08 #define ANLOGICCABLE_CONF_EP 0x08
#define ANLOGICCABLE_WRITE_EP 0x06 #define ANLOGICCABLE_WRITE_EP 0x06
@ -54,12 +55,19 @@ AnlogicCable::AnlogicCable(uint32_t clkHZ):
throw std::exception(); throw std::exception();
} }
/* First: Try with original (old) VID */
dev_handle = libusb_open_device_with_vid_pid(usb_ctx, 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) { if (!dev_handle) {
cerr << "fails to open device" << endl; dev_handle = libusb_open_device_with_vid_pid(usb_ctx,
libusb_exit(usb_ctx); ANLOGICCABLE_VIDv2, ANLOGICCABLE_PID);
throw std::exception();
if (!dev_handle) {
cerr << "fails to open device" << endl;
libusb_exit(usb_ctx);
throw std::exception();
}
} }
ret = libusb_claim_interface(dev_handle, 0); ret = libusb_claim_interface(dev_handle, 0);