1

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:

mysetup

Firiyuu77
  • 13
  • 3
  • Switching from hdraws 0 and 2 why? what does ls /dev/hidraw* output? – Jaromanda X Apr 16 '19 at 01: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? – Jaromanda X Apr 16 '19 at 01: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 '19 at 02:31
  • can't python read keyboard input? though in my opinion, serial mode is the better option - except it doesn't work of course – Jaromanda X Apr 16 '19 at 02: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 '19 at 02:37
  • so, when scanning in keyboard mode, if you're directly on the pi (not SSH) the bardcode doesn't appear on the command line? – Jaromanda X Apr 16 '19 at 02:39
  • when scanning in keyboard mode, the barcode appears on the commandline. But strangely enough it seemed that the code doesn't have anything related to it, I tried adding flags but they won't display which means that the code maybe had nothing to do with it?. – Firiyuu77 Apr 16 '19 at 02:41

1 Answers1

0

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

tlfong01
  • 4,665
  • 3
  • 10
  • 24
  • 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 '19 at 11:50
  • @Firiyuu77 I am glad to hear that you solved the problem. Happy barcoding! :) – tlfong01 Apr 20 '19 at 12:25