19.04.2024, 08:16
(19.04.2024, 07:55)admin Wrote: 1. Check that the modem is detected when the system starts in System config > Status > System log.
2. Run this script and post what you get in Logs:
Code:tty1 = '/dev/ttyACM3'
tty2 = '/dev/ttyUSB2'
if io.exists(tty1) then
tty = tty1
elseif io.exists(tty2) then
tty = tty2
else
log('port not found')
return
end
port = require('serial').open(tty)
if not port then
log('cannot open port')
return
end
function readstatus()
local data, res, simok, network
port:flush()
port:write('AT+CSQ\r\n')
data = port:read(1000, 1)
if data then
res = data:match('+CSQ: (%d+)')
res = tonumber(res)
if res then
log('Signal: ' .. tostring(res))
else
log('Signal: no response')
end
else
log('Signal: no data from port')
end
port:flush()
port:write('AT+CPIN?\r\n')
data = port:read(1000, 1) or ''
if data:find('CME ERROR') then
log('SIM: not found')
elseif data:find('+CPIN: READY') then
log('SIM: OK')
simok = true
else
log('SIM: unknown')
end
port:flush()
port:write('AT+COPS?\r\n')
data = port:read(1000, 1)
if data then
res = data:match('+COPS: %d+,%d+,"(.*)",%d+')
if res then
log('Network: ' .. tostring(res))
network = res
else
log('Network: no info')
end
else
log('Network: no data from port')
end
return simok and network
end
for i = 1, 20 do
if readstatus() then
break
end
end
OK in the log i see error network no info and SIM not found signal 13, but in the phone the SIM works.
Why ?