Possible duplicate: How do you get a list of all usb devices connected to your machine. And if it is possible to debug incoming data from a specific usb device. how?
Note: I'm not talking serial connections, i got those figures out. But devices such as the Logitech G502 mouse, uses not serial communication, yet still manages to talk to their software on the pc.
No serial listed on the G502, how to communicate with it.
G502 mouse properties image
Related
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.
I want to read data from an I2C device in windows XP, but i am beginner in working with serial ports and I2C devices.I have searched a lot however i have just found some codes to write on an I2C device but not read from it.please describe me how should i start?
Edit: I have an I2C device, an I2C to USB convertor and a USB cable.I have connect them together with this sequence:
The I2C device is connected to I2C-USB convertor with a cable and the convertor is connected to the USB cable finally the USB cable is connected to my computer system.
by the way i have using Windows XP on my system.
I have a very similar situation. However, my USB-to-I2C device came with a C library, so my code simply has to execute i2c_read() or i2c_write() functions. Then the library takes care to talk to the driver, then the USB-to-I2C device and so on. It is pointless for me to give you the code that I use because we have a custom device and custom library (made specifically for my company).
Since you have the "write" example, there should have been the read functionality as well.
Since you did not provide any particulars on which USB-to-I2C device you have, this is all the information that can be provided.
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/
I have looked at many open source GPS programs that can parse GPS data from an external GPS device that connects to the computer via a serial port.
But what about built-in GPS devices like a Panasonic Toughbook (a Windows XP Tablet)? Do these devices transmit their GPS data through a serial port?
Thanks.
I'm pretty sure they do broadcast their GPS data through the serial port (or can be easily configured to do so). I've written C# code for Garmin GPS-enabled PDAs, and their GPS data can be accessed either through P/Invoke calls to a proprietary DLL on the device, or just by reading the NMEA sentences broadcast on the serial port. So I imagine built-in GPS in PC-type computers works the same way. I can't find any confirmation of this online, however.
Currently I am doing a project involves a bluetooth communication setup between a PDA and a small embedded device. This small embedded device can only be communicated with a virtual serial port over a bluetooth link.
The PDA is the ipaq running with windows mobile 6, and I am using c#.
I had done a program which can communication with the serial port over bluetooth. But the only issue is every time I run this program, I have to active the bluetooth radio, and manually pairing this device with the pda via the bluetooth manager. What I want to do is when running this program, it can establish the bluetooth connection between the pda and the embedded module.
So I am using functions from the 32feet prject. This is one issue is I cant make the virutal serial port part, as I think the 32feet project can only make virual serial ports for the window bluetooth stack but not the widcomm bluetooth stact, which the ipaq is using.
Therefore, are there any existing c# classes or stacks that can make virtual serial port under widcomm for windows mobile 6.
Thanks
See my answer at Widcomm bluetooth : how to open the virtual COM. I generally recommend using a direct sockets (BluetoothClient) connection. That seems better to me than having to create a virtual serial port, which is difficult on various platforms, and then open it, and then gets no errors when the peer device goes out of range etc etc. :-)
Alan