a user of an app of mine reported that "all at once" the app started crashing when initializing a USB device (Prolific). The app had been working for years, so both user and myself are in the fog. He run the app in Maverick and El Capitan.
I ask him to restore things via Time Machine, but he never made any backup. He reinstalled the Prolific drivers several times, yet he still reports hard crashes, sometime forcing him to reboot his mac.
As for me, I run El Capitan, but I don't have the Prolific device, so I don't get any crash.
Xojo 16 1.1
I uploaded a mini-project at dropbox, at https://www.dropbox.com/s/h3sflhd8lyigzyf/ModemTest1.zip?raw=1
BTW, the source is here below. Suggestions welcome. Thank you.
1. popupmenu open event:
Sub Open() if system.serialPortCount > 0 then for i as Integer = 0 to System.SerialPortCount-1 me.addrow System.SerialPort(i).name next else me.addrow "No modem" end if me.ListIndex = 0 End Sub
2. popupmenu change event:
Sub Change() Label1.text = "" Label1.Refresh checkPort me.ListIndex End Sub
prefsSerial is a property of the window containing the following code:
Sub checkPort(idx as integer) prefSerial = new Serial prefSerial.SerialPort = System.SerialPort(idx) //MsgBox "Serial ports: " + str(System.serialPortCount) dim foundModem as Boolean if prefSerial.Open then prefSerial.Baud = 8// 9600 bps prefSerial.write "ATI3" + chr(13) dim tStart as integer = Ticks dim response as string dim c as String = "OK"+chr(13)+chr(10) do until ticks-tStart > 300 // 5 secs max prefSerial.Poll if InStr(prefSerial.LookAhead, c)>0 then response = prefSerial.ReadAll exit end if loop //MsgBox "Response 1: " + response if InStr(Response, "OK") > 0 or Response <> "" then foundModem = true dim s as string = "AT&FI6" prefSerial.write s + chr(13) tStart = Ticks do until ticks-tStart > 300 // 5 secs max prefSerial.Poll if InStr(prefSerial.LookAhead, c) > 0 then response = response + prefSerial.ReadAll exit end if loop //MsgBox "Response 2: " + response response = replace(response, "ATI3", "") response = replaceAll(response, "OK", "") dim a as string = nthField(response, s, 1) dim b as string = nthField(response, s, 2) dim i as Integer for i = 0 to 32 a = ReplaceAll(a, chr(i),"") next for i = 0 to 31 b = ReplaceAll(b, chr(i),"*") next for i = 0 to 10 b = ReplaceAll(b, "**","*") next b = nthField(b, "*", countfields(b,"*")-1) label1.text = a + " - " + b prefSerial.flush else label1.text = "No response." end if end if if foundModem then prefSerial.write "AT&F" + chr(13) prefSerial.flush prefSerial.Close end if Exception MsgBox "Error modem." End Sub