Re: portable devices - USB - and other horrors

new topic     » goto parent     » topic index » view thread      » older message » newer message

Heh. Must have crossed posts.

jessedavis said...

Thanks for the quick reply. Two observations, so far:

1. There must be a way to do this. All I need is an input buffer to accept the character string from the device and an output buffer for sending info to the device. No driver or other software is supplied by the mfg. It relies on the fact that USB HID devices tell the OS what is required. Since there is no driver it must rely on a standard OS supplied driver. This is probably OK until two of these get plugged into the same machine. The, relatively dumb, OS just sends all the data to the same buffer. Try plugging two keyboards into the same machine and watch what happens!

A bit confused now. I thought you were trying to send data between two USB serial devices, not two USB HID devices.

jessedavis said...

2. I suppose I could supply some additional hardware to go between the device and the OS. All this would accomplish is to kick the can down the road. It would require a custom driver but at least one could add a device ID so more than one could be connected at a time. The thought of a hub comes to mind. The hub must somehow indicate to the parent which device is talking now, even if all devices are the same.

How much control over the choice of hardware do you have? If accessing a keyboard directly is required, can you request an RS-232 keyboard to be connected to a third USB-serial device? Then you'd be able to read from that keyboard via another COMX: port.

It's hard to get a true RS-232 keyboard these days, but I think this combination should work:

PS/2 keyboard ( https://www.amazon.com/Serial-Standard-Keyboard-70011-Windows/dp/B0075W8C8S/ref=sr_1_1?keywords=serial+keyboard ) + PS/2-to-RS-232 adaptor ( https://www.versalent.biz/seradpt.htm ) + usb serial dongle ( https://www.amazon.com/rs232-usb-dongle/s?k=rs232+to+usb+dongle )

jessedavis said...

3. Even if there is a way to separate out all the devices I still need to know how to tell Euphoria which buffer to look at. The old integer fn = open( "com1:","r/w") should still work as the OS still does assign a logical device name to a physical port, even in windows 10.

So basically you just need a way to tell which COM port belongs to the USB devices that you are interested in?

If the output from the wmic command doesn't have enough information, then see this VBScript at message #6 of https://forums.ni.com/t5/LabVIEW/How-to-find-COM-port-for-a-specific-USB-device/td-p/1029382?profile.language=en

Just combine that script with some VBScript code to write the answer into a file (that you can then read from your Euphoria side) https://stackoverflow.com/questions/2198810/creating-and-writing-lines-to-a-file

You can then run your VBScript from inside system() by using CScript. See https://www.vbsedit.com/html/f1741259-9501-478b-bad6-36039a057410.asp for an example of how to invoke CScript from the command prompt. (I figure once you can call CScript from the command prompt, you can adapt it into a system() call pretty easily.)

Keep in mind the warning from earlier in the ni.com thread - COM ports assigned to USB devices tend to change upon a reboot. So maybe lookup the COM ports everytime the application starts up or something.

jessedavis said...

4. I don't know enough to do this. Out of my depth. I just thought someone out there might have run across a solution. The archives only have one entry for USB.

Understandable. Regretablly, what you're trying to do is not particularly common. Most application writers depend heavily on the vendor to provide a device driver to sort out these tpyes of problems. For example, a different ni.com thread reports that their solution (with a barcode scanner) was to reconfigure the driver to emulate a serial port (COM port) instead of a USB HID keyboard to be able to read characters from the device. https://forums.ni.com/t5/Instrument-Control-GPIB-Serial/usb-HID-to-serial-emulation/td-p/951513?profile.language=en

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu