Skip to content

Commit 437bde1

Browse files
committed
reenabling the libusb interfaces for windows
1 parent e3cd96f commit 437bde1

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

javasdk/NRSDK/addons/com/neuronrobotics/sdk/javaxusb/UsbCDCSerialConnection.java

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
import com.neuronrobotics.sdk.common.BowlerRuntimeException;
4646
import com.neuronrobotics.sdk.common.ByteList;
4747
import com.neuronrobotics.sdk.common.Log;
48-
import com.neuronrobotics.sdk.util.OsInfoUtil;
48+
//import com.neuronrobotics.sdk.util.OsInfoUtil;
4949
import com.neuronrobotics.sdk.util.ThreadUtil;
5050

5151
public class UsbCDCSerialConnection extends BowlerAbstractConnection implements
@@ -90,7 +90,7 @@ public void abort() {
9090

9191
@Override
9292
public void run() {
93-
if(!OsInfoUtil.isWindows()){
93+
//if(!OsInfoUtil.isWindows()){
9494
setName("Bowler Platform USB Events thread");
9595
while (!this.abort) {
9696
// Let libusb handle pending events. This blocks until events
@@ -105,14 +105,14 @@ public void run() {
105105
}
106106
ThreadUtil.wait(100);
107107
}
108-
}
108+
//}
109109
}
110110
}
111111

112112
static {
113113
try {
114114
services = UsbHostManager.getUsbServices();
115-
if(!OsInfoUtil.isWindows()){
115+
//if(!OsInfoUtil.isWindows()){
116116
callbackHandle = new HotplugCallbackHandle();
117117
int result = LibUsb.hotplugRegisterCallback(null,
118118
LibUsb.HOTPLUG_EVENT_DEVICE_ARRIVED
@@ -142,7 +142,7 @@ public int processEvent(Context arg0, Device arg1,
142142
if (result != LibUsb.SUCCESS) {
143143
throw new LibUsbException("Unable to register hotplug callback", result);
144144
}
145-
}
145+
//}
146146
} catch (SecurityException e) {
147147
// TODO Auto-generated catch block
148148
e.printStackTrace();
@@ -375,7 +375,7 @@ public boolean connect() {
375375
}
376376

377377
public Device findDevice(String seriualNumber) {
378-
if(!OsInfoUtil.isWindows()){
378+
//if(!OsInfoUtil.isWindows()){
379379
// Read the USB device list
380380
DeviceList list = new DeviceList();
381381
int result = LibUsb.getDeviceList(null, list);
@@ -407,15 +407,15 @@ public Device findDevice(String seriualNumber) {
407407
// Ensure the allocated device list is freed
408408
LibUsb.freeDeviceList(list, true);
409409
}
410-
}
410+
//}
411411
// Device not found
412412
return null;
413413
}
414414

415415
private void kernelDetatch(UsbDevice mDevice)
416416
throws UnsupportedEncodingException, UsbDisconnectedException,
417417
UsbException {
418-
if(!OsInfoUtil.isWindows()){
418+
//if(!OsInfoUtil.isWindows()){
419419
Device kDev = findDevice(mDevice.getSerialNumberString());
420420
if (kDev == null)
421421
return;
@@ -433,7 +433,7 @@ private void kernelDetatch(UsbDevice mDevice)
433433
&& r != LibUsb.ERROR_NOT_FOUND)
434434
throw new LibUsbException("Unable to detach kernel driver", r);
435435
// System.out.println("Kernel detatched for device "+mDevice);
436-
}
436+
//}
437437
}
438438

439439
/*
@@ -452,7 +452,7 @@ public void disconnect() {
452452
camOutpipe.close();
453453
} catch (Exception e1) {
454454
}
455-
if(!OsInfoUtil.isWindows()){
455+
//if(!OsInfoUtil.isWindows()){
456456
if (deviceHandle != null) {
457457
try{
458458
LibUsb.attachKernelDriver(deviceHandle, interfaceNumber);
@@ -461,7 +461,7 @@ public void disconnect() {
461461

462462
}
463463
}
464-
}
464+
//}
465465
try {
466466
if (dataInterface.isClaimed())
467467
dataInterface.release();

0 commit comments

Comments
 (0)