Assign and Pin USB device to COM port - usb

Much like DHCP and LAN IP addresses, I would like to configure a Win10 laptop to reserve and assign a USB device to COM15. If you have successfully done this before, please state this in your response and any lessons learned. I look forward to any references / examples. Thank you

If your device reports a USB serial number in its descriptors, then Windows will remember the device and always assign it to the same COM port number. You can change the COM port by going to the Device Manager (devmgmt.msc), double-clicking on the COM port, going to the "Port Settings" tab, and clicking "Advanced...".
If your device does not have a serial number in its descriptors, then you need to repeat the procedure above for every USB port on your computer that you might want to plug the device into. The reason for this is that the device's Device Instance Id, instead of including the serial number, will have some sort of string with ampersands in it that depends on what port the device is plugged into. This ID is what gets associated with a COM port, so you need to make sure all of the possible IDs of the device are associated with the same COM port.

Related

How do I get "Bus Reported Device Description" and "is connected" from a serial port?

I have a tablet that has built in Bluetooth. I have a device which is serial that I have connected to a bluetooth to serial converter using the DTE setting. This one to be exact: enter link description here
It creates/uses two serial ports. The one with the -dev is the one that is used since the tablet is the main one making the connection. In the device manager, both com ports show up as "Bluetooth com device" but you can't tell which one is the -dev device without looking at the properties and then choosing "Bus Reported Device Description". I need to find a way using vb.net to loop through the ports, check the "Bus Reported Device Description" and choose that com port and open it if it has the -dev in that description.
Is there a way to do this?
Secondly, once that connection is made, since it uses serial com ports, once I open the com port, it of course says "opened" but it will show that even if the Bluetooth device isn't really connected. Is there a way to see in the same set of properties above, the "is connected"? It appears to be able to tell if it is really connected or not, not just that the com port itself is open.
If you can live with a Powershell script, here is the solution I put together for the device its "Bus Reported Device Description" I needed to get:
(Get-WMIObject Win32_PnPEntity | where {$_.name -match "ethernet"}).GetDeviceProperties("DEVPKEY_Device_BusReportedDeviceDesc").DeviceProperties.Data

Is there a way to uniquely identify a specific usb port on a host device?

This question may be very broad but I'm trying to keep it platform agnostic.
If I connect a device to a USB port on a computer, is there a way for that device to uniquely identify the port it's connected to?
e.g. I have a PC with 10 USB ports. I have a smart phone that's programmed to run Function A if it's connected to Port 1 and Function B if it's connected to Port 2, etc...
Is there a way that the smartphone (the peripheral in this case) can identify the specific port on the host?
Is there a way it can identify the host device as a whole?
Basically, does the peripheral know anything about the host?
Is there a way that the smartphone (the peripheral in this case) can identify the specific port on the host?
No, only the host knows which port a device is connected to. They all look the same from the phones point of view.
Is there a way it can identify the host device as a whole?
Basically, does the peripheral know anything about the host?
Not with USB per se, but you could implement some identification in a higher protocol.
Look at later implementations of the android debugging protocol for example: The host sends an ID to the device, and unless it matches in the device database the user will be asked: "Do you want PC (ID) to be able to debug this device?"

how to transmit serial data from GPS device to computer through IP?

Well..I have found some third party application regarding sending data from com port to IP. but I have not found any basic tutorial regarding them. so can anyone help me with this? I have a GPS device which I will connect to my laptop through usb to serial adapter.Now I need to send that data from a laptop to another laptop on same network. Can I use putty to view that data in another laptop(receiver)? Is virtual serial port driver meant for this kind of application?
If you do not want to write your own tool for it, you can simply use ncat and set up a daemon that reads piped data from one process and broadcasts it to all connected clients.
If you want something that reads the data from the serial port and then transmits it to clients, you'll need to write a server application that accepts connections and sends data around, but there's entire books on this. It should be easy to do for your purposes as written here, but it depends on the amount of control you need.
Alternatively you can use a virtual serial port application as you had mentioned, which might be the easiest route. The two devices will need to be on the same network unless the application supports TCP based virtualization instead of the common Ethernet based implementation.
This Python script works very well as a free "device server". Just enter the serial port configuration and the IP address and port information.
https://github.com/jaredly/pydbgp/blob/master/symbian/serial_tcp_redirect.py
This can work on both Windows and Linux.
You need pyserial.
You can always try using stand alone hardware such as the SENA LS100 device server.

communication to usb port by using vc++2008

I want to communicate to halios system(hardware) through usb port. I have a code which shows that the device is attached. I used USBTrace which shows that how many bytes are going in and out from the device to the host. But I do not know how to implement this is vc++2008 and by using windows xp.
If this is an evaluation board for an Elmos optical sensor IC I would guess that a USB to serial converter is involved. You could confirm this by watching Windows Device Manager for a new COM port appearing when you attach the device.
If that's the case you can use Basic example of serial communication with Windows XP/win32 but you may need to contact Elmos for the command protocol.

USB port number

I have a device that I need to program from my computer. It uses a serial to usb cable to communicate with my computer. When programming the device I have to provide the port number, ttyUSBn. How do I know the number of the USB port I'm using?
On a MAC/OSX you can use the following in a terminal window: ls /dev/tty.*