优化了键盘操作

This commit is contained in:
zxj
2025-07-25 15:58:11 +08:00
parent c2bae2f3e8
commit c0a628c51f
5 changed files with 11 additions and 6 deletions
@@ -22,6 +22,7 @@ public class ScanGunKeyEventHelper {
// private String mDeviceName = "TMC HIDKeyBoard";
private String mDeviceName = "Linux 3.4.35 with ak-hsudc Composite Gadget (ACM + HID)";
private String mDeviceName1 = "USBKey Chip USBKey Module";
public ScanGunKeyEventHelper(Context context, OnScanSuccessListener onScanSuccessListener) {
@@ -156,9 +157,10 @@ public class ScanGunKeyEventHelper {
*/
public boolean isScanGunEvent(KeyEvent event) {
if (event == null || event.getDevice() == null) return false;
L.e("event===" + event.getDevice().getName() +
String deviceName = event.getDevice().getName();
L.e("event===" + deviceName +
"===Char===" + event.getCharacters() +
"===Action===" + event.getAction());
return event.getDevice().getName().equals(mDeviceName);
return deviceName.equals(mDeviceName) || deviceName.equals(mDeviceName1);
}
}