Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

USB based scanner/scales #957

Open
scannerdarkly opened this issue Jan 4, 2018 · 15 comments
Open

USB based scanner/scales #957

scannerdarkly opened this issue Jan 4, 2018 · 15 comments

Comments

@scannerdarkly
Copy link
Contributor

scannerdarkly commented Jan 4, 2018

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.)

  • Version of CORE?
    All

  • Issue with Office, Lane, or both?
    Lane

  • Is this [mostly] a bug report, feature request, or question?
    Question

@gohanman
Copy link
Contributor

gohanman commented Jan 4, 2018

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
Copy link
Member

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
Copy link
Contributor

gohanman commented Jan 5, 2018 via email

@scannerdarkly
Copy link
Contributor Author

@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
Copy link
Member

joelbrock commented Jan 5, 2018 via email

@scannerdarkly
Copy link
Contributor Author

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
Copy link
Contributor Author

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
Copy link
Member

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
Copy link
Contributor Author

@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
Copy link
Contributor

gohanman commented Jan 16, 2019 via email

@scannerdarkly
Copy link
Contributor Author

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

@scannerdarkly
Copy link
Contributor Author

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
Copy link
Member

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
Copy link
Contributor Author

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
Copy link
Contributor Author

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:

  • 19,200 baud
  • 8 bits
  • No parity
  • DTR/DSR handshaking

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants