PDA

View Full Version : Virtual USB COM port with Qt 4.8



WinterIsComing
9th May 2013, 08:54
Hello,

I have an Symbol LS1203 barcode reader with USB cable. I need to implement in my program:

- enumerate all ports and find out which is the port where the barcode reader is connected
- listen to data comming
- parse data for a valid barcode string

after this i do some basic operations like finding the ID in my database etc..


I don't have access to Qt5, we are still on 4.8 commercial license. I have integrated QExtSerialPort and the enumeratation only lists COM1 port. So that's obviously the physical port. So, i need to download a driver or software from the Symbol product page to emulate virtual RS232.

I'm on windows 7 and the driver for emulation does not work on win 7. End of story :(((

So basically, i have no option else then popping out a QDialog with a QLineEdit and using the barcode reading in a keyboard wedge mode: setFocus to QLineEdit and waiting for the string. Something similair is seen in supermarkets/stores, i often see a little window poppping and waiting for the scanned product ID.

I was hoping, to avoid this application modal dialog, and use a library such as QExtSerialPort,..but the fact that i don't know how to make this USB port show as an Virtual Serial Port forces me to use dialogs.


Is there maybe another solution possible to avoid dialogs? I have googled and searched alot these days and haven't find out anything. Maybe, there is a little hack such as, installing the driver on XP and modfify-ing some settings and configs, ...but that's out of my knowledge.

I hope there is. Thanks

Lesiok
9th May 2013, 09:29
Which version of QExtSerialPort ? We are working with QExtSerialPort and have no problems with enumaration. Is the virtual COM port visible in hardware manager ?

kuzulis
9th May 2013, 11:24
instead of QextSerialPort it is better and simple to use QtSerialPort (http://qt-project.org/wiki/QtSerialPort).

WinterIsComing
9th May 2013, 11:32
qextserialport-1.2rc

no not visible, but it should be listed in "Human Interface Devices" ?

i'm currently thinking of buying a different cable and tell the client to use the real serial port. Something like this: http://salestores.com/motorolasymb328.html (i'm sorry if it's not allowed to post links, i haven't had the time to read the rules yet..)

Obvously it's a problem of the barcode pistol, it has no appropriate driver to emulate usb com port on windows 7 :(

I guess a proper solution would be to buy the cable, add a settings page in GUI, and allow the user to choose between USB or SERIAL PORT, if it's serial port, then have combos for configuring settings (baudrate, etc..) If it's usb-cable, show a dialog and wait for string at cursor.


instead of QextSerialPort it is better and simple to use QtSerialPort (http://qt-project.org/wiki/QtSerialPort).

Would be nice indeed, currently we are still on Qt 4.8 commercial license, i must wait for the whole crew before migrating to Qt5, as many applications needs to be updated manually

Lesiok
9th May 2013, 12:22
If You don't see COM port in Hardware Manager You can't enumarate this as COM port. QExtSerialPort library is working with COM devices not with "Human interface Devices". First you need to have the appropriate driver.


instead of QextSerialPort it is better and simple to use QtSerialPort (http://qt-project.org/wiki/QtSerialPort).

Sorry kuzulis but you're talking nonsense. What QtSerialPort is better to use a non-existent device ?

kuzulis
9th May 2013, 13:44
Lesiok,

Testers are simply necessary to me for QtSerialPort therefore I carry out such propaganda . :)

Besides, QtSerialPort supports an enumeration for bigger number of devices than QextSerialPort (more GUIDS). Therefore I also suggested it to try, maybe suddenly it would earn.

But now, since we see that the device is defined as HID, neither QextSerialPort and neither QtSerialPort won't help.

ChrisW67
9th May 2013, 21:26
If the barcode reader injects scanned codes into the keyboard stream immediately after you plug it in (i.e. without installing drivers) then it is designed as a HID class device. Unless the manufacturer tells you otherwise and provides a driver that reconfigures the device it will never appear as a serial device (communications class).

The keyboard input should go to whatever widget has focus. I see no reason that needs to be in dialog. If your focus is on a QLineEdit with a suitable validator for the bar codes then you should have a reasonable way to ensure you get the code either by scanning or manual keying (for those occasions when you are in a hurry and a barcode simply will not scan).