static int Main(string[] args) { USB.DeviceProperties device_prop = new USB.DeviceProperties(); USB.GetUSBDevice(0x0403, 0x7018, ref device_prop); string com_port = device_prop.COMPort; int returnVal = SUCCESS; Modem.UninstallModemsNotAttachedToThisCOMPort(com_port); if (!Modem.DoesModemExistOnPort(com_port)) { Console.WriteLine("Installing modem on " + com_port); if (Modem.InstallModemDriver(com_port)) { returnVal = SUCCESS; } else { returnVal = FAILED; } } else { returnVal = ALREADYINSTALLED; } PhoneBook.CreatePhonebook(); return(returnVal); }
static int Main(string[] args) { USB.DeviceProperties device_prop = new USB.DeviceProperties(); //StreamWriter writer = File.CreateText(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "\\M5ModemOutput.txt"); // writer.WriteLine("Getting usb device for 403, 718 pid/vid"); USB.GetUSBDevice(0x0403, 0x7018, ref device_prop); string com_port = device_prop.COMPort; // writer.WriteLine("USB device found on " + com_port); int returnVal = SUCCESS; Console.WriteLine("Uninstalling modems from other ports that are not " + com_port); // writer.WriteLine("Uninstalling modems from other ports that are not " + com_port); Modem.UninstallModemsNotAttachedToThisCOMPort(com_port); if (!Modem.DoesModemExistOnPort(com_port)) { // writer.WriteLine("Installing modem on " + com_port); Console.WriteLine("Installing modem on " + com_port); if (Modem.InstallModemDriver(com_port /*ref writer*/)) { // writer.WriteLine("Successfully installed modem driver"); returnVal = SUCCESS; } else { returnVal = FAILED; //writer.WriteLine("failed to install modem"); } } else { // writer.WriteLine("modem already installed from before"); returnVal = ALREADYINSTALLED; } PhoneBook.CreatePhonebook(); // writer.Close(); return(returnVal); }