Comments on the "Xojo Serial Port Tutorial"

Too bad we can neither comment on Announcements in this forum nor on the articles such as this one: http://xojo.com/resources/serialport.php

So I’ll do it here:

Barcode scanners in general

I’ve recently made USB barcode scanners work with Xojo (on OSX only so far). I recommend using them over those with only a serial connection. By default, they behave like a USB keyboard, so when you scan something, it simulates typing the text on the kbd. However, they can usually be programmed also to behave as a special “scanner” HID device, so that you can then receive their codes in your app and handle them as you like, without getting the scanned text into some input field or elsewhere you don’t want it to go. To receive these HID codes on OSX, I’ve used the MBS USB plugin successfully. If you have a need for this functionality as well, contact me and I’ll share if you can’t figure it out.

Serial device drivers on OS X

There are a lot of problems with certain popular Serial port USB devices on OS X. For instance, all USB-to-Serial converters based on the Prolific PL2303 chip require a manual driver installation. There are drivers from various sources, e.g. from Profilic themselves as well as various open source versions, all named “osx-pl2303”. But beware - most of them do not work properly - either they’re not working at all on recent OS X versions (such as Prolific’s) or they don’t handle the handshake or Baud settings correctly. Through a lot of trial-and-error, I eventually found only one driver to work without any hitches - not surprisingly that’s the one that’s not free: https://www.mac-usb-serial.com - but it’s only a few bucks, and in return one gets a responsive developer who takes care of it.

I have had more than my share of bad Prolific drivers over the years. I used to have issues on Windows (Vista and later) but I had an issue with Yosemite too.

It’s enough to pull your hair out. Yeah. I used to have hair before Prolific…

the FTDI converters we have used with all sorts of stuff and never once had any issue. they are not the cheapest, but they do just work.

also, i’ve never heard of the HID codes, so thats very interesting, id be interested in some more info on that @Thomas Tempelmann

normally you can program the scanner to add a scan prefix/suffix and using chr(2) and chr(3)
I can generally decipher the text from the keyboard as actually being from the scanner, but being able to detect it separately, and at the window level rather than in a textfield level would be very useful.

@Russ Lunn, I should have been more specific - in fact, the ONLY driver troubles I had was with Prolific PL2303 based chips. I believe FTDI is the only other common chip, and I had no issues with them last I used them (about a year ago on OS X 10.9 or 10.8, not sure).

The HID mode for scanners is part of the USB standard.

All these scanner that emulate a USB keyboard have to be programmable anyway: I have to be able to specify the keyboard layout (ISO vs. US or Japanese etc.), locale (English, French, German etc.) and OS (Mac, Win) so that it can generate the correct key codes (kbds do, after all, not send “ASCII” character codes but key codes that the OS then converts into character, depending on the user’s locale etc.).

And along the same setup methods that allows you to specify the keyboard layout there should also be a setting for "not kbd but scanner HID mode). On the GoDEX GS550, for instance, it’s called “USB HID Bar Code Scanner” in the manual.

Next, you’ll need to be able to install handler code in your app for the specific USB device. On OSX, with the MBS USB plugin, this was rather easy. No extra drivers necessary.

I’ve uploaded a demo project here: http://files.tempel.org/RB/HID_Bar_Code_Scanner_Demo.rbp.zip
It includes some instructions in a Note.

For Prolific, there’s actually a download area on the Prolific.com.tw website where you can download the drivers. It’s not easy to find but they always have the most correct version. The software you get from the device manufacturer may or may not work.

Jon, those drivers you talk about are NOT good. They are causing problems on OS X 10.10 and also have trouble with setting certain baud rates, e.g. it failed to set 9600 for me all the time, whereas the Windows drivers (thru VMware) were working. That’s what I was talking about.

If they work for you, fine. But I was talking to those who DO have trouble with them, pointing them to an alternative that’s working more reliable.

Hmm. I’ve not seen any issue in 10.10 or 10.11 with the driver I’ve downloaded from the Prolific site.

I believe I am using driver PL2302_1.1.0b1.2

It has been working fine for me in 10.10 and now in 10.11. I do a lot of RS-232 work.

Is that this one? http://www.prolific.com.tw/US/ShowProduct.aspx?p_id=229&pcid=41

Because that’s the bad one because it’s not properly signed. It’s from 2013.

The v1.1 you’re having makes no sense in this regard because Prolific’s is already at 1.5.1. Could it be that you’re using a different driver?

You are right. I was looking at an old copy. Yes, 1.5.1. And they even tell you it’s not signed. It has not caused me any issues…

[quote=204534:@Bob Keeney]I have had more than my share of bad Prolific drivers over the years. I used to have issues on Windows (Vista and later) but I had an issue with Yosemite too.

It’s enough to pull your hair out. Yeah. I used to have hair before Prolific…[/quote]

me too. :slight_smile:

So, you saw the link to https://www.mac-usb-serial.com, which points to a well working driver, I hope? Spread the word - that small dev could use the support.