I am trying to build a basic POS System, naturally I would have a usb barcode scanner and a simple code from here to start.

Everything went well from scanning using serial to DB entry and then GUI. But after a reboot, serial doesn't work anymore. It just hangs without releasing the serial output.

What I tried:

-Enable/Disable Serial

-Switching from USB keyboard to serial mode on barcode scanner to make sure it still works

-Switching from hdraws 0 and 2

-Reflashing card with OS clean install of everything

-Used a different pi

-Tried the basic code of just printing the serial output - sudo apt-get install update and upgrade

Help, I dont know anymore whats not working, this is supposed to be basic setup. I think the problem is the serial? or the scanner? I'm out of ideas already.

Also the last error I caught "miraculously" as I waited until it releases an output was an I/O Input/output error. This is why I think it might be the serial?

My setup:


  • Switching from hdraws 0 and 2 why? what does ls /dev/hidraw* output? Apr 16, 2019 at 1:47
  • if a new install (obviously re-doing ALL instructions in the link you provided) and multiple pi's all exhibit the same issue, then the most likely problem is with the scanner - but, does the scanner work on a non-pi in keyboard mode? Apr 16, 2019 at 1:49
  • @JaromandaX about the hdraws, sorry, I searched it up, hdraw0 is made when the usb scanner is plugged in so it was a futile effort for that/ Keyboard mode works on the Pi's and it gets the barcode, correct me if I am wrong but I can't fetch that for use right? Which is why we use serial? it just displays. If there was a way to fetch the barcode read in keyboard mode, then it should fix the problem. But currently I think it should be read as serial isnt it?
    – Firiyuu77
    Apr 16, 2019 at 2:31
  • can't python read keyboard input? though in my opinion, serial mode is the better option - except it doesn't work of course Apr 16, 2019 at 2:32
  • @JaromandaX I think it doesn't as I tried fetching it as a workaround, I tried finding that variable that represent the barcode being printed on the interface, but there's nothing, which means there isn't a variable for me to play around with.
    – Firiyuu77
    Apr 16, 2019 at 2:37

1 Answer 1


after reboot, serial doesn't work. It just hangs without releasing the serial output.

Enable/Disable Serial

Switching from USB keyboard to serial mode on barcode scanner to make sure it still works

problem is the serial? or the scanner? I'm out of ideas already

Well, if you said the barcode reader works OK. Then there are two possibilities:

  1. Rpi serial hardware/software is not OK.

  2. Both Rpi and bard code reader are OK. But they crash.

So first thing first is to make sure your Rpi hardware/software is OK. You might like to read my answers to the questions below suggesting newbies how to do the following checking:

  1. Rpi UART is OK.
  2. Rpi python UART is also OK

After the above two things are OK. Then check Rpi python interface with Arduino, bardcode devices etc.

Serial to Arduino totally non-responsive

Serial Communication from Raspbian using Python to Arduino

  • thanks, I did just the same! figured out the serial wasnt working and was defective when I replaced it it was fine. Takeaway was that to make a basic sample code and if it doesnt work, check the hardware first before debugging code~!
    – Firiyuu77
    Apr 20, 2019 at 11:50
  • @Firiyuu77 I am glad to hear that you solved the problem. Happy barcoding! :)
    – tlfong01
    Apr 20, 2019 at 12:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.