Skip to content

Commit 2edbca8

Browse files
authored
Minor improvements (#102)
1 parent 3dc9a99 commit 2edbca8

File tree

4 files changed

+8
-7
lines changed

4 files changed

+8
-7
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ Follow these steps to install and configure the project:
151151
└─5869 python3.11 /home/user/bluetooth_2_usb/bluetooth_2_usb.py --auto_discover --grab_devices
152152

153153
Dec 13 10:33:00 pi0w systemd[1]: Started bluetooth_2_usb.service - Bluetooth to USB HID relay.
154-
Dec 13 10:33:06 pi0w bluetooth_2_usb[5869]: 23-12-13 10:33:06 [INFO] Launching Bluetooth 2 USB v0.7.4
154+
Dec 13 10:33:06 pi0w bluetooth_2_usb[5869]: 23-12-13 10:33:06 [INFO] Launching Bluetooth 2 USB v0.8.0
155155
Dec 13 10:33:06 pi0w bluetooth_2_usb[5869]: 23-12-13 10:33:06 [INFO] Discovering input devices...
156156
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"
157157
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:
370370
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
371371
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
372372
23-12-16 15:52:21 [DEBUG] Logging to stdout
373-
23-12-16 15:52:21 [INFO] Launching Bluetooth 2 USB v0.7.4
373+
23-12-16 15:52:21 [INFO] Launching Bluetooth 2 USB v0.8.0
374374
23-12-16 15:52:21 [INFO] Discovering input devices...
375375
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"
376376
23-12-16 15:52:21 [DEBUG] Initializing USB gadgets...

bluetooth_2_usb.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414

1515
_logger = get_logger()
16-
_VERSION = "0.7.4"
16+
_VERSION = "0.8.0"
1717
_VERSIONED_NAME = f"Bluetooth 2 USB v{_VERSION}"
1818

1919

src/bluetooth_2_usb/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
# Gather everything into a single, convenient namespace.
33
# --------------------------------------------------------------------------
44

5+
from .args import Arguments, parse_args
56
from .evdev import (
67
ecodes,
78
evdev_to_usb_hid,

src/bluetooth_2_usb/relay.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -149,16 +149,16 @@ def _move_mouse(event: RelEvent) -> None:
149149
_logger.debug(f"Moving {_mouse_gadget} {coordinates}")
150150
_mouse_gadget.move(x, y, mwheel)
151151
except Exception:
152-
_logger.exception(f"Failed moving mouse {_mouse_gadget} {coordinates}")
152+
_logger.exception(f"Failed moving {_mouse_gadget} {coordinates}")
153153

154154

155155
def _send_key(event: KeyEvent) -> None:
156-
device_out = _get_output_device(event)
157-
if device_out is None:
158-
raise RuntimeError("USB gadget not initialized")
159156
key_id, key_name = evdev_to_usb_hid(event)
160157
if key_id is None or key_name is None:
161158
return
159+
device_out = _get_output_device(event)
160+
if device_out is None:
161+
raise RuntimeError("USB gadget not initialized")
162162
try:
163163
if event.keystate == KeyEvent.key_down:
164164
_logger.debug(f"Pressing {key_name} (0x{key_id:02X}) on {device_out}")

0 commit comments

Comments
 (0)