Skip to content

Commit fb12d07

Browse files
Vzor-tresf
andauthored
macOS: Fix HID crashing regression (#1267)
Use thread-safe calls for macOS HID Uses a custom snapshot of hid4java gary-rowe/hid4java#153 --------- Co-authored-by: Tres Finocchiaro <tres.finocchiaro@gmail.com>
1 parent 522fba3 commit fb12d07

File tree

3 files changed

+2
-13
lines changed

3 files changed

+2
-13
lines changed
-612 KB
Binary file not shown.
927 KB
Binary file not shown.

src/qz/communication/H4J_HidUtilities.java

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,26 +7,16 @@
77
import org.hid4java.HidDevice;
88
import org.hid4java.HidManager;
99
import org.hid4java.HidServices;
10-
import qz.utils.SystemUtilities;
1110

1211
import javax.usb.util.UsbUtil;
1312
import java.util.HashSet;
1413
import java.util.List;
1514

1615
public class H4J_HidUtilities {
17-
18-
private static HidServices service = HidManager.getHidServices();
19-
16+
private static final HidServices service = HidManager.getHidServices();
2017

2118
public static List<HidDevice> getHidDevices() {
22-
List<HidDevice> devices = service.getAttachedHidDevices();
23-
24-
// FIXME: Prevent hard crash on OSX
25-
// Per upstream Mac bug https://github.com/gary-rowe/hid4java/issues/37
26-
if (SystemUtilities.isMac()) {
27-
service.shutdown();
28-
}
29-
return devices;
19+
return service.getAttachedHidDevices();
3020
}
3121

3222
public static JSONArray getHidDevicesJSON() throws JSONException {
@@ -72,5 +62,4 @@ public static HidDevice findDevice(DeviceOptions dOpts) {
7262

7363
return null;
7464
}
75-
7665
}

0 commit comments

Comments
 (0)