# IAR J-Link USB
ATTRS{idVendor}=="1366", ATTRS{idProduct}=="0101", MODE="664", GROUP="plugdev"
+ATTRS{idVendor}=="1366", ATTRS{idProduct}=="0102", MODE="664", GROUP="plugdev"
+ATTRS{idVendor}=="1366", ATTRS{idProduct}=="0103", MODE="664", GROUP="plugdev"
+ATTRS{idVendor}=="1366", ATTRS{idProduct}=="0104", MODE="664", GROUP="plugdev"
+
+# J-Link-OB (onboard)
+ATTRS{idVendor}=="1366", ATTRS{idProduct}=="0105", MODE="664", GROUP="plugdev"
# Raisonance RLink
ATTRS{idVendor}=="138e", ATTRS{idProduct}=="9000", MODE="664", GROUP="plugdev"
* pid = ( usb_address > 0x4) ? 0x0101 : (0x101 + usb_address)
*/
-#define VID 0x1366, 0x1366, 0x1366, 0x1366
-#define PID 0x0101, 0x0102, 0x0103, 0x0104
+#define JLINK_OB_PID 0x0105
#define JLINK_WRITE_ENDPOINT 0x02
#define JLINK_READ_ENDPOINT 0x81
+#define JLINK_OB_WRITE_ENDPOINT 0x06
+#define JLINK_OB_READ_ENDPOINT 0x85
+
static unsigned int jlink_write_ep = JLINK_WRITE_ENDPOINT;
static unsigned int jlink_read_ep = JLINK_READ_ENDPOINT;
static unsigned int jlink_hw_jtag_version = 2;
static struct jlink *jlink_handle;
/* pid could be specified at runtime */
-static uint16_t vids[] = { VID, 0 };
-static uint16_t pids[] = { PID, 0 };
+static uint16_t vids[] = { 0x1366, 0x1366, 0x1366, 0x1366, 0x1366, 0 };
+static uint16_t pids[] = { 0x0101, 0x0102, 0x0103, 0x0104, 0x0105, 0 };
static uint32_t jlink_caps;
static uint32_t jlink_hw_type;
usb_set_altinterface(result->usb_handle, 0);
#endif
+ /* Use the OB endpoints if the JLink we matched is a Jlink-OB adapter */
+ uint16_t matched_pid;
+ if (jtag_libusb_get_pid(udev, &matched_pid) == ERROR_OK) {
+ if (matched_pid == JLINK_OB_PID) {
+ jlink_read_ep = JLINK_OB_WRITE_ENDPOINT;
+ jlink_write_ep = JLINK_OB_READ_ENDPOINT;
+ }
+ }
+
jtag_libusb_get_endpoints(udev, &jlink_read_ep, &jlink_write_ep);
struct jlink *result = malloc(sizeof(struct jlink));