Skip to content

Commit

Permalink
Merge pull request #28 from quaxalber/development
Browse files Browse the repository at this point in the history
 Fix working dir retrieval
  • Loading branch information
quaxalber authored Oct 12, 2023
2 parents f02261c + d54f793 commit d99db09
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ Follow these steps to install and configure the project:
└─4256 python3.11 /usr/bin/bluetooth_2_usb.py -k /dev/input/event2 -m /dev/input/event3

Oct 11 18:00:58 raspberrypi systemd[1]: Started Bluetooth to USB HID proxy.
Oct 11 18:00:58 raspberrypi python3.11[4256]: 23-10-11 18:00:58 [INFO] Launching Bluetooth 2 USB v0.3.0
Oct 11 18:00:58 raspberrypi python3.11[4256]: 23-10-11 18:00:58 [INFO] Launching Bluetooth 2 USB v0.3.2
Oct 11 18:01:01 raspberrypi python3.11[4256]: 23-10-11 18:01:01 [INFO] Starting event loop for AceRK Keyboard: [device /dev/input/event2, name "AceRK Keyboard", phys "0a:1b:2c:3d:4e:5f"] >> [Keyboard gadget (/dev/hidg1) + Consumer control gadget (/dev/hidg2)]
Oct 11 18:01:01 raspberrypi python3.11[4256]: 23-10-11 18:01:01 [INFO] Starting event loop for AceRK Mouse: [device /dev/input/event3, name "AceRK Mouse", phys "0a:1b:2c:3d:4e:5f"] >> [Boot mouse gadget (/dev/hidg0)]
```
Expand Down Expand Up @@ -378,7 +378,7 @@ Here's a few things you could try:
user@raspberrypi:~/bluetooth_2_usb $ sudo python3.11 bluetooth_2_usb.py -k /dev/input/event2 -m /dev/input/event3 -d
23-10-11 17:53:19 [DEBUG] CLI args: Namespace(keyboards=['/dev/input/event2'], mice=['/dev/input/event3'], sandbox=False, debug=True, log_to_file=False, log_path='/var/log/bluetooth_2_usb/bluetooth_2_usb.log', version=False)
23-10-11 17:53:19 [DEBUG] Logging to stdout
23-10-11 17:53:19 [INFO] Launching Bluetooth 2 USB v0.3.0
23-10-11 17:53:19 [INFO] Launching Bluetooth 2 USB v0.3.2
23-10-11 17:53:19 [DEBUG] Available output devices: [Boot mouse gadget (/dev/hidg0), Keyboard gadget (/dev/hidg1), Consumer control gadget (/dev/hidg2)]
23-10-11 17:53:22 [DEBUG] Sandbox mode disabled. All output devices activated.
23-10-11 17:53:22 [DEBUG] Registered device link: [AceRK Keyboard]>>[/dev/hidg1+/dev/hidg2]
Expand Down
4 changes: 2 additions & 2 deletions bluetooth_2_usb.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"Adafruit_CircuitPython_HID",
"python-evdev",
]
working_dir = os.getcwd()
working_dir = sys.path[0]
for module in required_submodules:
module_path = os.path.join(working_dir, "submodules", module)
sys.path.append(module_path)
Expand All @@ -40,7 +40,7 @@
import lib.evdev_adapter as evdev_adapter
import lib.logger

_VERSION = "0.3.1"
_VERSION = "0.3.2"
_VERSIONED_NAME = f"Bluetooth 2 USB v{_VERSION}"

logger = lib.logger.get_logger()
Expand Down
4 changes: 2 additions & 2 deletions lib/evdev_adapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -253,11 +253,11 @@ def is_key_event(event: InputEvent) -> bool:


def is_key_up(event: InputEvent) -> bool:
return event.type == ecodes.EV_KEY and event.value == KeyEvent.key_up
return is_key_event(event) and event.value == KeyEvent.key_up


def is_key_down(event: InputEvent) -> bool:
return event.type == ecodes.EV_KEY and event.value == KeyEvent.key_down
return is_key_event(event) and event.value == KeyEvent.key_down


def is_mouse_movement(event: InputEvent) -> bool:
Expand Down

0 comments on commit d99db09

Please sign in to comment.