I had such a problem: in the three com ports have devices with which I work in software. Not installed drivers. The problem is: How can I find out which of the ports is connected with which of device? Thanks in advance
You may not be able to identify the devices in the COM ports. There is no industry standard nor requirement for device names. Some protocols such as SCSI, ATAPI and USB have commands that you can use to identify the device. For standard RS232, there is no such requirement.
What kind of devices do you have to identify? Plotters, thumbdrives, tape drives, etc?
There is no reliable way to do this. You can poll the COM ports, but many devices don't even respond to commands they receive. A COM port could only have Tx and Gnd wired up, so the connected device might not even be able to respond. You have very little to work with when dealing with RS232.
Related
When I turn on the bluetooth on my laptop. I see there are 2 ports added under device manager COM&LPT
Why does it add 2 ports?
If I need to a read/write via bluetooth which port should I consider using?
Thanks.
If you're using Windows own Bluetooth software, two virtual port COM ports are created after pairing.
I believe one is being used for incoming connection requests and another is used to initiate connections to the device (outgoing).
To determine which one to "use" then please consider this post which should answer that for you.
I'm working on a project in which I want to make a virtual USB flash memory via my USB port for an external device, for example, a satellite receiver that needs a memory for recording TV channels. I want to connect the PC USB port to the satellite USB port and record files directly to a file. I'm working in C#/.NET.
USB Protocol is generally between two distinct devices: The host and the client. The host says what data gets transferred and when, the client has to listen. Then there are different device classes for clients. There are USB removable media, printer, webcam ans others. USB otg differs slightly as a device can be client or host depending on the other one. For example your mobile phone van be client when connected to a PC or host wehn it's connected to a USB stick.
Now there is your satellite receiver. It wants to be host. (You know that when it uses the big Type-A socket) And it expects a removable media device like a USB stick. When you connect a printer it will not know what to to with it. Same with a network adapter or serial port.
N.B.: You cannot possibly implement "Flash Memory protocol via serial port". Because Serial Port is already the client device class. Also, there is no wire compatibility between USB and serial.
As your PC is in the same role and will not act as client in the USB connection, there is no simple solution. (I bet you knew this already, huh?)
Even if you got a PCIexpress card that acted like a flash drive, there would be more hurdles. For example file systems are not designed to be accessed by two computers simultaneously.
Back to constructive answering:
Inspired from this link you could grab some higher end microcontroller and attach a (micro)SD card. Then you let it act as a flash drive on its USB port. Use its Ethernet connection (or wifi for that matter) and provide access to the (micro)SD card via samba.
This is some really high end stuff for a microprocessor, so better not use the very cheap ones. RasberryPI Model A (not the B one, that cannot act as a USB client) or Arduino/Netduino (the most powerful) came to my mind.
I could not find a ready-to-use device.
The important thing is, that the connection to you PC uses some kind of networking and not USB. Because networking protocols have the concurrency (multiple PCs accessing the same data) covered whereas local file systems don't.
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/
Does anybody know any online tutorials about receiving data between a desktop client (in c# mostly) and an iPhone with bluetooth?
How would a C# desktop client connect over bluetooth... by reading the COM Ports?
From what I understand the iPhone will not pair with a PC as a bluetooth device, as an iPhone will only connect to approved device types. There may be some way to "fake" this and have the PC show up as an approved device, though I'm not sure there's a BT stack to do this.
An easier solution (if it meets your requirements) may be to try using the WIFI connection, you can open up a TCP socket between the device and PC fairly easily and push data through it at a high rate. You should be able to do this with an ad-hoc connection (so you don't need a router) though I've never tried it. You might want to look into cocoaasyncsocket if you do this.
I am supposed to write an application to manage all devices connected to a network e.g routers, radios, etc, I've figured a way to know the devices connected, but my challenge right now is how to figure out the bandwidth consumed by each interface of these devices on the network.
You're probably going to need to use SNMP to gather the data. If SNMP isn't supported by the particular devices you're using, you may have other options that are more specific to each device.