I am trying to open and read from a TRF7970A EVM board (by Texas Instruments) connected to my Mac. The device shows up in ioreg -lfxp IOUSB
as a "USB to UART Bridge Controller" and gives the vid, pid and serial number.
The device path in my Mac is as follows (machine name redacted)
koushikdas@xxxx ~ % ls /dev/tty* | grep usb
/dev/tty.usbserial-0001
I changed the permission as follows:
sudo chmod -R 777 /dev/tty.usbserial-0001
Below is my code snippet:
int vid = 0x10c4;
int pid = 0xea60;
try {
HidApi.init();
// HidDeviceStructure hidDeviceStructure = HidApi.open("/dev/tty.usbserial-0001");
HidDeviceStructure hidDeviceStructure = HidApi.open(vid, pid, "0001");
HidApi.setNonBlocking(hidDeviceStructure, true);
log("Reading device data " + HidApi.read(hidDeviceStructure, new byte[64]));
log("Device SN " + HidApi.getSerialNumber(hidDeviceStructure));
log("Device PID " + HidApi.getProductId(hidDeviceStructure));
log("Device Manufacturer " + HidApi.getManufacturer(hidDeviceStructure));
} catch (Exception e) {
log("Not able to open Hid device");
e.printStackTrace();
}
When I run the code, I see the following in console (package name redacted):
00:22:44.918 [ForkJoinPool-1-worker-1] INFO xxx - Reading device data -2
00:22:44.918 [ForkJoinPool-1-worker-1] INFO xxx - Device SN Device not initialised
00:22:44.918 [ForkJoinPool-1-worker-1] INFO xxx - Device PID Device not initialised
00:22:44.918 [ForkJoinPool-1-worker-1] INFO xxx - Device Manufacturer Device not initialised
I also tried setting HidApi.useLibUsbVariant = true;
but got the same result.
Any suggestion to resolve this would be helpful.