See how much time has passed since I used windows, however this concept still applies. First of all, it seems that this usb modem has a switching mode, that is, it first identifies it as a CD so that you can purchase drivers, then it switches after installation is complete on a mass storage device that contains a script that created symbolic links 3 COM port. To use this in an application, you need a few things, first the PID and VID usb, in order to be able to list the device on the hub of your computer. Secondly, you need a copy of this script that starts creating a symbolic link, and you need to call this script from your application after detecting the device (by listing for VID and PID) after executing the script, three COM ports will appear automatically, and you should have access to them as usual. You can also check if the CD-ROM application was at the beginning of the installed DLL (it almost certainly happened, and almost certainly the second script checks the DLL before creating links to the COM port, so make sure the dll stays where it is supposed to be). you will need to associate them with your application in order to get any additional functionality that they provide (but this opens the pandoras window for its own interface, if you do not like to do this, I cannot do this ... I can do this / show an example in Java, but not C #), otherwise, just using the com port is what you want and you really know how to talk to the device (AT commands), then forget about it and open the COM ports and run. at the last point you will need to find your own interface (not a very native interface, just a system call to execute the bash command to run script / exe, all) for C #, so look for a system call function built into the .NET framework.
Let me know if you need any further explanation of the steps.
UPDATE:
to list usb, you can use a library like javas usb4java and implement a function similar to the following
public Device findDevice(short vendorId, short productId) { // Read the USB device list DeviceList list = new DeviceList();// ---> Here is empty device list int result = LibUsb.getDeviceList(null, list);// ---> Now list is populated if (result < 0) throw new LibUsbException("Unable to get device list", result); try { // Iterate over all devices and scan for the right one for (Device device: list) { DeviceDescriptor descriptor = new DeviceDescriptor(); result = LibUsb.getDeviceDescriptor(device, descriptor); if (result != LibUsb.SUCCESS) throw new LibUsbException("Unable to read device descriptor", result); //Match the VID and PID (function inputs)---> if you find a match, then return success/or the device // you can find the VID and PID from the device manager if (descriptor.idVendor() == vendorId && descriptor.idProduct() == productId) return device; } } finally { // Ensure the allocated device list is freed LibUsb.freeDeviceList(list, true); } // Device not found return null; }
This feature allows you to access your USB device directly from the application. you can start the initialization sequence and mass transfers (most likely, this will work on a virtual COM port device, which is typical for the ftdi chip, for example, since this is an unknown Chines chip, as far as we can go low, we should rely on that that provided, and let windows do the dirty work of the driver) ...
At this point, your program knows that the USB device is connected, if the fucntion function returns null, then sleeps for a second and continue polling until the device is connected.
from now on you need to run a script that will create symbolic links, I will read its .exe file. Here is a copy and past for C # code sent by another member.
using System.Diagnostics;
having an exit code is very useful to indicate whether the script successfully created symbolic links or not (I hope that the Chines guy who did this follows the correct encoding methods).
EDIT:
Error script. The reason is simple: he does not know that ProductID and VendorID are listing and initializing. (99.99999% they did not recompile the simple script initialization for each individual block, just to copy pid and vid), so it probably gets pid and vid as arguments (at best) or reads from usb hidden mass storage sectors (on which that you may have problems with paths when running the script from a non-root location) ... you may need gdb to find out if some arguments are missing, especially if the .exe file does not output anything to stderr
Finally, at this point you can start searching for a list of COM ports using the standard C # libraries, using something like:
Source code
var portNames = SerialPort.GetPortNames(); foreach(var port in portNames) {
and when you find the port you are looking for, you can open it using
Source code
public static void Main() { string name; string message; StringComparer stringComparer = StringComparer.OrdinalIgnoreCase; Thread readThread = new Thread(Read); // Create a new SerialPort object with default settings. _serialPort = new SerialPort(); // Allow the user to set the appropriate properties. _serialPort.PortName = SetPortName(_serialPort.PortName); _serialPort.BaudRate = SetPortBaudRate(_serialPort.BaudRate); _serialPort.Parity = SetPortParity(_serialPort.Parity); _serialPort.DataBits = SetPortDataBits(_serialPort.DataBits); _serialPort.StopBits = SetPortStopBits(_serialPort.StopBits); _serialPort.Handshake = SetPortHandshake(_serialPort.Handshake); // Set the read/write timeouts _serialPort.ReadTimeout = 500; _serialPort.WriteTimeout = 500; _serialPort.Open(); _continue = true; readThread.Start(); Console.Write("Name: "); name = Console.ReadLine(); Console.WriteLine("Type QUIT to exit"); while (_continue) { message = Console.ReadLine(); if (stringComparer.Equals("quit", message)) { _continue = false; } else { _serialPort.WriteLine( String.Format("<{0}>: {1}", name, message)); } } readThread.Join(); _serialPort.Close(); } public static void Read() { while (_continue) { try { string message = _serialPort.ReadLine(); Console.WriteLine(message); } catch (TimeoutException) { } } }
Hope this helps you get started!