diff --git a/README.md b/README.md index 1e511486..f829e111 100644 --- a/README.md +++ b/README.md @@ -151,7 +151,7 @@ Follow these steps to install and configure the project: └─5869 python3.11 /home/user/bluetooth_2_usb/bluetooth_2_usb.py --auto_discover --grab_devices Dec 13 10:33:00 pi0w systemd[1]: Started bluetooth_2_usb.service - Bluetooth to USB HID relay. - Dec 13 10:33:06 pi0w bluetooth_2_usb[5869]: 23-12-13 10:33:06 [INFO] Launching Bluetooth 2 USB v0.7.4 + Dec 13 10:33:06 pi0w bluetooth_2_usb[5869]: 23-12-13 10:33:06 [INFO] Launching Bluetooth 2 USB v0.8.0 Dec 13 10:33:06 pi0w bluetooth_2_usb[5869]: 23-12-13 10:33:06 [INFO] Discovering input devices... Dec 13 10:33:09 pi0w bluetooth_2_usb[5869]: 23-12-13 10:33:09 [INFO] Activated relay for device /dev/input/event2, name "AceRK Mouse", phys "0a:1b:2c:3d:4e:5f" Dec 13 10:33:09 pi0w bluetooth_2_usb[5869]: 23-12-13 10:33:09 [INFO] Activated relay for device /dev/input/event1, name "AceRK Keyboard", phys "0a:1b:2c:3d:4e:5f" @@ -370,7 +370,7 @@ Here's a few things you could try: user@pi0w:~/bluetooth_2_usb $ sudo service bluetooth_2_usb stop && sudo bluetooth_2_usb -i hdmi,a1:b2:c3:d4:e5:f6,/dev/input/event3 -d ; sudo service bluetooth_2_usb start 23-12-16 15:52:21 [DEBUG] CLI args: device_ids=['hdmi', 'a1:b2:c3:d4:e5:f6', '/dev/input/event3'], auto_discover=False, grab_devices=False, list_devices=False, log_to_file=False, log_path=/var/log/bluetooth_2_usb/bluetooth_2_usb.log, debug=True, version=False 23-12-16 15:52:21 [DEBUG] Logging to stdout - 23-12-16 15:52:21 [INFO] Launching Bluetooth 2 USB v0.7.4 + 23-12-16 15:52:21 [INFO] Launching Bluetooth 2 USB v0.8.0 23-12-16 15:52:21 [INFO] Discovering input devices... 23-12-16 15:52:21 [DEBUG] Relaying devices with matching name "hdmi" or MAC "a1:b2:c3:d4:e5:f6" or path "/dev/input/event3" 23-12-16 15:52:21 [DEBUG] Initializing USB gadgets... diff --git a/bluetooth_2_usb.py b/bluetooth_2_usb.py index 6adb697c..a1008b87 100755 --- a/bluetooth_2_usb.py +++ b/bluetooth_2_usb.py @@ -13,7 +13,7 @@ _logger = get_logger() -_VERSION = "0.7.4" +_VERSION = "0.8.0" _VERSIONED_NAME = f"Bluetooth 2 USB v{_VERSION}" diff --git a/src/bluetooth_2_usb/__init__.py b/src/bluetooth_2_usb/__init__.py index 3853f8d7..76f35b99 100644 --- a/src/bluetooth_2_usb/__init__.py +++ b/src/bluetooth_2_usb/__init__.py @@ -2,6 +2,7 @@ # Gather everything into a single, convenient namespace. # -------------------------------------------------------------------------- +from .args import Arguments, parse_args from .evdev import ( ecodes, evdev_to_usb_hid, diff --git a/src/bluetooth_2_usb/relay.py b/src/bluetooth_2_usb/relay.py index 2a1bb658..5608458e 100644 --- a/src/bluetooth_2_usb/relay.py +++ b/src/bluetooth_2_usb/relay.py @@ -149,16 +149,16 @@ def _move_mouse(event: RelEvent) -> None: _logger.debug(f"Moving {_mouse_gadget} {coordinates}") _mouse_gadget.move(x, y, mwheel) except Exception: - _logger.exception(f"Failed moving mouse {_mouse_gadget} {coordinates}") + _logger.exception(f"Failed moving {_mouse_gadget} {coordinates}") def _send_key(event: KeyEvent) -> None: - device_out = _get_output_device(event) - if device_out is None: - raise RuntimeError("USB gadget not initialized") key_id, key_name = evdev_to_usb_hid(event) if key_id is None or key_name is None: return + device_out = _get_output_device(event) + if device_out is None: + raise RuntimeError("USB gadget not initialized") try: if event.keystate == KeyEvent.key_down: _logger.debug(f"Pressing {key_name} (0x{key_id:02X}) on {device_out}")