Coder Social home page Coder Social logo

markusressel / barcode-server Goto Github PK

View Code? Open in Web Editor NEW
59.0 59.0 9.0 1.08 MB

A simple daemon to expose USB Barcode Scanner data to other services using Websockets, Webhooks or MQTT.

License: GNU Affero General Public License v3.0

Python 94.91% Dockerfile 1.98% Shell 0.11% Makefile 3.00%
asyncio barcode barcode-events barcode-reader barcode-scanner barcode-server http mqtt mqtt-client python python3 qrcode server websocket websocket-api

barcode-server's Introduction

GitHub Streak

GitHub stats

Top Langs

barcode-server's People

Contributors

dependabot-preview[bot] avatar dependabot[bot] avatar markusressel avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

barcode-server's Issues

Queue events for websocket clients between connections

As mentioned in #27 the websocket event queue could be improved.

  • to be able to remember which client hasn't received which event yet, the client needs to have a unique identifier
  • the identifier can be an arbitrary, url header conforming string (f.ex. my-client-name or dc1f14fc-a7a6-4102-af60-2b6e0dcf744c)
  • the identifier should be client controlled and passed to barcode-server when connecting using a Client-ID header
  • when a new client connects, barcode-server should perform a sanity check whether a client with the given identifier is already connected and, if so, reject the connection
  • if a client disconnects (for whatever reason) and then reconnects, all missed events should be sent to it, one after another
  • clients should have the ability to avoid this and skip/drop missed events when connecting, by passing an (empty) Drop-Event-Queue header upon connecting

An example connection using websocat would look like this:

websocat - autoreconnect:ws://127.0.0.1:9654 --text --header "Client-ID:dc1f14fc-a7a6-4102-af60-2b6e0dcf744c" --header "Drop-Event-Queue:" --header "X-Auth-Token:EmUSqjXGfnQwn5wn6CpzJRZgoazMTRbMNgH7CXwkQG7Ph7stex"

HTTP Post

While a websocket is nice for clients that know about the server, it would also be useful to let the barcode-server make a simple HTTP POST request to a URL defined in the config.

"dead" delay after a scan

To avoid certain mistakes, include a parameter allowing to add a delay (5 seconds for example) after a scan during which a possible duplicate scan would not be interpreted.

Using Docker Container on ARM Device

I am trying to install this on a raspberry pi device running ubuntu arm and have tried on Raspberry os but the docker is failing because it says wrong server type and it wants a regular ubuntu server. How do I get around this limitation.

Thanks

Support having a scanner connected to tablet over bluetooth

This is not a feature request, but rather a question or discussion...
I have a BT barcode scanner and the way I'd like to use it is to have it connected to a tablet in the kitchen, and once it scans a barcode, have that barcode transmitted to barcode-server (running as a docker on my server) to publish to mqtt, which will eventually be consumed by HA and add that item to the Grocy shopping list.

Not sure if barcode-scanner is the right tool to use, even though it looks very well written so I'd like to if it makes sense...

Any ideas?

API: Get list of current devices

Is your feature request related to a problem? Please describe.
Not really, but could be useful.

Describe the solution you'd like
Respond to an incoming messages on /cmd path

Respond to HTTP GET requests on /device path with:

[
  { "name": "BARCODE SCANNER BARCODE SCANNER",
    "path": "/dev/input/event3",
    "vendorId": "ffff",
    "productId": "0035",
  },
]

2D Barcodes (QR-Codes)

I was trying to create a local system scanning the QR-Code of the CovPass App with a USB 1D and 2D Barcode scanner and found your server very useful.
Unfortunately there are (or were) two issues with that:
1- Ubuntu 20.03 LTS the evdev key events for specific characters like "/" are not called KEY_KPSLASH they are called KP_SLASH instead. Due to that I was getting a lot of DEBUG messages like "Unhandled key KP_EQUAL"
2 - The second issue was that my scanner was transmitting some characters like the $ with a SHIFT + 4.
I believe the reason for that is that this server was not designed to read QR-Codes but I might be wrong.
So I edited the keyevent_reader.py and did a quick fix. It is working so I can create a pull request, I am not full time coder so you might be better at this then me...
So here is the Feature request please implement QR-Code readings as well...

Attached is my "fixed" keyevent_reader.py as txt
keyevent_reader.txt
As I mentioned it is not very beautiful :)
Thank you!

Queue barcode event messages per notifier

Is your feature request related to a problem? Please describe.
The MQTT / HTTP / Websocket connection can be lost temporarily due f.ex. network issues, which can result in the loss of barcode events on the client side.

Describe the solution you'd like
Implement an event queue, which stores events temporarily when the connection drops, to be able to resend them when the connection is reestablished.

For the MQTT and HTTP notifiers, a simple (infinite) retry loop should be sufficient.

For websocket clients, events should be queued per client.

Since the queue could become very large over time when the service uptime is really long, events in the queue of individual clients should be automatically dropped when they are older than a specified amount of time. This should default to 2 hours and be user configurable via the YAML config file.

'InputEvent' object has no attribute 'event'

I tried setting up the server with docker but everytime a scan a code i get an error. I tried different /dev/input devices but i get the same error everytime.

barcode    | 2022-01-24 17:03:37,539 - barcode_server - INFO - === barcode-server ===
barcode    | 2022-01-24 17:03:37,539 - barcode_server - INFO - Instance ID: vorratsschrank-1
barcode    | 2022-01-24 17:03:37,550 - barcode_server - INFO - Starting statistics webserver...
barcode    | 2022-01-24 17:03:37,552 - barcode_server.webserver - DEBUG - Starting notifier: mqtt
barcode    | 2022-01-24 17:03:37,553 - barcode_server.webserver - INFO - Starting webserver on 127.0.0.1:9654 ...
barcode    | 2022-01-24 17:03:37,554 - barcode_server.barcode - INFO - Reading: /dev/input/event15: Name: ARM CM0 USB HID Keyboard, Vendor: ffff, Product: 0035
barcode    | 2022-01-24 17:05:33,172 - barcode_server.barcode - ERROR - 'InputEvent' object has no attribute 'event'
barcode    | Traceback (most recent call last):
barcode    |   File "/usr/local/lib/python3.9/site-packages/barcode_server/barcode.py", line 94, in _start_reader
barcode    |     barcode = await self._read_line(input_device)
barcode    |   File "/usr/local/lib/python3.9/site-packages/barcode_server/barcode.py", line 152, in _read_line
barcode    |     result = await loop.run_in_executor(None, self._keyevent_reader.read_line, input_device)
barcode    |   File "/usr/local/lib/python3.9/concurrent/futures/thread.py", line 58, in run
barcode    |     result = self.fn(*self.args, **self.kwargs)
barcode    |   File "/usr/local/lib/python3.9/site-packages/barcode_server/keyevent_reader.py", line 57, in read_line
barcode    |     if isinstance(event, KeyEvent) or event.event.type == 1:
barcode    | AttributeError: 'InputEvent' object has no attribute 'event'
barcode    | 2022-01-24 17:05:33,827 - barcode_server.barcode - INFO - Reading: /dev/input/event15: Name: ARM CM0 USB HID Keyboard, Vendor: ffff, Product: 0035
barcode    | 2022-01-24 17:05:42,220 - barcode_server.barcode - ERROR - 'InputEvent' object has no attribute 'event'
barcode    | Traceback (most recent call last):
barcode    |   File "/usr/local/lib/python3.9/site-packages/barcode_server/barcode.py", line 94, in _start_reader
barcode    |     barcode = await self._read_line(input_device)
barcode    |   File "/usr/local/lib/python3.9/site-packages/barcode_server/barcode.py", line 152, in _read_line
barcode    |     result = await loop.run_in_executor(None, self._keyevent_reader.read_line, input_device)
barcode    |   File "/usr/local/lib/python3.9/concurrent/futures/thread.py", line 58, in run
barcode    |     result = self.fn(*self.args, **self.kwargs)
barcode    |   File "/usr/local/lib/python3.9/site-packages/barcode_server/keyevent_reader.py", line 57, in read_line
barcode    |     if isinstance(event, KeyEvent) or event.event.type == 1:
barcode    | AttributeError: 'InputEvent' object has no attribute 'event'
barcode    | 2022-01-24 17:05:42,848 - barcode_server.barcode - INFO - Reading: /dev/input/event15: Name: ARM CM0 USB HID Keyboard, Vendor: ffff, Product: 0035

My docker compose file:

version: '2.2'
services:
  barcode:
    image: markusressel/barcode-server:v2.2.0
    restart: always
    container_name: barcode
    volumes:
      - ./config/barcode_server.yml:/app/barcode_server.yaml
    devices:
     - "/dev/input/by-id/usb-ARM_CM0_USB_HID_Keyboard_8A2D1FD80F03-event-kbd:/dev/input/by-id/usb-ARM_CM0_USB_HID_Keyboard_8A2D1FD80F03-event-kbd"
     - "/dev/input/event15:/dev/input/event15"
    environment:
     - PUID=0
     - PGID=0
    ports:
      - "9655:8000"
      - "9654:9654"

And my config device_path looks like this:

   ...
  device_paths:
    - "/dev/input/event15"
   ....

MQTT Publish

MQTT seems like a perfect match for this use case.
Would need some configuration options for encryption and client_id etc.

Systemd service

Hi!

This is awesome tool. Is it possible to run this in ubuntu systemd service? I want it to run automatically when PC reboots.

'InputEvent' object has no attribute 'keystate'

I tried setting up the server v2.2.1 via the native method. After adding the udev rules the usbscanner was detected.
Scanning a code results in the following error:

2022-01-28 23:09:47,601 - barcode_server - INFO - === barcode-server ===
2022-01-28 23:09:47,602 - barcode_server - INFO - Instance ID: cash-register-1
2022-01-28 23:09:47,623 - barcode_server - INFO - Starting statistics webserver...
2022-01-28 23:09:47,625 - barcode_server.webserver - DEBUG - Starting notifier: http
2022-01-28 23:09:47,625 - barcode_server.webserver - DEBUG - Starting notifier: mqtt
2022-01-28 23:09:47,625 - barcode_server.webserver - INFO - Starting webserver on 127.0.0.1:9654 ...
2022-01-28 23:09:47,631 - barcode_server.barcode - INFO - Reading: /dev/input/event21: Name: Manufacturer Barcode Read
er, Vendor: e851, Product: 1000
2022-01-28 23:09:49,635 - barcode_server.barcode - ERROR - 'InputEvent' object has no attribute 'keystate'
Traceback (most recent call last):
  File "myfolder/barcode-server/venv/lib/python3.8/site-packages/barcode_server/barcode.py", line 94,
 in _start_reader
    barcode = await self._read_line(input_device)
  File "myfolder/barcode-server/venv/lib/python3.8/site-packages/barcode_server/barcode.py", line 152
, in _read_line
    result = await loop.run_in_executor(None, self._keyevent_reader.read_line, input_device)
  File "/usr/lib/python3.8/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "myfolder/barcode-server/venv/lib/python3.8/site-packages/barcode_server/keyevent_reader.py", 
line 60, in read_line
    event.keystate = event.event.keystate
AttributeError: 'InputEvent' object has no attribute 'keystate'
2022-01-28 23:09:49,680 - barcode_server.barcode - INFO - Reading: /dev/input/event21: Name: Manufacturer Barcode Read
er, Vendor: e851, Product: 1000
2022-01-28 23:09:49,683 - barcode_server.barcode - ERROR - 'InputEvent' object has no attribute 'keystate'
Traceback (most recent call last):
  File "myfolder/barcode-server/venv/lib/python3.8/site-packages/barcode_server/barcode.py", line 94,
 in _start_reader
    barcode = await self._read_line(input_device)
  File "myfolder/barcode-server/venv/lib/python3.8/site-packages/barcode_server/barcode.py", line 152
, in _read_line
    result = await loop.run_in_executor(None, self._keyevent_reader.read_line, input_device)
  File "/usr/lib/python3.8/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "myfolder/barcode-server/venv/lib/python3.8/site-packages/barcode_server/keyevent_reader.py", 
line 60, in read_line
    event.keystate = event.event.keystate
AttributeError: 'InputEvent' object has no attribute 'keystate'
2022-01-28 23:09:50,693 - barcode_server.barcode - INFO - Reading: /dev/input/event21: Name: Manufacturer Barcode Read
er, Vendor: e851, Product: 1000
^C2022-01-28 23:09:53,556 - barcode_server.cli - INFO - Exiting...

It seems the input device event object is missing the 'keystate' attribute.

Going back to version 2.0.0 is able to detect the code but gives a different error:

2022-01-28 23:01:50,138 - barcode_server.cli - INFO - Starting statistics webserver...
2022-01-28 23:01:50,139 - barcode_server.webserver - DEBUG - Starting notifier: http
2022-01-28 23:01:50,139 - barcode_server.webserver - DEBUG - Starting notifier: mqtt
2022-01-28 23:01:50,139 - barcode_server.webserver - INFO - Starting webserver on 127.0.0.1:9654 ...
2022-01-28 23:01:50,146 - barcode_server.barcode - INFO - Reading: /dev/input/event21: Name: Manufacturer Barcode Reader, Vendor: e851, Product: 1000
2022-01-28 23:01:53,158 - barcode_server.keyevent_reader - DEBUG - key event at 1643407313.157973, 10 (KEY_9), down
2022-01-28 23:01:53,166 - barcode_server.keyevent_reader - DEBUG - key event at 1643407313.166009, 10 (KEY_9), up
2022-01-28 23:01:53,166 - barcode_server.keyevent_reader - DEBUG - key event at 1643407313.166009, 8 (KEY_7), down
2022-01-28 23:01:53,174 - barcode_server.keyevent_reader - DEBUG - key event at 1643407313.173921, 8 (KEY_7), up
2022-01-28 23:01:53,174 - barcode_server.keyevent_reader - DEBUG - key event at 1643407313.173921, 9 (KEY_8), down
2022-01-28 23:01:53,181 - barcode_server.keyevent_reader - DEBUG - key event at 1643407313.181903, 9 (KEY_8), up
2022-01-28 23:01:53,182 - barcode_server.keyevent_reader - DEBUG - key event at 1643407313.181903, 10 (KEY_9), down
2022-01-28 23:01:53,190 - barcode_server.keyevent_reader - DEBUG - key event at 1643407313.189930, 10 (KEY_9), up
2022-01-28 23:01:53,190 - barcode_server.keyevent_reader - DEBUG - key event at 1643407313.189930, 5 (KEY_4), down
2022-01-28 23:01:53,198 - barcode_server.keyevent_reader - DEBUG - key event at 1643407313.197941, 5 (KEY_4), up
2022-01-28 23:01:53,198 - barcode_server.keyevent_reader - DEBUG - key event at 1643407313.197941, 7 (KEY_6), down
2022-01-28 23:01:53,207 - barcode_server.keyevent_reader - DEBUG - key event at 1643407313.206992, 7 (KEY_6), up
2022-01-28 23:01:53,208 - barcode_server.keyevent_reader - DEBUG - key event at 1643407313.206992, 3 (KEY_2), down
2022-01-28 23:01:53,215 - barcode_server.keyevent_reader - DEBUG - key event at 1643407313.215003, 3 (KEY_2), up
2022-01-28 23:01:53,216 - barcode_server.keyevent_reader - DEBUG - key event at 1643407313.215003, 10 (KEY_9), down
2022-01-28 23:01:53,223 - barcode_server.keyevent_reader - DEBUG - key event at 1643407313.222966, 10 (KEY_9), up
2022-01-28 23:01:53,223 - barcode_server.keyevent_reader - DEBUG - key event at 1643407313.222966, 9 (KEY_8), down
2022-01-28 23:01:53,231 - barcode_server.keyevent_reader - DEBUG - key event at 1643407313.230930, 9 (KEY_8), up
2022-01-28 23:01:53,231 - barcode_server.keyevent_reader - DEBUG - key event at 1643407313.230930, 5 (KEY_4), down
2022-01-28 23:01:53,239 - barcode_server.keyevent_reader - DEBUG - key event at 1643407313.238904, 5 (KEY_4), up
2022-01-28 23:01:53,239 - barcode_server.keyevent_reader - DEBUG - key event at 1643407313.238904, 2 (KEY_1), down
2022-01-28 23:01:53,247 - barcode_server.keyevent_reader - DEBUG - key event at 1643407313.246976, 2 (KEY_1), up
2022-01-28 23:01:53,247 - barcode_server.keyevent_reader - DEBUG - key event at 1643407313.246976, 5 (KEY_4), down
2022-01-28 23:01:53,255 - barcode_server.keyevent_reader - DEBUG - key event at 1643407313.254961, 5 (KEY_4), up
2022-01-28 23:01:53,255 - barcode_server.keyevent_reader - DEBUG - key event at 1643407313.254961, 2 (KEY_1), down
2022-01-28 23:01:53,264 - barcode_server.keyevent_reader - DEBUG - key event at 1643407313.263919, 2 (KEY_1), up
2022-01-28 23:01:53,264 - barcode_server.keyevent_reader - DEBUG - key event at 1643407313.263919, 28 (KEY_ENTER), down
2022-01-28 23:01:53,272 - barcode_server.keyevent_reader - DEBUG - key event at 1643407313.272001, 28 (KEY_ENTER), up
2022-01-28 23:01:53,273 - barcode_server.barcode - INFO - Manufacturer Barcode Reader (/dev/input/event21): 9789462984141
2022-01-28 23:01:53,387 - barcode_server.notifier - ERROR - [Errno -2] Name or service not known
Traceback (most recent call last):
  File "myfolder/barcode-server-2.0.0/venv/lib/python3.8/site-packages/asyncio_mqtt-0.9.1-py3.8.egg/asyncio_mqtt/client.py", line 173, in connect
    await loop.run_in_executor(
  File "/usr/lib/python3.8/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "myfolder/barcode-server-2.0.0/venv/lib/python3.8/site-packages/paho_mqtt-1.5.1-py3.8.egg/paho/mqtt/client.py", line 941, in connect
    return self.reconnect()
  File "myfolder/barcode-server-2.0.0/venv/lib/python3.8/site-packages/paho_mqtt-1.5.1-py3.8.egg/paho/mqtt/client.py", line 1075, in reconnect
    sock = self._create_socket_connection()
  File "myfolder/barcode-server-2.0.0/venv/lib/python3.8/site-packages/paho_mqtt-1.5.1-py3.8.egg/paho/mqtt/client.py", line 3546, in _create_socket_connection
    return socket.create_connection(addr, source_address=source, timeout=self._keepalive)
  File "/usr/lib/python3.8/socket.py", line 787, in create_connection
    for res in getaddrinfo(host, port, 0, SOCK_STREAM):
  File "/usr/lib/python3.8/socket.py", line 918, in getaddrinfo
    for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno -2] Name or service not known

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "myfolder/barcode-server-2.0.0/venv/lib/python3.8/site-packages/barcode_server-2.0.0-py3.8.egg/barcode_server/notifier/__init__.py", line 81, in event_processor
    await self._send_event(event)
  File "myfolder/barcode-server-2.0.0/venv/lib/python3.8/site-packages/prometheus_async-19.2.0-py3.8.egg/prometheus_async/aio/_decorators.py", line 42, in time_decorator
    rv = await wrapped(*args, **kw)
  File "myfolder/barcode-server-2.0.0/venv/lib/python3.8/site-packages/barcode_server-2.0.0-py3.8.egg/barcode_server/notifier/mqtt.py", line 34, in _send_event
    async with Client(hostname=self.host, port=self.port,
  File "myfolder/barcode-server-2.0.0/venv/lib/python3.8/site-packages/asyncio_mqtt-0.9.1-py3.8.egg/asyncio_mqtt/client.py", line 512, in __aenter__
    await self.connect()
  File "myfolder/barcode-server-2.0.0/venv/lib/python3.8/site-packages/asyncio_mqtt-0.9.1-py3.8.egg/asyncio_mqtt/client.py", line 184, in connect
    raise MqttError(str(error))
asyncio_mqtt.error.MqttError: [Errno -2] Name or service not known
2022-01-28 23:01:54,022 - barcode_server.notifier.http - DEBUG - Notified http://dummy.restapiexample.com/api/v1/create: 9789462984141
2022-01-28 23:01:55,496 - barcode_server.notifier - ERROR - [Errno -2] Name or service not known
Traceback (most recent call last):
  File "myfolder/barcode-server-2.0.0/venv/lib/python3.8/site-packages/asyncio_mqtt-0.9.1-py3.8.egg/asyncio_mqtt/client.py", line 173, in connect
    await loop.run_in_executor(
  File "/usr/lib/python3.8/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "myfolder/barcode-server-2.0.0/venv/lib/python3.8/site-packages/paho_mqtt-1.5.1-py3.8.egg/paho/mqtt/client.py", line 941, in connect
    return self.reconnect()
  File "myfolder/barcode-server-2.0.0/venv/lib/python3.8/site-packages/paho_mqtt-1.5.1-py3.8.egg/paho/mqtt/client.py", line 1075, in reconnect
    sock = self._create_socket_connection()
  File "myfolder/barcode-server-2.0.0/venv/lib/python3.8/site-packages/paho_mqtt-1.5.1-py3.8.egg/paho/mqtt/client.py", line 3546, in _create_socket_connection
    return socket.create_connection(addr, source_address=source, timeout=self._keepalive)
  File "/usr/lib/python3.8/socket.py", line 787, in create_connection
    for res in getaddrinfo(host, port, 0, SOCK_STREAM):
  File "/usr/lib/python3.8/socket.py", line 918, in getaddrinfo
    for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno -2] Name or service not known

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "myfolder/barcode-server-2.0.0/venv/lib/python3.8/site-packages/barcode_server-2.0.0-py3.8.egg/barcode_server/notifier/__init__.py", line 81, in event_processor
    await self._send_event(event)
  File "myfolder/barcode-server-2.0.0/venv/lib/python3.8/site-packages/prometheus_async-19.2.0-py3.8.egg/prometheus_async/aio/_decorators.py", line 42, in time_decorator
    rv = await wrapped(*args, **kw)
  File "myfolder/barcode-server-2.0.0/venv/lib/python3.8/site-packages/barcode_server-2.0.0-py3.8.egg/barcode_server/notifier/mqtt.py", line 34, in _send_event
    async with Client(hostname=self.host, port=self.port,
  File "myfolder/barcode-server-2.0.0/venv/lib/python3.8/site-packages/asyncio_mqtt-0.9.1-py3.8.egg/asyncio_mqtt/client.py", line 512, in __aenter__
    await self.connect()
  File "myfolder/barcode-server-2.0.0/venv/lib/python3.8/site-packages/asyncio_mqtt-0.9.1-py3.8.egg/asyncio_mqtt/client.py", line 184, in connect
    raise MqttError(str(error))
asyncio_mqtt.error.MqttError: [Errno -2] Name or service not known
^C2022-01-28 23:01:56,942 - barcode_server.cli - INFO - Exiting...

Any suggestions?

More statistics metrics

  • Time measurement of
    • device detection
    • http request
    • mqtt publish
    • rest endpoints
  • Count
    • device detections
    • http requests
    • mqtt publishs
    • rest endpoints

Illegal instruction

Describe the bug
I get an Illegal instruction and then the server closes.

Expected behavior
Pushing to MQTT server. I have a Mosquitto broker running in Home Assistant and want to get the scanned barcode there to trigger an event.

Screenshots

gielk@barcodescanner:~ $ ./venv/bin/barcode-server run
2023-04-26 20:18:16,683 - barcode_server - INFO - === barcode-server ===
2023-04-26 20:18:16,685 - barcode_server - INFO - Instance ID: koelkast-scanner
2023-04-26 20:18:17,119 - barcode_server - INFO - Starting statistics webserver...
2023-04-26 20:18:17,168 - barcode_server.webserver - DEBUG - Starting notifier: mqtt
2023-04-26 20:18:17,170 - barcode_server.webserver - INFO - Starting webserver on 127.0.0.1:9654 ...
2023-04-26 20:18:17,216 - barcode_server.barcode - INFO - Reading: /dev/input/event1: Name: Metrologic Metrologic Scanner, Vendor: 0c2e, Product: 0200
2023-04-26 20:18:21,538 - barcode_server.barcode - INFO - Metrologic Metrologic Scanner (/dev/input/event1): 4056489340591
Illegal instruction

This is the config.

barcode_server:

  # (optional) the verbosity level of log output
  log_level: DEBUG

  # (optional) an identifier for this barcode-server instance
  # if omitted, this will be a UUIDv4
  id: koelkast-scanner

  # (optional) MQTT push configuration
  mqtt:
    # MQTT server host address
    host: "192.168.178.84"
    # (optional) MQTT server port
    port: 1883
    # (optional) Client ID of this barcode-server instance to provide to the MQTT server
    client_id: "barcode-server"
    # MQTT topic to push events to
    topic: "barcode-server/barcode"
    # Username to use when connecting to the MQTT server
    user: "mqtt"
    # Password to use when connecting to the MQTT server
    password: "_********_"
    # (optional) QoS value of event messages
    qos: 2
    # (optional) Whether to instruct the MQTT server to remember event messages between restarts (of the MQTT server)
    retain: True

  # A list of regex patterns to match USB device names against
  devices:
    - ".*Barcode.*"
    - ".*Scanner.*"
  # A list of absolute file paths to devices
  device_paths:
  #- "/dev/input/barcode_scanner"

Desktop (please complete the following information):
Raspberry Pi zero w
Raspberry Pi os 32 bit

Installation process failed

I followed the How To Use procedures and used the native method in README.md file.
but is getting this error:

Traceback (most recent call last):
  File "./venv/bin/barcode-server", line 8, in <module>
    sys.exit(cli())
  File "/home/deploy/monopass/venv/lib/python3.8/site-packages/click/core.py", line 829, in __call__
    return self.main(*args, **kwargs)
  File "/home/deploy/monopass/venv/lib/python3.8/site-packages/click/core.py", line 782, in main
    rv = self.invoke(ctx)
  File "/home/deploy/monopass/venv/lib/python3.8/site-packages/click/core.py", line 1259, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/deploy/monopass/venv/lib/python3.8/site-packages/click/core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/deploy/monopass/venv/lib/python3.8/site-packages/click/core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "/home/deploy/monopass/venv/lib/python3.8/site-packages/barcode_server/cli.py", line 84, in c_run
    config = AppConfig()
  File "/home/deploy/monopass/venv/lib/python3.8/site-packages/barcode_server/config.py", line 44, in __new__
    return super(AppConfig, cls).__new__(cls, data_sources=data_sources)
  File "/home/deploy/monopass/venv/lib/python3.8/site-packages/container_app_conf/__init__.py", line 86, in __new__
    self.load_config(validate)
  File "/home/deploy/monopass/venv/lib/python3.8/site-packages/container_app_conf/__init__.py", line 101, in load_config
    self.validate()
  File "/home/deploy/monopass/venv/lib/python3.8/site-packages/barcode_server/config.py", line 236, in validate
    super(AppConfig, self).validate()
  File "/home/deploy/monopass/venv/lib/python3.8/site-packages/container_app_conf/__init__.py", line 109, in validate
    entry.value = entry.value
  File "/home/deploy/monopass/venv/lib/python3.8/site-packages/container_app_conf/entry/__init__.py", line 85, in value
    self._value = self._parse_value(new_value)
  File "/home/deploy/monopass/venv/lib/python3.8/site-packages/container_app_conf/entry/__init__.py", line 97, in _parse_value
    self._raise_invalid_value(value, "Value is required")
  File "/home/deploy/monopass/venv/lib/python3.8/site-packages/container_app_conf/entry/__init__.py", line 137, in _raise_invalid_value
    raise ValueError(message)
ValueError: Invalid value 'None' for config option `barcode_server>server>api_token`: Value is required

Are there any steps I missed?

evdev failed to install

`
Running setup.py install for evdev ... error
error: subprocess-exited-with-error

× Running setup.py install for evdev did not run successfully.
│ exit code: 1
╰─> [31 lines of output]
running install
/home/inventree/venv/lib/python3.10/site-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
warnings.warn(
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.10
creating build/lib.linux-x86_64-3.10/evdev
copying evdev/evtest.py -> build/lib.linux-x86_64-3.10/evdev
copying evdev/eventio.py -> build/lib.linux-x86_64-3.10/evdev
copying evdev/genecodes.py -> build/lib.linux-x86_64-3.10/evdev
copying evdev/util.py -> build/lib.linux-x86_64-3.10/evdev
copying evdev/eventio_async.py -> build/lib.linux-x86_64-3.10/evdev
copying evdev/events.py -> build/lib.linux-x86_64-3.10/evdev
copying evdev/uinput.py -> build/lib.linux-x86_64-3.10/evdev
copying evdev/ff.py -> build/lib.linux-x86_64-3.10/evdev
copying evdev/init.py -> build/lib.linux-x86_64-3.10/evdev
copying evdev/ecodes.py -> build/lib.linux-x86_64-3.10/evdev
copying evdev/device.py -> build/lib.linux-x86_64-3.10/evdev
running build_ext
running build_ecodes
writing ecodes.c (using /usr/include/linux/input.h /usr/include/linux/input-event-codes.h /usr/include/linux/uinput.h)
building 'evdev._input' extension
creating build/temp.linux-x86_64-3.10
creating build/temp.linux-x86_64-3.10/evdev
x86_64-linux-gnu-gcc -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/home/inventree/venv/include -I/usr/include/python3.10 -c evdev/input.c -o build/temp.linux-x86_64-3.10/evdev/input.o -std=c99 -Wno-error=declaration-after-statement
evdev/input.c:10:10: fatal error: Python.h: No such file or directory
10 | #include <Python.h>
| ^~~~~~~~~~
compilation terminated.
error: command '/usr/bin/x86_64-linux-gnu-gcc' failed with exit code 1
[end of output]

note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure
`

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.