0

Can anyone help me figure out how to use evdev python module? I have a usb card scanner that I want to use to scan a card and make a raspberry pi play some music file through Kodi media player. I can scan the card and get the info from it but since this card reader is recognized as a keyboard it also sends key presses to kodi. Is there a way to force python to only read the card number that is encoded on the cards and not send an extra enter key press at the end?

At the moment when I scan a card in an open text file editor like kate for example it look as follows:

0009817066
newline with nothing on it (sorry I have no idea how to input an empty line in this view)

The new line is actually an enter key press that does all sorts of bad behaviour in kodi (depending on the screen you are on it will press random buttons) also it messes up my python code behavior.

So the question is: can I tell the reader using evdev module to only read the number and not the EOL character?

Not sure if I am making much sense, so if you have any questions please ask them.

lucian
  • 350
  • 4
  • 18
  • Usually you can configure your card scanners and other readers so they don't send newline. If you can manipulate string coming from your reader before it reach kodi it's easy to strip that string. But most likely that is not the case. – ex4 Apr 26 '20 at 08:46
  • yes that is what I would like but I have no idea how to do it! – lucian Apr 26 '20 at 09:12

0 Answers0