CORE-POS / IS4C

Cooperative Operational Retail Environment
http://www.core-pos.com
GNU General Public License v2.0
64 stars 43 forks source link

USB based scanner/scales #957

Open scannerdarkly opened 6 years ago

scannerdarkly commented 6 years ago

I’m looking at potential new CORE-POS lane installations, and I’m perusing the supported hardware list. Is anyone currently using a scanner/scale over USB? (George Street Co-op uses RS-232 with the venerable Magellan SL-384s.)

gohanman commented 6 years ago

Not that I've heard of. Some USB-RS232 adapters but that's not quite the same thing.

Much of the USB POS hardware I've seen comes with a driver that will create a fake COM port so software can still communicate as if it were an RS-232 device. Datalogic has one for their 9xxx series scales. The hardware makers typically only provide Windows drivers. How easy or hard it is to get these devices working on other platforms probably varies from device to device.

joelbrock commented 6 years ago

I've had some good luck using Serial-->USB adapters on production CORE-POS/IS4C lanes. Both dongle and PCI cards. Primarily on debian (or derivative) lanes. For the most part these have been plug'n'play. But I have come across one or two that were not dead simple to set up.

gohanman commented 6 years ago

Sure. I think that's the comparatively easier situation - device itself is serial and the adapter just has to present it to the OS as serial. If the device is USB and a Windows driver is making it appear as serial device it's hard to say what kind of internal translation the driver is doing or what I/O will look like if you remove the driver and interact with the device directly.

On Thu, Jan 4, 2018 at 6:26 PM, joel brock notifications@github.com wrote:

I've had some good luck using Serial-->USB adapters on production CORE-POS/IS4C lanes. Both dongle and PCI cards. Primarily on debian (or derivative) lanes. For the most part these have been plug'n'play. But I have come across one or two that were not dead simple to set up.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/CORE-POS/IS4C/issues/957#issuecomment-355439052, or mute the thread https://github.com/notifications/unsubscribe-auth/AAaD1mdaET70-CLJxbh7UCJrVFecIR7Nks5tHWw-gaJpZM4RTyBF .

scannerdarkly commented 6 years ago

@joelbrock, are you using USB devices and hooking them up to the lane’s RS-232 port? Or the opposite? What devices are you hooking up this way?

joelbrock commented 6 years ago

In all cases i'm referring to using RS-232 scannerscales and connecting them to a PC without an onboard RS-232 port. Besides handheld scanners, i've never worked with a scannerscale that has USB coming out of it. I've used the serial-to-USB adapter approach mainly on SL384s, 8100s, and 8400s

scannerdarkly commented 6 years ago

Okay, good to know. I see references to “IBM USB” in those scanner/scale manuals, and I always wonder what strange secrets may lurk therein.

scannerdarkly commented 5 years ago

Any recommendations for the best inline (non-PCI) serial-to-USB adapters, especially under Debian/Ubuntu? (Also, any specific ones to avoid?)

Also, does anyone have experience where a serial-to-USB adapter worked with a receipt printer, but not a scanner/scale — OR vice versa?

Asking @joelbrock especially, but welcoming all advice!

joelbrock commented 5 years ago

Something like this should work.

For USB printers, I generally swap out the interface board for a USB. Or buy new w/ USB interface. Never used a serial-based printer before. Ever. Though I have had good luck using parallel to USB adapters. Those seem to work near-universally. Whereas the serial-to-USB were only a little more finicky.

scannerdarkly commented 5 years ago

@joelbrock, does CORE-POS on Linux support USB receipt printers natively? Or does it think they're serial and writes to them at ttyS*?

gohanman commented 5 years ago

They typically show up as /dev/lp0 or /dev/usb/lp0 in my experience. Generally you can just write to the device file the same way as parallel.

In a sense it’s not CORE that supports them natively so much as it’s Linux

On Jan 16, 2019, at 3:33 PM, John Leary notifications@github.com wrote:

@joelbrock, does CORE-POS on Linux support USB receipt printers natively? Or does it think they're serial and writes to them at ttyS*?

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub, or mute the thread.

scannerdarkly commented 5 years ago

That makes sense — I wasn't sure if the API was the same!

scannerdarkly commented 5 years ago

Okay, I got one of these adapters, and it shows up at /dev/ttyUSB0, but cating text to that port (with TM-T88II receipt printer attached) seems to have no effect at all. I'm not sure what troubleshooting steps to take here, but here's the lsusb output at least. Any ideas?

# uname -a
Linux lane2 4.4.0-141-generic #167-Ubuntu SMP Wed Dec 5 10:38:08 UTC 2018 i686 i686 i686 GNU/Linux

# lsusb -v -s6:2

Bus 006 Device 002: ID 1a86:7523 QinHeng Electronics HL-340 USB-Serial adapter
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               1.10
  bDeviceClass          255 Vendor Specific Class
  bDeviceSubClass         0 
  bDeviceProtocol         0 
  bMaxPacketSize0         8
  idVendor           0x1a86 QinHeng Electronics
  idProduct          0x7523 HL-340 USB-Serial adapter
  bcdDevice            2.54
  iManufacturer           0 
  iProduct                2 USB2.0-Ser!
  iSerial                 0 
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength           39
    bNumInterfaces          1
    bConfigurationValue     1
    iConfiguration          0 
    bmAttributes         0x80
      (Bus Powered)
    MaxPower               96mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           3
      bInterfaceClass       255 Vendor Specific Class
      bInterfaceSubClass      1 
      bInterfaceProtocol      2 
      iInterface              0 
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x82  EP 2 IN
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0020  1x 32 bytes
        bInterval               0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x02  EP 2 OUT
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0020  1x 32 bytes
        bInterval               0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x81  EP 1 IN
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0008  1x 8 bytes
        bInterval               1
Device Status:     0x0000
  (Bus Powered)
joelbrock commented 5 years ago

I would expect that setting the scannerscale port in CORE-POS to /dev/ttyUSB0 should just work. So, depending on your version of CORE, this would mean updating scale-drivers/drivers/NewMagellan/ports.conf, or the Hardware tab of the CORE-Lane Installer GUI, or ini.json.

Check the BIOS h/w config too, sometimes the serial ports need to be enabled there.

Also, what port is the USB printer getting? I'd guess something like /dev/lp0 or /dev/usb/lp0, but I'd want to make sure it's not conflicting with the scannerscale adapter.

scannerdarkly commented 5 years ago

On our system (version 2.7 on Ubuntu Xenial), it's in set in the Hardware tab.

Attempting to use the receipt printer prints something, but it's gibberish. Here is the exact gibberish which it is:

?jJ+■??☰]?QRÿ¢a?%??s]k?*]??┌?]?╡??Jÿ???Q??
???m?@?jJ??a?RÆ??;?
n?d?@rL₧?aQ??ià??????????Lÿ???Tæ#??R???╡J?
E?????T?m????C?E??nÄ???0??%àn«?[X?J?j?@[km
[km[km[km[km[km[km[km[km[km[km[km[km[kJ?jJ

Parity error perhaps? But I don't know how to set parity for an adapter...

There is no /dev/lp0 or /dev/usb/lp0 by the way. I think it's just /dev/ttyUSB0, and (at a different abstraction level) /dev/bus/usb/006/002.

scannerdarkly commented 5 years ago

Followup: In the words of the OpenBSD crew, the QinHeng Electronics HL-340 (aka CH340) USB–Serial adapter (USB device ID 1a86:7523) is “the worst USB-serial chip in the world”.

Whether or not that's true, I got another USB–serial cable which uses a different chip (the Prolific PL2303), and after a little configuration it worked perfectly.

That configuration was as follows: I set all the DIP switches on the TM-T88III to the OFF position, which means the following per the manual:

And then I ran stty 19200 -parity -cstopb -echo raw -F /dev/ttyUSB0. Thereafter, everything printed perfectly.

Out of curiosity, I tried that HL-340/CH340 USB–serial adapter again, and the printer printed gibberish again. I may try some more stty settings just to see if I can get those crappy adapters to work. But in the meantime, my advice is to avoid the HL-340/CH340 chipset and try to use the Prolific PL2303.