My app is running in kiosk machine and it connect with multiple devices as printer, camera, weighing scale, barcode scanner etc through USB port.
What I want: My app will check the connection of device when selected any port. Currently, I only can check which port is connected but can't identify which device it is.
As the picture below there are 2 devices and they are connected to kiosk. If I select 'USB Input Device' port for touch screen and select another port for printer. How I do to check exactly 'USB Input Device' port is touch screen connected but not printer. In case 'USB Input Device' port is printer, app will be display message.
https://i.stack.imgur.com/3tzY2.png
Related
How to detect usb activity using C#? I want to use it to trigger a function. In my case the device was detected as USB composite device.
It all depends on what you mean by writing "usb activity". Technically speaking, there is always USB activity between a connected USB device and the USB host. USB is a protocol that is making heavy use of polling, with the USB host continuously polling connected USB devices with a frequency between 125 Hz and 1000 Hz. In other words, there would be no need attempting to detect USB activity because there is always USB activity between the USB host (computer) and connected USB devices.
I'm able to detect if a USB device is attached via WM_DEVICECHANGE/DBT_DEVICEARRIVAL and I also get the Vid/Pid of the new device via DEV_BROADCAST_DEVICEINTERFACE structure.
Now I need to know to which USB Hub this device is connected.
Do you know how I can get e.g. the name of the USB hub my device is connected to?
The reason why I ask is that I need to wait for 3 specific devices and I have to be sure these devices are connected to the same hub.
I need to send a message from a computer to a USB port and with a cable carry that message to another USB port of another computer and receive it
Can i get some help?
I'm trying to use a VB.Net Winform to send a string through the COM port to another computer. I have an RS232 COM port on the computer with the application. I then have a Serial to USB adapter that is plugged into the other computer's USB port.
I am using SerialPort from .NET and my application opens the COM port and initializes it. Then when I use mySerialPort.Write(string), the Rx light on the MOXA serial to usb adapter blinks, as if it is receiving the data.
However, if I have notepad open on the computer that's receiving the data, nothing prints out.
Essentially, what I'm trying to do is have the user push a button that will send a barcode (as a string) to the other computer. But I can't figure out how to get the other computer to read the string and print it to notepad or whatever textfield has focus.
I'm limited on what I can install on the receiving computer because it runs Unix.
In a C# application, what are some good ways to detect the presence of certain device connected to the computer? Programatically, of course. I need to support Windows XP and 7.
Background
I've been given a huge C# application that uses some connected device. The devices are custom hardware and are not designed to use without the software. When the C# app starts, it searches for such connected devices and communicates with them when appropriate. There can be more than one connected devices. I haven't looked into the source code that searches the devices. The devices are plugged into the PC with either USB or serial cable. They appear as COM port in device manager. Sometimes there can be USB hub or serial to USB converters in between the PC and the device.
When the device is connected with certain USB hub, or certain serial to USB converter is used, sometimes the software cannot detect the device properly. Sometimes it varies from PC to PC. We're not sure if it causes for some driver.
I'm told to look into the device searching algorithm and if possible, come up with better solution and replace current implementation. I haven't done this sort of task before and I need to learn how Windows manage the devices under the hood.
How can I search for specific connected devices in C#? What are some good practice and what I should be aware of or avoid?
You can find all devices in registry: HKLM/CurrentControlSet/Enum ( http://msdn.microsoft.com/en-us/library/windows/hardware/ff546173(v=vs.85).aspx )
But there will be problem with serial port. You can't be certain in which device is connected to a serial port. It can be mobile phone, modem, mouse, your device, another custom device, etc. To guarantee that it is your device connected to a given serial port you must try to communicate with it. And if it responds in proper way - then yes, it is your device.
Because of this many programs that works with serial devices asks user to manually select serial port, where device is connected.
UPD:
Another link about enumerating serial ports: http://social.msdn.microsoft.com/Forums/en-US/netfxbcl/thread/afb62e84-53e5-4f17-ba91-8de15c4c2e38/