Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

macOS: Fix HID crashing regression #1267

Merged
merged 3 commits into from
Jul 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file removed lib/communication/hid4java-0.7.2-SNAPSHOT.jar
Binary file not shown.
Binary file added lib/communication/hid4java-0.8.0+7.jar
Binary file not shown.
15 changes: 2 additions & 13 deletions src/qz/communication/H4J_HidUtilities.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,26 +7,16 @@
import org.hid4java.HidDevice;
import org.hid4java.HidManager;
import org.hid4java.HidServices;
import qz.utils.SystemUtilities;

import javax.usb.util.UsbUtil;
import java.util.HashSet;
import java.util.List;

public class H4J_HidUtilities {

private static HidServices service = HidManager.getHidServices();

private static final HidServices service = HidManager.getHidServices();

public static List<HidDevice> getHidDevices() {
List<HidDevice> devices = service.getAttachedHidDevices();

// FIXME: Prevent hard crash on OSX
// Per upstream Mac bug https://github.com/gary-rowe/hid4java/issues/37
if (SystemUtilities.isMac()) {
service.shutdown();
}
return devices;
return service.getAttachedHidDevices();
}

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

return null;
}

}
Loading