Skip to content

Commit

Permalink
Minor improvements (#102)
Browse files Browse the repository at this point in the history
  • Loading branch information
quaxalber authored Dec 17, 2023
1 parent 3dc9a99 commit 2edbca8
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 7 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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...
Expand Down
2 changes: 1 addition & 1 deletion bluetooth_2_usb.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@


_logger = get_logger()
_VERSION = "0.7.4"
_VERSION = "0.8.0"
_VERSIONED_NAME = f"Bluetooth 2 USB v{_VERSION}"


Expand Down
1 change: 1 addition & 0 deletions src/bluetooth_2_usb/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
8 changes: 4 additions & 4 deletions src/bluetooth_2_usb/relay.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}")
Expand Down

0 comments on commit 2edbca8

Please sign in to comment.