Skip to content

Commit

Permalink
Removed any reference to the micropy
Browse files Browse the repository at this point in the history
  • Loading branch information
ddetommaso committed Jul 13, 2021
1 parent e0726ed commit cd6df61
Show file tree
Hide file tree
Showing 10 changed files with 28 additions and 59 deletions.
16 changes: 6 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,24 +17,20 @@ Client-server architecture for sharing evdev events in a network using ZeroMQ.

In order to test latency of the ZeroMQ client-server please execute:

$ docker-compose -f apps/test_latency.yml up
$ docker-compose -f test_latency.yml up

## Local events

In order to test the visibility of events using pure evdev.read_loop() please execute:
In order to test the correct reception of evdev raw events please type the following:

$ docker-compose -f apps/pyboard_inputs.yml up
$ docker-compose -f input_loop.yml up

This requires either a device `/dev/input/hidman0` linked to a chosen MicroPython board,
or a MicroPython device identifiable by name as `/dev/input/event*`
This requires an evdev device chosen among the ones in '/dev/input/event*'. You can select your preferred device in the .env file in hidman/apps

## Client-server

In order to test client and server in two docker containers please execute:

$ docker-compose -f apps/pyboard_client_server.yml up

This requires either a device `/dev/input/hidman0` linked to a chosen MicroPython board,
or a MicroPython device identifiable by name as `/dev/input/event*`

$ docker-compose -f client_server.yml up

In this example the client waits for an event by calling waitEvent() remotely on the server.
2 changes: 1 addition & 1 deletion apps/.env
Original file line number Diff line number Diff line change
@@ -1 +1 @@
HIDMAN_DEVICE=/dev/input/by-id/usb-MicroPython_Pyboard_Virtual_Comm_Port_in_FS_Mode_3354375B3037-event-kbd
HIDMAN_DEVICE=/dev/input/event7
4 changes: 2 additions & 2 deletions apps/pyboard_client_server.yml → apps/client_server.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ services:

hidman-server:
<<: *hidman-base
command: python3 /usr/local/src/hidman/apps/python-examples/pyboard_server.py
command: python3 /usr/local/src/hidman/apps/python-examples/server.py
devices:
- ${HIDMAN_DEVICE}:/dev/input/hidman0

hidman-client:
<<: *hidman-base
command: python3 /usr/local/src/hidman/apps/python-examples/pyboard_client.py
command: python3 /usr/local/src/hidman/apps/python-examples/client.py
depends_on:
- hidman-server
4 changes: 2 additions & 2 deletions apps/pyboard_inputs.yml → apps/input_loop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ version: '3.7'

services:

pyboard-inputs:
evdev-inputs:
image: iitschri/hidman:latest

command: python3 /usr/local/src/hidman/apps/python-examples/pyboard_loop.py
command: python3 /usr/local/src/hidman/apps/python-examples/loop.py

devices:
- ${HIDMAN_DEVICE}:/dev/input/hidman0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
dev = HIDClient(address="tcp://localhost:6666")

while True:
print(dev.waitKeyPress())
print(dev.waitEvent())
9 changes: 9 additions & 0 deletions apps/python-examples/loop.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import asyncio
import evdev

from evdev import InputDevice, categorize, ecodes

selected_device = evdev.InputDevice('/dev/input/hidman0')
print("Listening input events from {}".format(selected_device))
for event in selected_device.read_loop():
print(evdev.categorize(event))
28 changes: 0 additions & 28 deletions apps/python-examples/pyboard_loop.py

This file was deleted.

14 changes: 0 additions & 14 deletions apps/python-examples/pyboard_server.py

This file was deleted.

6 changes: 6 additions & 0 deletions apps/python-examples/server.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
from hidman.core import HIDServer
import evdev

selected_device = evdev.InputDevice('/dev/input/hidman0')
serv = HIDServer(device=selected_device, address="tcp://*:6666")
serv.run()
2 changes: 1 addition & 1 deletion hidman/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
__authors__ = 'Davide De Tommaso'
__emails__ = '[email protected]'
__license__ = 'MIT'
__version__ = '0.1'
__version__ = '0.2'
__description__ = 'A Python based HID (Human Interface Device) events manager'
__requirements__ = ['pytest>=6.2.4', 'evdev>=1.4.0', 'pyzmq>=22.1.0']

0 comments on commit cd6df61

Please sign in to comment.