Telit ME910C1-WW not detected
by Dresdo Gabriele
Hello,
I'm new to oFono, I'm trying to setup a Telit ME910C1 with oFono 1.18 in our embedded system (ARMHF) with Debian stretch kernel 4.9.11 but list-modems returns no results.
I installed ofono packet using apt-get
I can send and receive AT commands to the modem using a terminal connected to /dev/ttyUSB1
I paste Log from ofonod -dn.
Any suggestion will be useful
Thanks
Gabriele
ofonod[592]: oFono version 1.18
ofonod[592]: src/plugin.c:__ofono_plugin_init()
ofonod[592]: plugins/push-notification.c:push_notification_init()
ofonod[592]: plugins/smart-messaging.c:smart_messaging_init()
ofonod[592]: src/cdma-provision.c:ofono_cdma_provision_driver_register() driver: 0x54c3f868 name: CDMA provisioning
ofonod[592]: src/gprs-provision.c:ofono_gprs_provision_driver_register() driver: 0x54c3f83c name: Provisioning
ofonod[592]: plugins/upower.c:upower_init() upower init
ofonod[592]: src/handsfree-audio.c:ofono_handsfree_card_driver_register() driver: 0x54c3f7e8
ofonod[592]: plugins/dun_gw_bluez5.c:dun_gw_init()
ofonod[592]: src/handsfree-audio.c:ofono_handsfree_card_driver_register() driver: 0x54c3f74c
ofonod[592]: src/modem.c:ofono_modem_driver_register() driver: 0x54c3f760, name: hfp
ofonod[592]: src/modem.c:ofono_modem_driver_register() driver: 0x54c3f704, name: ublox
ofonod[592]: src/modem.c:ofono_modem_driver_register() driver: 0x54c3f6ac, name: quectel
ofonod[592]: plugins/he910.c:he910_init()
ofonod[592]: src/modem.c:ofono_modem_driver_register() driver: 0x54c3f65c, name: he910
ofonod[592]: plugins/connman.c:connman_init()
ofonod[592]: src/private-network.c:ofono_private_network_driver_register() driver: 0x54c3f630, name: ConnMan Private Network
ofonod[592]: src/modem.c:ofono_modem_driver_register() driver: 0x54c3f5e8, name: sim900
ofonod[592]: src/modem.c:ofono_modem_driver_register() driver: 0x54c3f5a0, name: samsung
ofonod[592]: src/modem.c:ofono_modem_driver_register() driver: 0x54c3f558, name: speedupcdma
ofonod[592]: src/modem.c:ofono_modem_driver_register() driver: 0x54c3f508, name: speedup
ofonod[592]: src/modem.c:ofono_modem_driver_register() driver: 0x54c3f4c0, name: alcatel
ofonod[592]: src/modem.c:ofono_modem_driver_register() driver: 0x54c3f468, name: icera
ofonod[592]: src/modem.c:ofono_modem_driver_register() driver: 0x54c3f420, name: linktop
ofonod[592]: src/modem.c:ofono_modem_driver_register() driver: 0x54c3f3d8, name: nokiacdma
ofonod[592]: src/modem.c:ofono_modem_driver_register() driver: 0x54c3f390, name: nokia
ofonod[592]: src/modem.c:ofono_modem_driver_register() driver: 0x54c3f348, name: cinterion
ofonod[592]: src/modem.c:ofono_modem_driver_register() driver: 0x54c3f2c0, name: ste
ofonod[592]: src/modem.c:ofono_modem_driver_register() driver: 0x54c3f268, name: ifx
ofonod[592]: src/modem.c:ofono_modem_driver_register() driver: 0x54c3f220, name: palmpre
ofonod[592]: src/modem.c:ofono_modem_driver_register() driver: 0x54c3f1d0, name: novatel
ofonod[592]: src/modem.c:ofono_modem_driver_register() driver: 0x54c3f188, name: sierra
ofonod[592]: src/modem.c:ofono_modem_driver_register() driver: 0x54c3f110, name: huawei
ofonod[592]: src/modem.c:ofono_modem_driver_register() driver: 0x54c3f0c8, name: zte
ofonod[592]: src/modem.c:ofono_modem_driver_register() driver: 0x54c3f068, name: hso
ofonod[592]: src/modem.c:ofono_modem_driver_register() driver: 0x54c3f018, name: mbm
ofonod[592]: src/modem.c:ofono_modem_driver_register() driver: 0x54c3efc8, name: calypso
ofonod[592]: src/modem.c:ofono_modem_driver_register() driver: 0x54c3ef80, name: wavecom
ofonod[592]: src/modem.c:ofono_modem_driver_register() driver: 0x54c3ef38, name: g1
ofonod[592]: src/cdma-voicecall.c:ofono_cdma_voicecall_driver_register() driver: 0x54c3eedc, name: cdmamodem
ofonod[592]: src/modem.c:ofono_devinfo_driver_register() driver: 0x54c3ef04, name: cdmamodem
ofonod[592]: src/cdma-connman.c:ofono_cdma_connman_driver_register() driver: 0x54c3ef24, name: cdmamodem
ofonod[592]: src/modem.c:ofono_modem_driver_register() driver: 0x54c3ee3c, name: phonesim
ofonod[592]: src/modem.c:ofono_modem_driver_register() driver: 0x54c3ee6c, name: localhfp
ofonod[592]: src/gprs.c:ofono_gprs_context_driver_register() driver: 0x54c3ee20, name: phonesim
ofonod[592]: src/ctm.c:ofono_ctm_driver_register() driver: 0x54c3ee0c, name: phonesim
ofonod[592]: src/radio-settings.c:ofono_radio_settings_driver_register() driver: 0x54c3ede4, name: phonesim
ofonod[592]: plugins/phonesim.c:parse_config() filename /etc/ofono/phonesim.conf
ofonod[592]: src/gprs.c:ofono_gprs_context_driver_register() driver: 0x54c3edc8, name: ubloxmodem
ofonod[592]: src/ussd.c:ofono_ussd_driver_register() driver: 0x54c3ed8c, name: speedupmodem
ofonod[592]: src/voicecall.c:ofono_voicecall_driver_register() driver: 0x54c3ec48, name: hfpmodem
ofonod[592]: src/modem.c:ofono_devinfo_driver_register() driver: 0x54c3ecec, name: hfpmodem
ofonod[592]: src/network.c:ofono_netreg_driver_register() driver: 0x54c3eca0, name: hfpmodem
ofonod[592]: src/call-volume.c:ofono_call_volume_driver_register() driver: 0x54c3ecd4, name: hfpmodem
ofonod[592]: src/handsfree.c:ofono_handsfree_driver_register() driver: 0x54c3ed1c, name: hfpmodem
ofonod[592]: src/siri.c:ofono_siri_driver_register() driver: 0x54c3ed54, name: hfpmodem
ofonod[592]: src/network.c:ofono_netreg_driver_register() driver: 0x54c3ebc0, name: dunmodem
ofonod[592]: src/gprs.c:ofono_gprs_driver_register() driver: 0x54c3ebe4, name: dunmodem
ofonod[592]: src/voicecall.c:ofono_voicecall_driver_register() driver: 0x54c3eaf0, name: stemodem
ofonod[592]: src/gprs.c:ofono_gprs_context_driver_register() driver: 0x54c3eb7c, name: stemodem
ofonod[592]: src/radio-settings.c:ofono_radio_settings_driver_register() driver: 0x54c3eb40, name: stemodem
ofonod[592]: src/voicecall.c:ofono_voicecall_driver_register() driver: 0x54c3e9cc, name: ifxmodem
ofonod[592]: src/audio-settings.c:ofono_audio_settings_driver_register() driver: 0x54c3ea24, name: ifxmodem
ofonod[592]: src/radio-settings.c:ofono_radio_settings_driver_register() driver: 0x54c3ea38, name: ifxmodem
ofonod[592]: src/gprs.c:ofono_gprs_context_driver_register() driver: 0x54c3ea70, name: ifxmodem
ofonod[592]: src/stk.c:ofono_stk_driver_register() driver: 0x54c3ea9c, name: ifxmodem
ofonod[592]: src/ctm.c:ofono_ctm_driver_register() driver: 0x54c3eabc, name: ifxmodem
ofonod[592]: src/gprs.c:ofono_gprs_context_driver_register() driver: 0x54c3e958, name: hsomodem
ofonod[592]: src/radio-settings.c:ofono_radio_settings_driver_register() driver: 0x54c3e97c, name: hsomodem
ofonod[592]: src/location-reporting.c:ofono_location_reporting_driver_register() driver: 0x54c3e918, name: telitmodem
ofonod[592]: src/gprs.c:ofono_gprs_context_driver_register() driver: 0x54c3e88c, name: mbmmodem
ofonod[592]: src/stk.c:ofono_stk_driver_register() driver: 0x54c3e8b0, name: mbmmodem
ofonod[592]: src/location-reporting.c:ofono_location_reporting_driver_register() driver: 0x54c3e8d0, name: mbmmodem
ofonod[592]: src/voicecall.c:ofono_voicecall_driver_register() driver: 0x54c3e7f4, name: calypsomodem
ofonod[592]: src/stk.c:ofono_stk_driver_register() driver: 0x54c3e844, name: calypsomodem
ofonod[592]: src/ussd.c:ofono_ussd_driver_register() driver: 0x54c3e6f8, name: huaweimodem
ofonod[592]: src/voicecall.c:ofono_voicecall_driver_register() driver: 0x54c3e70c, name: huaweimodem
ofonod[592]: src/audio-settings.c:ofono_audio_settings_driver_register() driver: 0x54c3e75c, name: huaweimodem
ofonod[592]: src/radio-settings.c:ofono_radio_settings_driver_register() driver: 0x54c3e794, name: huaweimodem
ofonod[592]: src/gprs.c:ofono_gprs_context_driver_register() driver: 0x54c3e770, name: huaweimodem
ofonod[592]: src/cdma-netreg.c:ofono_cdma_netreg_driver_register() driver: 0x54c3e7c4, name: huaweimodem
ofonod[592]: src/gprs.c:ofono_gprs_context_driver_register() driver: 0x54c3e67c, name: iceramodem
ofonod[592]: src/radio-settings.c:ofono_radio_settings_driver_register() driver: 0x54c3e6a8, name: iceramodem
ofonod[592]: src/radio-settings.c:ofono_radio_settings_driver_register() driver: 0x54c3e624, name: ztemodem
ofonod[592]: src/gprs.c:ofono_gprs_context_driver_register() driver: 0x54c3e5e0, name: swmodem
ofonod[592]: src/radio-settings.c:ofono_radio_settings_driver_register() driver: 0x54c3e598, name: nwmodem
ofonod[592]: src/voicecall.c:ofono_voicecall_driver_register() driver: 0x54c3e40c, name: atmodem
ofonod[592]: src/modem.c:ofono_devinfo_driver_register() driver: 0x54c3e4a4, name: atmodem
ofonod[592]: src/call-barring.c:ofono_call_barring_driver_register() driver: 0x54c3e45c, name: atmodem
ofonod[592]: src/call-forwarding.c:ofono_call_forwarding_driver_register() driver: 0x54c3e1e4, name: atmodem
ofonod[592]: src/call-meter.c:ofono_call_meter_driver_register() driver: 0x54c3e224, name: atmodem
ofonod[592]: src/call-settings.c:ofono_call_settings_driver_register() driver: 0x54c3e130, name: atmodem
ofonod[592]: src/phonebook.c:ofono_phonebook_driver_register() driver: 0x54c3e48c, name: atmodem
ofonod[592]: src/ussd.c:ofono_ussd_driver_register() driver: 0x54c3e3e8, name: atmodem
ofonod[592]: src/sms.c:ofono_sms_driver_register() driver: 0x54c3e1a0, name: atmodem
ofonod[592]: src/sim.c:ofono_sim_driver_register() driver: 0x54c3e328, name: atmodem
ofonod[592]: src/sim.c:ofono_sim_driver_register() driver: 0x54c3e370, name: atmodem-noef
ofonod[592]: src/stk.c:ofono_stk_driver_register() driver: 0x54c3e3c0, name: atmodem
ofonod[592]: src/network.c:ofono_netreg_driver_register() driver: 0x54c3e288, name: atmodem
ofonod[592]: src/cbs.c:ofono_cbs_driver_register() driver: 0x54c3e1c8, name: atmodem
ofonod[592]: src/call-volume.c:ofono_call_volume_driver_register() driver: 0x54c3e4d4, name: atmodem
ofonod[592]: src/gprs.c:ofono_gprs_driver_register() driver: 0x54c3e504, name: atmodem
ofonod[592]: src/gprs.c:ofono_gprs_context_driver_register() driver: 0x54c3e518, name: atmodem
ofonod[592]: src/sim-auth.c:ofono_sim_auth_driver_register() driver: 0x54c3e53c, name: atmodem
ofonod[592]: src/gnss.c:ofono_gnss_driver_register() driver: 0x54c3e55c, name: atmodem
ofonod[592]: src/modem.c:ofono_modem_driver_register() driver: 0x54c3e090, name: gobi
ofonod[592]: src/modem.c:ofono_devinfo_driver_register() driver: 0x54c3ded0, name: qmimodem
ofonod[592]: src/network.c:ofono_netreg_driver_register() driver: 0x54c3df38, name: qmimodem
ofonod[592]: src/voicecall.c:ofono_voicecall_driver_register() driver: 0x54c3def0, name: qmimodem
ofonod[592]: src/sim.c:ofono_sim_driver_register() driver: 0x54c3df5c, name: qmimodem-legacy
ofonod[592]: src/sim.c:ofono_sim_driver_register() driver: 0x54c3dfa4, name: qmimodem
ofonod[592]: src/sms.c:ofono_sms_driver_register() driver: 0x54c3dfec, name: qmimodem
ofonod[592]: src/ussd.c:ofono_ussd_driver_register() driver: 0x54c3e00c, name: qmimodem
ofonod[592]: src/gprs.c:ofono_gprs_driver_register() driver: 0x54c3e020, name: qmimodem
ofonod[592]: src/gprs.c:ofono_gprs_context_driver_register() driver: 0x54c3e034, name: qmimodem
ofonod[592]: src/radio-settings.c:ofono_radio_settings_driver_register() driver: 0x54c3e050, name: qmimodem
ofonod[592]: src/location-reporting.c:ofono_location_reporting_driver_register() driver: 0x54c3e078, name: qmimodem
ofonod[592]: src/modem.c:ofono_modem_driver_register() driver: 0x54c3de68, name: u8500
ofonod[592]: src/modem.c:ofono_devinfo_driver_register() driver: 0x54c3de48, name: u8500
ofonod[592]: src/modem.c:ofono_modem_driver_register() driver: 0x54c3de00, name: n900
ofonod[592]: src/modem.c:ofono_modem_driver_register() driver: 0x54c3ddb8, name: isiusb
ofonod[592]: src/modem.c:ofono_devinfo_driver_register() driver: 0x54c3db60, name: isimodem
ofonod[592]: src/phonebook.c:ofono_phonebook_driver_register() driver: 0x54c3db50, name: isimodem
ofonod[592]: src/network.c:ofono_netreg_driver_register() driver: 0x54c3db80, name: isimodem
ofonod[592]: src/voicecall.c:ofono_voicecall_driver_register() driver: 0x54c3dba4, name: isimodem
ofonod[592]: src/sms.c:ofono_sms_driver_register() driver: 0x54c3dbec, name: isimodem
ofonod[592]: src/cbs.c:ofono_cbs_driver_register() driver: 0x54c3dc0c, name: isimodem
ofonod[592]: src/sim.c:ofono_sim_driver_register() driver: 0x54c3dc20, name: isimodem
ofonod[592]: src/ussd.c:ofono_ussd_driver_register() driver: 0x54c3dc68, name: isimodem
ofonod[592]: src/call-forwarding.c:ofono_call_forwarding_driver_register() driver: 0x54c3dc7c, name: isimodem
ofonod[592]: src/call-settings.c:ofono_call_settings_driver_register() driver: 0x54c3dc9c, name: isimodem
ofonod[592]: src/call-barring.c:ofono_call_barring_driver_register() driver: 0x54c3dccc, name: isimodem
ofonod[592]: src/call-meter.c:ofono_call_meter_driver_register() driver: 0x54c3dce4, name: isimodem
ofonod[592]: src/radio-settings.c:ofono_radio_settings_driver_register() driver: 0x54c3dd0c, name: isimodem
ofonod[592]: src/gprs.c:ofono_gprs_driver_register() driver: 0x54c3dd34, name: isimodem
ofonod[592]: src/gprs.c:ofono_gprs_context_driver_register() driver: 0x54c3dd48, name: isimodem
ofonod[592]: src/audio-settings.c:ofono_audio_settings_driver_register() driver: 0x54c3dd64, name: isimodem
ofonod[592]: src/sim.c:ofono_sim_driver_register() driver: 0x54c3dd70, name: wgmodem2.5
ofonod[592]: drivers/rilmodem/rilmodem.c:rilmodem_init()
ofonod[592]: src/modem.c:ofono_devinfo_driver_register() driver: 0x54c3d928, name: rilmodem
ofonod[592]: drivers/rilmodem/sim.c:ril_sim_init()
ofonod[592]: src/sim.c:ofono_sim_driver_register() driver: 0x54c3d9fc, name: rilmodem
ofonod[592]: src/voicecall.c:ofono_voicecall_driver_register() driver: 0x54c3d96c, name: rilmodem
ofonod[592]: src/sms.c:ofono_sms_driver_register() driver: 0x54c3da44, name: rilmodem
ofonod[592]: src/network.c:ofono_netreg_driver_register() driver: 0x54c3d948, name: rilmodem
ofonod[592]: src/call-volume.c:ofono_call_volume_driver_register() driver: 0x54c3d9b4, name: rilmodem
ofonod[592]: src/gprs.c:ofono_gprs_driver_register() driver: 0x54c3d9cc, name: rilmodem
ofonod[592]: src/gprs.c:ofono_gprs_context_driver_register() driver: 0x54c3d9e0, name: rilmodem
ofonod[592]: src/ussd.c:ofono_ussd_driver_register() driver: 0x54c3da64, name: rilmodem
ofonod[592]: src/call-settings.c:ofono_call_settings_driver_register() driver: 0x54c3da78, name: rilmodem
ofonod[592]: src/call-forwarding.c:ofono_call_forwarding_driver_register() driver: 0x54c3daa8, name: rilmodem
ofonod[592]: src/radio-settings.c:ofono_radio_settings_driver_register() driver: 0x54c3dac8, name: rilmodem
ofonod[592]: src/call-barring.c:ofono_call_barring_driver_register() driver: 0x54c3daf0, name: rilmodem
ofonod[592]: src/netmon.c:ofono_netmon_driver_register() driver: 0x54c3db08, name: rilmodem
ofonod[592]: src/stk.c:ofono_stk_driver_register() driver: 0x54c3db18, name: rilmodem
ofonod[592]: src/modem.c:ofono_modem_driver_register() driver: 0x54c3d8c0, name: ril_sofia3gr
ofonod[592]: src/modem.c:ofono_modem_driver_register() driver: 0x54c3d878, name: infineon
ofonod[592]: src/modem.c:ofono_modem_driver_register() driver: 0x54c3d830, name: ril
ofonod[592]: plugins/udevng.c:udev_start()
ofonod[592]: plugins/udevng.c:enumerate_devices()
ofonod[592]: plugins/udevng.c:check_usb_device() hub [(null):(null)]
ofonod[592]: plugins/udevng.c:check_usb_device() hub [(null):(null)]
ofonod[592]: plugins/udevng.c:check_usb_device() usb [0424:2514]
ofonod[592]: plugins/udevng.c:check_usb_device() usb [1bc7:1101]
ofonod[592]: plugins/udevng.c:check_usb_device() option [(null):(null)]
ofonod[592]: plugins/udevng.c:check_usb_device() option [1bc7:1101]
ofonod[592]: plugins/udevng.c:add_device() /sys/devices/soc0/soc/2100000.aips-bus/2184200.usb/ci_hdrc.1/usb2/2-1/2-1.3
ofonod[592]: plugins/udevng.c:add_device() /sys/devices/soc0/soc/2100000.aips-bus/2184200.usb/ci_hdrc.1/usb2/2-1/2-1.3/2-1.3:1.0/ttyUSB0/tty/ttyUSB0
ofonod[592]: plugins/udevng.c:add_device() /dev/ttyUSB0 (telit) 255/255/255 [00] ==> (null) (null)
ofonod[592]: plugins/udevng.c:check_usb_device() option [(null):(null)]
ofonod[592]: plugins/udevng.c:check_usb_device() option [1bc7:1101]
ofonod[592]: plugins/udevng.c:add_device() /sys/devices/soc0/soc/2100000.aips-bus/2184200.usb/ci_hdrc.1/usb2/2-1/2-1.3
ofonod[592]: plugins/udevng.c:add_device() /sys/devices/soc0/soc/2100000.aips-bus/2184200.usb/ci_hdrc.1/usb2/2-1/2-1.3/2-1.3:1.1/ttyUSB1/tty/ttyUSB1
ofonod[592]: plugins/udevng.c:add_device() /dev/ttyUSB1 (telit) 255/255/255 [01] ==> (null) (null)
ofonod[592]: plugins/udevng.c:check_usb_device() option [(null):(null)]
ofonod[592]: plugins/udevng.c:check_usb_device() option [1bc7:1101]
ofonod[592]: plugins/udevng.c:add_device() /sys/devices/soc0/soc/2100000.aips-bus/2184200.usb/ci_hdrc.1/usb2/2-1/2-1.3
ofonod[592]: plugins/udevng.c:add_device() /sys/devices/soc0/soc/2100000.aips-bus/2184200.usb/ci_hdrc.1/usb2/2-1/2-1.3/2-1.3:1.2/ttyUSB2/tty/ttyUSB2
ofonod[592]: plugins/udevng.c:add_device() /dev/ttyUSB2 (telit) 255/254/255 [02] ==> (null) (null)
ofonod[592]: plugins/udevng.c:check_usb_device() option [(null):(null)]
ofonod[592]: plugins/udevng.c:check_usb_device() option [1bc7:1101]
ofonod[592]: plugins/udevng.c:add_device() /sys/devices/soc0/soc/2100000.aips-bus/2184200.usb/ci_hdrc.1/usb2/2-1/2-1.3
ofonod[592]: plugins/udevng.c:add_device() /sys/devices/soc0/soc/2100000.aips-bus/2184200.usb/ci_hdrc.1/usb2/2-1/2-1.3/2-1.3:1.3/ttyUSB3/tty/ttyUSB3
ofonod[592]: plugins/udevng.c:add_device() /dev/ttyUSB3 (telit) 255/255/255 [03] ==> (null) (null)
ofonod[592]: plugins/udevng.c:check_usb_device() hub [(null):(null)]
ofonod[592]: plugins/udevng.c:create_modem() /sys/devices/soc0/soc/2100000.aips-bus/2184200.usb/ci_hdrc.1/usb2/2-1/2-1.3
ofonod[592]: plugins/udevng.c:create_modem() driver=telit
ofonod[592]: src/modem.c:ofono_modem_create() name: (null), type: telit
ofonod[592]: plugins/udevng.c:setup_telit() /sys/devices/soc0/soc/2100000.aips-bus/2184200.usb/ci_hdrc.1/usb2/2-1/2-1.3
ofonod[592]: plugins/udevng.c:setup_telit() /dev/ttyUSB0 255/255/255 00 (null)
ofonod[592]: plugins/udevng.c:setup_telit() /dev/ttyUSB1 255/255/255 01 (null)
ofonod[592]: plugins/udevng.c:setup_telit() /dev/ttyUSB2 255/254/255 02 (null)
ofonod[592]: plugins/udevng.c:setup_telit() /dev/ttyUSB3 255/255/255 03 (null)
ofonod[592]: plugins/udevng.c:setup_telit() modem=/dev/ttyUSB0 aux=/dev/ttyUSB3 gps=(null) diag=/dev/ttyUSB1
ofonod[592]: src/modem.c:set_modem_property() modem 0x55d8e3d8 property Modem
ofonod[592]: src/modem.c:set_modem_property() modem 0x55d8e3d8 property Aux
ofonod[592]: src/modem.c:set_modem_property() modem 0x55d8e3d8 property GPS
ofonod[592]: src/modem.c:ofono_modem_register() 0x55d8e3d8
1 year
[PATCH] gatmux: don't free cmux data until watchers are destroyed
by Martin Hundebøll
When closing down a cmux object, the address sanitizer detects a
use-after-free in gatmux.c (see below).
Avoid this by taking a reference to the mux object during the processing
in received_data().
ofonod[3640549]: ../git/plugins/quectel.c:cfun_disable() 0x610000000b40
ofonod[3640549]: ../git/plugins/quectel.c:close_serial() 0x610000000b40
ofonod[3640549]: ../git/plugins/quectel.c:close_mux() 0x610000000b40
ofonod[3640549]: ../git/examples/emulator.c:powered_watch() Removing modem 0x610000000b40 from the list
ofonod[3640549]: ../git/examples/emulator.c:powered_watch() Removing server watch: 106
ofonod[3640549]: ../git/src/modem.c:modem_change_state() old state: 0, new state: 0
=================================================================
==3640549==ERROR: AddressSanitizer: heap-use-after-free on address 0x62100073dd28 at pc 0x5566b6402a21 bp 0x7ffe7a2db0e0 sp 0x7ffe7a2db0d0
READ of size 8 at 0x62100073dd28 thread T0
#0 0x5566b6402a20 in debug ../git/gatchat/gatmux.c:109
#1 0x5566b6404bd7 in channel_close ../git/gatchat/gatmux.c:525
#2 0x7fa0516e44a6 in g_io_channel_shutdown (/usr/lib/libglib-2.0.so.0+0x774a6)
#3 0x7fa0516e4644 in g_io_channel_unref (/usr/lib/libglib-2.0.so.0+0x77644)
#4 0x5566b64048a4 in watch_finalize ../git/gatchat/gatmux.c:474
#5 0x7fa0516d6f6f (/usr/lib/libglib-2.0.so.0+0x69f6f)
#6 0x7fa0516ac6a7 in g_slist_foreach (/usr/lib/libglib-2.0.so.0+0x3f6a7)
#7 0x7fa0516b277b in g_slist_free_full (/usr/lib/libglib-2.0.so.0+0x4577b)
#8 0x5566b6403413 in dispatch_sources ../git/gatchat/gatmux.c:224
#9 0x5566b64039ea in received_data ../git/gatchat/gatmux.c:268
#10 0x7fa0516d727e in g_main_context_dispatch (/usr/lib/libglib-2.0.so.0+0x6a27e)
#11 0x7fa0516d91c0 (/usr/lib/libglib-2.0.so.0+0x6c1c0)
#12 0x7fa0516da0d2 in g_main_loop_run (/usr/lib/libglib-2.0.so.0+0x6d0d2)
#13 0x5566b6429b1b in main ../git/src/main.c:286
#14 0x7fa05147fee2 in __libc_start_main (/usr/lib/libc.so.6+0x26ee2)
#15 0x5566b62531ad in _start (/home/martin/projects/ofono/x86/src/ofonod+0xfc1ad)
0x62100073dd28 is located 40 bytes inside of 4672-byte region [0x62100073dd00,0x62100073ef40)
freed by thread T0 here:
#0 0x7fa0519256c0 in __interceptor_free /build/gcc/src/gcc/libsanitizer/asan/asan_malloc_linux.cc:122
#1 0x5566b64052d7 in g_at_mux_unref ../git/gatchat/gatmux.c:645
#2 0x5566b63d6d19 in close_mux ../git/plugins/quectel.c:199
#3 0x5566b63d7047 in close_serial ../git/plugins/quectel.c:223
#4 0x5566b63db62a in cfun_disable ../git/plugins/quectel.c:1056
#5 0x5566b63f6ae1 in at_chat_finish_command ../git/gatchat/gatchat.c:459
#6 0x5566b63f701b in at_chat_handle_command_response ../git/gatchat/gatchat.c:521
#7 0x5566b63f785b in have_line ../git/gatchat/gatchat.c:600
#8 0x5566b63f87f1 in new_bytes ../git/gatchat/gatchat.c:759
#9 0x5566b640174c in received_data ../git/gatchat/gatio.c:122
#10 0x5566b64047b4 in watch_dispatch ../git/gatchat/gatmux.c:464
#11 0x5566b640313b in dispatch_sources ../git/gatchat/gatmux.c:183
#12 0x5566b64039ea in received_data ../git/gatchat/gatmux.c:268
#13 0x7fa0516d727e in g_main_context_dispatch (/usr/lib/libglib-2.0.so.0+0x6a27e)
previously allocated by thread T0 here:
#0 0x7fa051925ce8 in __interceptor_calloc /build/gcc/src/gcc/libsanitizer/asan/asan_malloc_linux.cc:153
#1 0x5566b6405009 in g_at_mux_new ../git/gatchat/gatmux.c:606
#2 0x5566b6407f6b in g_at_mux_new_gsm0710_basic ../git/gatchat/gatmux.c:1165
#3 0x5566b63da9ba in cmux_cb ../git/plugins/quectel.c:882
#4 0x5566b63f6ae1 in at_chat_finish_command ../git/gatchat/gatchat.c:459
#5 0x5566b63f701b in at_chat_handle_command_response ../git/gatchat/gatchat.c:521
#6 0x5566b63f785b in have_line ../git/gatchat/gatchat.c:600
#7 0x5566b63f87f1 in new_bytes ../git/gatchat/gatchat.c:759
#8 0x5566b640174c in received_data ../git/gatchat/gatio.c:122
#9 0x7fa0516d727e in g_main_context_dispatch (/usr/lib/libglib-2.0.so.0+0x6a27e)
SUMMARY: AddressSanitizer: heap-use-after-free ../git/gatchat/gatmux.c:109 in debug
Shadow bytes around the buggy address:
0x0c42800dfb50: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c42800dfb60: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c42800dfb70: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c42800dfb80: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c42800dfb90: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
=>0x0c42800dfba0: fd fd fd fd fd[fd]fd fd fd fd fd fd fd fd fd fd
0x0c42800dfbb0: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
0x0c42800dfbc0: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
0x0c42800dfbd0: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
0x0c42800dfbe0: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
0x0c42800dfbf0: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
Shadow byte legend (one shadow byte represents 8 application bytes):
Addressable: 00
Partially addressable: 01 02 03 04 05 06 07
Heap left redzone: fa
Freed heap region: fd
Stack left redzone: f1
Stack mid redzone: f2
Stack right redzone: f3
Stack after return: f5
Stack use after scope: f8
Global redzone: f9
Global init order: f6
Poisoned by user: f7
Container overflow: fc
Array cookie: ac
Intra object redzone: bb
ASan internal: fe
Left alloca redzone: ca
Right alloca redzone: cb
Shadow gap: cc
==3640549==ABORTING
---
gatchat/gatmux.c | 32 +++++++++++++++++++++++++++-----
1 file changed, 27 insertions(+), 5 deletions(-)
diff --git a/gatchat/gatmux.c b/gatchat/gatmux.c
index 757a5123..eabaa4db 100644
--- a/gatchat/gatmux.c
+++ b/gatchat/gatmux.c
@@ -227,12 +227,15 @@ static void dispatch_sources(GAtMuxChannel *channel, GIOCondition condition)
static gboolean received_data(GIOChannel *channel, GIOCondition cond,
gpointer data)
{
- GAtMux *mux = data;
+ GAtMux *mux = g_at_mux_ref(data);
int i;
GIOStatus status;
gsize bytes_read;
if (cond & G_IO_NVAL)
+ goto out_done;
+
+ if (mux->shutdown)
return FALSE;
debug(mux, "received data");
@@ -270,15 +273,22 @@ static gboolean received_data(GIOChannel *channel, GIOCondition cond,
}
if (cond & (G_IO_HUP | G_IO_ERR))
- return FALSE;
+ goto out_done;
if (status != G_IO_STATUS_NORMAL && status != G_IO_STATUS_AGAIN)
- return FALSE;
+ goto out_done;
if (mux->buf_used == sizeof(mux->buf))
- return FALSE;
+ goto out_done;
+
+ g_at_mux_unref(mux);
return TRUE;
+
+out_done:
+ g_at_mux_unref(mux);
+
+ return FALSE;
}
static void write_watcher_destroy_notify(gpointer user_data)
@@ -286,6 +296,9 @@ static void write_watcher_destroy_notify(gpointer user_data)
GAtMux *mux = user_data;
mux->write_watch = 0;
+
+ if (mux->read_watch <= 0 && mux->write_watch <= 0)
+ g_free(mux);
}
static gboolean can_write_data(GIOChannel *chan, GIOCondition cond,
@@ -297,6 +310,9 @@ static gboolean can_write_data(GIOChannel *chan, GIOCondition cond,
if (cond & (G_IO_NVAL | G_IO_HUP | G_IO_ERR))
return FALSE;
+ if (mux->shutdown)
+ return FALSE;
+
debug(mux, "can write data");
for (dlc = 0; dlc < MAX_CHANNELS; dlc += 1) {
@@ -607,6 +623,7 @@ GAtMux *g_at_mux_new(GIOChannel *channel, const GAtMuxDriver *driver)
if (mux == NULL)
return NULL;
+
mux->ref_count = 1;
mux->driver = driver;
mux->shutdown = TRUE;
@@ -642,7 +659,8 @@ void g_at_mux_unref(GAtMux *mux)
if (mux->driver->remove)
mux->driver->remove(mux);
- g_free(mux);
+ if (mux->read_watch <= 0 && mux->write_watch <= 0)
+ g_free(mux);
}
}
@@ -651,6 +669,9 @@ static void read_watcher_destroy_notify(gpointer user_data)
GAtMux *mux = user_data;
mux->read_watch = 0;
+
+ if (mux->read_watch <= 0 && mux->write_watch <= 0)
+ g_free(mux);
}
gboolean g_at_mux_start(GAtMux *mux)
@@ -695,6 +716,7 @@ gboolean g_at_mux_shutdown(GAtMux *mux)
continue;
channel_close((GIOChannel *) mux->dlcs[i], NULL);
+ mux->dlcs[i] = NULL;
}
if (mux->driver->shutdown)
--
2.23.0
1 year, 4 months
[PATCH] ublox: netreg: Also subscribe to UREG URC's
by richard.rojfors@gmail.com
From: Richard Röjfors <richard(a)puffinpack.se>
It turns out that both L2xx and L4xx modems are a bit
buggy when it comes to send CREG URC's when the tech changes.
Try to overcome this by subscribing to both UREG and CREG,
and poll the other when any of the URC's are received.
Protect from doing simultanious polls though.
---
drivers/ubloxmodem/network-registration.c | 198 ++++++++++++++++------
1 file changed, 148 insertions(+), 50 deletions(-)
diff --git a/drivers/ubloxmodem/network-registration.c b/drivers/ubloxmodem/network-registration.c
index 69af4644..ad905fb3 100644
--- a/drivers/ubloxmodem/network-registration.c
+++ b/drivers/ubloxmodem/network-registration.c
@@ -47,11 +47,15 @@
static const char *none_prefix[] = { NULL };
static const char *cmer_prefix[] = { "+CMER:", NULL };
static const char *ureg_prefix[] = { "+UREG:", NULL };
+static const char *creg_prefix[] = { "+CREG:", NULL };
+
+#define UBLOX_UPDATING_STATUS 0x01
struct netreg_data {
struct at_netreg_data at_data;
const struct ublox_model *model;
+ int flags;
};
struct tech_query {
@@ -213,13 +217,72 @@ static void ctze_notify(GAtResult *result, gpointer user_data)
ofono_netreg_time_notify(netreg, &nd->time);
}
-static void ublox_query_tech_cb(gboolean ok, GAtResult *result,
+static int ublox_ureg_state_to_tech(int state)
+{
+ switch (state) {
+ case 1:
+ return ACCESS_TECHNOLOGY_GSM;
+ case 2:
+ return ACCESS_TECHNOLOGY_GSM_EGPRS;
+ case 3:
+ return ACCESS_TECHNOLOGY_UTRAN;
+ case 4:
+ return ACCESS_TECHNOLOGY_UTRAN_HSDPA;
+ case 5:
+ return ACCESS_TECHNOLOGY_UTRAN_HSUPA;
+ case 6:
+ return ACCESS_TECHNOLOGY_UTRAN_HSDPA_HSUPA;
+ case 7:
+ return ACCESS_TECHNOLOGY_EUTRAN;
+ case 8:
+ return ACCESS_TECHNOLOGY_GSM;
+ case 9:
+ return ACCESS_TECHNOLOGY_GSM_EGPRS;
+ default:
+ /* Not registered for PS (0) or something unknown (>9)... */
+ return -1;
+ }
+}
+
+static gboolean is_registered(int status)
+{
+ return status == NETWORK_REGISTRATION_STATUS_REGISTERED ||
+ status == NETWORK_REGISTRATION_STATUS_ROAMING;
+}
+
+static void ublox_creg_cb(gboolean ok, GAtResult *result,
+ gpointer user_data)
+{
+ struct tech_query *tq = user_data;
+ struct netreg_data *nd = ofono_netreg_get_data(tq->netreg);
+ int status, lac, ci, tech;
+
+ nd->flags &= ~UBLOX_UPDATING_STATUS;
+
+ if (!ok)
+ return;
+
+ if (at_util_parse_reg(result, "+CREG:", NULL, &status,
+ &lac, &ci, &tech, OFONO_VENDOR_GENERIC) == FALSE)
+ return;
+
+ /* The query provided a tech, use that */
+ if (is_registered(status) && tq->tech != -1)
+ tech = tq->tech;
+
+ ofono_netreg_status_notify(tq->netreg, status, lac, ci, tech);
+}
+
+static void ublox_ureg_cb(gboolean ok, GAtResult *result,
gpointer user_data)
{
struct tech_query *tq = user_data;
+ struct netreg_data *nd = ofono_netreg_get_data(tq->netreg);
GAtResultIter iter;
gint enabled, state;
- int tech = -1;
+ int tech = tq->tech;
+
+ nd->flags &= ~UBLOX_UPDATING_STATUS;
if (!ok)
goto error;
@@ -235,48 +298,49 @@ static void ublox_query_tech_cb(gboolean ok, GAtResult *result,
if (!g_at_result_iter_next_number(&iter, &state))
return;
- switch (state) {
- case 0:
- /* Not registered for PS, then we have to trust CREG... */
- tech = tq->tech;
- break;
- case 1:
- tech = ACCESS_TECHNOLOGY_GSM;
- break;
- case 2:
- tech = ACCESS_TECHNOLOGY_GSM_EGPRS;
- break;
- case 3:
- tech = ACCESS_TECHNOLOGY_UTRAN;
- break;
- case 4:
- tech = ACCESS_TECHNOLOGY_UTRAN_HSDPA;
- break;
- case 5:
- tech = ACCESS_TECHNOLOGY_UTRAN_HSUPA;
- break;
- case 6:
- tech = ACCESS_TECHNOLOGY_UTRAN_HSDPA_HSUPA;
- break;
- case 7:
- tech = ACCESS_TECHNOLOGY_EUTRAN;
- break;
- case 8:
- tech = ACCESS_TECHNOLOGY_GSM;
- break;
- case 9:
- tech = ACCESS_TECHNOLOGY_GSM_EGPRS;
- break;
- default:
- /* Not registered for PS or something unknown, trust CREG... */
+ tech = ublox_ureg_state_to_tech(state);
+ if (tech < 0)
+ /* No valid UREG status, we have to trust CREG... */
tech = tq->tech;
- }
error:
ofono_netreg_status_notify(tq->netreg,
tq->status, tq->lac, tq->ci, tech);
}
+static void ureg_notify(GAtResult *result, gpointer user_data)
+{
+ struct ofono_netreg *netreg = user_data;
+ int state;
+ struct netreg_data *nd = ofono_netreg_get_data(netreg);
+ struct tech_query *tq;
+ GAtResultIter iter;
+
+ if (nd->flags & UBLOX_UPDATING_STATUS)
+ return;
+
+ g_at_result_iter_init(&iter, result);
+
+ if (!g_at_result_iter_next(&iter, "+UREG:"))
+ return;
+
+ if (!g_at_result_iter_next_number(&iter, &state))
+ return;
+
+ tq = g_new0(struct tech_query, 1);
+
+ tq->tech = ublox_ureg_state_to_tech(state);
+ tq->netreg = netreg;
+
+ if (g_at_chat_send(nd->at_data.chat, "AT+CREG?", creg_prefix,
+ ublox_creg_cb, tq, g_free) > 0) {
+ nd->flags |= UBLOX_UPDATING_STATUS;
+ return;
+ }
+
+ g_free(tq);
+}
+
static void creg_notify(GAtResult *result, gpointer user_data)
{
struct ofono_netreg *netreg = user_data;
@@ -284,11 +348,14 @@ static void creg_notify(GAtResult *result, gpointer user_data)
struct netreg_data *nd = ofono_netreg_get_data(netreg);
struct tech_query *tq;
+ if (nd->flags & UBLOX_UPDATING_STATUS)
+ return;
+
if (at_util_parse_reg_unsolicited(result, "+CREG:", &status,
&lac, &ci, &tech, OFONO_VENDOR_GENERIC) == FALSE)
return;
- if (status != 1 && status != 5)
+ if (!is_registered(status))
goto notify;
if (ublox_is_toby_l4(nd->model) || ublox_is_toby_l2(nd->model)) {
@@ -301,13 +368,15 @@ static void creg_notify(GAtResult *result, gpointer user_data)
tq->netreg = netreg;
if (g_at_chat_send(nd->at_data.chat, "AT+UREG?", ureg_prefix,
- ublox_query_tech_cb, tq, g_free) > 0)
+ ublox_ureg_cb, tq, g_free) > 0) {
+ nd->flags |= UBLOX_UPDATING_STATUS;
return;
+ }
g_free(tq);
}
- if ((status == 1 || status == 5) && tech == -1)
+ if (tech == -1)
tech = nd->at_data.tech;
notify:
@@ -322,24 +391,56 @@ static void at_cmer_not_supported(struct ofono_netreg *netreg)
ofono_netreg_remove(netreg);
}
+static void ublox_finish_registration(struct ofono_netreg *netreg)
+{
+ struct netreg_data *nd = ofono_netreg_get_data(netreg);
+
+ if (ublox_is_toby_l4(nd->model) || ublox_is_toby_l2(nd->model))
+ g_at_chat_register(nd->at_data.chat, "+UREG:",
+ ureg_notify, FALSE, netreg, NULL);
+
+ g_at_chat_register(nd->at_data.chat, "+CIEV:",
+ ciev_notify, FALSE, netreg, NULL);
+
+ g_at_chat_register(nd->at_data.chat, "+CREG:",
+ creg_notify, FALSE, netreg, NULL);
+
+ ofono_netreg_register(netreg);
+}
+
+static void ublox_ureg_set_cb(gboolean ok,
+ GAtResult *result, gpointer user_data)
+{
+ struct ofono_netreg *netreg = user_data;
+
+ if (!ok) {
+ ofono_error("Unable to initialize Network Registration");
+ ofono_netreg_remove(netreg);
+ return;
+ }
+
+ ublox_finish_registration(netreg);
+}
+
static void ublox_cmer_set_cb(gboolean ok,
GAtResult *result, gpointer user_data)
{
struct ofono_netreg *netreg = user_data;
- struct at_netreg_data *nd = ofono_netreg_get_data(netreg);
+ struct netreg_data *nd = ofono_netreg_get_data(netreg);
if (!ok) {
at_cmer_not_supported(netreg);
return;
}
- g_at_chat_register(nd->chat, "+CIEV:",
- ciev_notify, FALSE, netreg, NULL);
+ if (ublox_is_toby_l4(nd->model) || ublox_is_toby_l2(nd->model)) {
+ g_at_chat_send(nd->at_data.chat, "AT+UREG=1", none_prefix,
+ ublox_ureg_set_cb, netreg, NULL);
- g_at_chat_register(nd->chat, "+CREG:",
- creg_notify, FALSE, netreg, NULL);
+ return;
+ }
- ofono_netreg_register(netreg);
+ ublox_finish_registration(netreg);
}
static void ublox_creg_set_cb(gboolean ok,
@@ -354,12 +455,9 @@ static void ublox_creg_set_cb(gboolean ok,
return;
}
- if (ublox_is_toby_l4(nd->model)) {
+ if (ublox_is_toby_l4(nd->model))
/* FIXME */
ofono_error("TOBY L4 requires polling of ECSQ");
- ofono_error("TOBY L4 wants UREG notifications for"
- " tech updates");
- }
/* Register for network time update reports */
if (ublox_is_toby_l2(nd->model)) {
--
2.20.1
1 year, 5 months
[PATCH 1/4] atmodem: sim: remove quectel serial vendor quirk
by Martin Hundebøll
The sim inserted/initialized state is handled properly in the quectel
plugin now, so remove the "auto-initialized" quirk from the atmodem
sim driver.
---
drivers/atmodem/sim.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/drivers/atmodem/sim.c b/drivers/atmodem/sim.c
index dd42cac4..e750a139 100644
--- a/drivers/atmodem/sim.c
+++ b/drivers/atmodem/sim.c
@@ -1354,7 +1354,6 @@ static void at_pin_send_cb(gboolean ok, GAtResult *result,
case OFONO_VENDOR_HUAWEI:
case OFONO_VENDOR_SIMCOM:
case OFONO_VENDOR_SIERRA:
- case OFONO_VENDOR_QUECTEL_SERIAL:
/*
* On ZTE modems, after pin is entered, SIM state is checked
* by polling CPIN as their modem doesn't provide unsolicited
--
2.23.0
1 year, 5 months
[PATCHv2 1/2] quectel: rework sim detection
by Martin Hundebøll
Use at_util_sim_state_query_new() to query the sim inserted state. Once
that returns, the locked state is queried by issuing a AT+CPIN? command.
If not locked, a timer is started to query the quectel init status of
the sim. Once the init status is ready, the sim atom is created, and the
modem is set to powered, and the sim is signaled both inserted, and
initialized.
If locked, the modem is set to powered, and the sim atom is created.
This allows users to enter the pin to unlock the sim. Once the sim is
unlocked, a +CPIN: READY indication is caught to query the quectel
init status. Once the init status is ready, the sim is signaled
initialized.
All the above is needed, because the modem indicated +CPIN: READY before
the sim is really ready. The only way to be certain, is to wait for the
quectel init status to be ready. Even signaling the sim inserted
prematurely can cause to modem to hang during the initial AT+CRSM
commands.
---
Changes since v1:
* use at_util_sim_state_query_new() during .enable()
* query CPIN? locked/unlocked after sim_state_query()
* avoid sending at commands in .pre_sim()
plugins/quectel.c | 255 +++++++++++++++++-----------------------------
1 file changed, 94 insertions(+), 161 deletions(-)
diff --git a/plugins/quectel.c b/plugins/quectel.c
index a0e435b5..f19065b2 100644
--- a/plugins/quectel.c
+++ b/plugins/quectel.c
@@ -84,22 +84,15 @@ enum quectel_model {
QUECTEL_MC60,
};
-enum quectel_state {
- QUECTEL_STATE_INITIALIZING = 0,
- QUECTEL_STATE_POST_SIM,
- QUECTEL_STATE_READY,
- QUECTEL_STATE_INITIALIZED,
-};
-
struct quectel_data {
GAtChat *modem;
GAtChat *aux;
enum ofono_vendor vendor;
enum quectel_model model;
- enum quectel_state state;
- struct ofono_sim *sim;
- enum ofono_sim_state sim_state;
+ struct at_util_sim_state_query *sim_state_query;
unsigned int sim_watch;
+ bool sim_locked;
+ bool sim_ready;
/* used by quectel uart driver */
GAtChat *uart;
@@ -195,6 +188,7 @@ static void quectel_remove(struct ofono_modem *modem)
ofono_modem_set_data(modem, NULL);
l_timeout_remove(data->init_timeout);
l_gpio_writer_free(data->gpio);
+ at_util_sim_state_query_free(data->sim_state_query);
g_at_chat_unref(data->aux);
g_at_chat_unref(data->modem);
g_at_chat_unref(data->uart);
@@ -238,6 +232,9 @@ static void close_serial(struct ofono_modem *modem)
DBG("%p", modem);
+ at_util_sim_state_query_free(data->sim_state_query);
+ data->sim_state_query = NULL;
+
g_at_chat_unref(data->aux);
data->aux = NULL;
@@ -534,6 +531,7 @@ static void dbus_hw_enable(struct ofono_modem *modem)
static void qinistat_cb(gboolean ok, GAtResult *result, gpointer user_data)
{
struct ofono_modem *modem = user_data;
+ struct ofono_sim *sim = ofono_modem_get_sim(modem);
struct quectel_data *data = ofono_modem_get_data(modem);
GAtResultIter iter;
int ready = 0;
@@ -574,42 +572,13 @@ static void qinistat_cb(gboolean ok, GAtResult *result, gpointer user_data)
l_timeout_remove(data->init_timeout);
data->init_timeout = NULL;
- if (data->sim_state == OFONO_SIM_STATE_READY) {
- /*
- * when initializing with a non-locked sim card, the sim atom
- * isn't created until now to avoid accessing it before the
- * modem is ready.
- *
- * call ofono_modem_set_powered() to make ofono call
- * quectel_pre_sim() where the sim atom is created.
- */
- ofono_modem_set_powered(modem, true);
- } else {
- /*
- * When initialized with a locked sim card, the modem is already
- * powered up, and the inserted signal has been sent to allow
- * the pin to be entered. So simply update the state, and notify
- * about the finished initialization below.
- */
- data->sim_state = OFONO_SIM_STATE_READY;
- }
-
- ofono_sim_initialized_notify(data->sim);
-
- /*
- * If quectel_post_sim() has not yet been called, then postpone atom
- * creation until it is called. Otherwise create the atoms now.
- */
- if (data->state != QUECTEL_STATE_POST_SIM) {
- data->state = QUECTEL_STATE_READY;
+ if (data->sim_locked) {
+ ofono_sim_initialized_notify(sim);
return;
}
- ofono_sms_create(modem, data->vendor, "atmodem", data->aux);
- ofono_phonebook_create(modem, data->vendor, "atmodem", data->aux);
- ofono_voicecall_create(modem, data->vendor, "atmodem", data->aux);
- ofono_call_volume_create(modem, data->vendor, "atmodem", data->aux);
- data->state = QUECTEL_STATE_INITIALIZED;
+ data->sim_ready = true;
+ ofono_modem_set_powered(modem, TRUE);
}
static void init_timer_cb(struct l_timeout *timeout, void *user_data)
@@ -627,118 +596,94 @@ static void sim_watch_cb(GAtResult *result, void *user_data)
{
struct ofono_modem *modem = user_data;
struct quectel_data *data = ofono_modem_get_data(modem);
+ GAtResultIter iter;
+ const char *cpin;
DBG("%p", modem);
- g_at_chat_unregister(data->aux, data->sim_watch);
- data->sim_watch = 0;
+ g_at_result_iter_init(&iter, result);
- data->init_timeout = l_timeout_create_ms(500, init_timer_cb, modem, NULL);
- if (!data->init_timeout) {
- close_serial(modem);
+ if (!g_at_result_iter_next(&iter, "+CPIN:"))
return;
- }
-}
-static enum ofono_sim_state cme_parse(GAtResult *result)
-{
- struct ofono_error error;
+ g_at_result_iter_next_unquoted_string(&iter, &cpin);
- decode_at_error(&error, g_at_result_final_response(result));
+ if (g_strcmp0(cpin, "READY") != 0)
+ return;
- if (error.type != OFONO_ERROR_TYPE_CME)
- return OFONO_SIM_STATE_RESETTING;
-
- switch (error.error) {
- case 5:
- case 6:
- case 7:
- case 11:
- case 12:
- case 17:
- case 18:
- return OFONO_SIM_STATE_LOCKED_OUT;
- case 10:
- return OFONO_SIM_STATE_NOT_PRESENT;
- case 13:
- case 14:
- case 15:
- return OFONO_SIM_STATE_RESETTING;
- default:
- ofono_error("unknown cpin error: %i", error.error);
- return OFONO_SIM_STATE_RESETTING;
- }
+ g_at_chat_unregister(data->aux, data->sim_watch);
+ data->sim_watch = 0;
+
+ data->init_timeout = l_timeout_create_ms(500, init_timer_cb, modem, NULL);
}
-static enum ofono_sim_state cpin_parse(GAtResult *result)
+static void cpin_cb(gboolean ok, GAtResult *result, gpointer user_data)
{
+ struct ofono_modem *modem = user_data;
+ struct quectel_data *data = ofono_modem_get_data(modem);
+ const char *path = ofono_modem_get_path(modem);
GAtResultIter iter;
const char *cpin;
+ DBG("%p", modem);
+
+ if (!ok) {
+ close_serial(modem);
+ return;
+ }
+
g_at_result_iter_init(&iter, result);
- if (!g_at_result_iter_next(&iter, "+CPIN:"))
- return OFONO_SIM_STATE_RESETTING;
+ if (!g_at_result_iter_next(&iter, "+CPIN:")) {
+ close_serial(modem);
+ return;
+ }
g_at_result_iter_next_unquoted_string(&iter, &cpin);
- if (g_strcmp0(cpin, "NOT INSERTED") == 0)
- return OFONO_SIM_STATE_NOT_PRESENT;
+ if (g_strcmp0(cpin, "READY") == 0) {
+ data->init_timeout = l_timeout_create_ms(500, init_timer_cb,
+ modem, NULL);
+ return;
+ }
- if (g_strcmp0(cpin, "READY") == 0)
- return OFONO_SIM_STATE_READY;
+ if (g_strcmp0(cpin, "SIM PIN") != 0) {
+ close_serial(modem);
+ return;
+ }
- return OFONO_SIM_STATE_LOCKED_OUT;
+ ofono_info("%s: sim locked", path);
+ data->sim_locked = true;
+ data->sim_watch = g_at_chat_register(data->aux, "+CPIN:",
+ sim_watch_cb, FALSE,
+ modem, NULL);
+ ofono_modem_set_powered(modem, TRUE);
}
-static void cpin_query(gboolean ok, GAtResult *result, gpointer user_data)
+static void sim_state_cb(gboolean present, gpointer user_data)
{
struct ofono_modem *modem = user_data;
struct quectel_data *data = ofono_modem_get_data(modem);
+ const char *path = ofono_modem_get_path(modem);
- DBG("%p ok %i", modem, ok);
+ DBG("%p present %d", modem, present);
- if (ok)
- data->sim_state = cpin_parse(result);
- else
- data->sim_state = cme_parse(result);
-
- /* Turn off the radio. */
- g_at_chat_send(data->aux, "AT+CFUN=4", none_prefix, NULL, NULL, NULL);
-
- switch (data->sim_state) {
- case OFONO_SIM_STATE_LOCKED_OUT:
- ofono_modem_set_powered(modem, true);
- data->sim_watch = g_at_chat_register(data->aux, "+CPIN: READY",
- sim_watch_cb, FALSE,
- modem, NULL);
- if (!data->sim_watch) {
- ofono_error("failed to create sim watch");
- close_serial(modem);
- return;
- }
- break;
- case OFONO_SIM_STATE_READY:
- data->init_timeout = l_timeout_create_ms(500, init_timer_cb,
- modem, NULL);
- if (!data->init_timeout) {
- ofono_error("failed to create qinitstat timer");
- close_serial(modem);
- return;
- }
- break;
- case OFONO_SIM_STATE_RESETTING:
- case OFONO_SIM_STATE_INSERTED:
- g_at_chat_send(data->aux, "AT+CPIN?", cpin_prefix, cpin_query,
- modem, NULL);
- break;
- case OFONO_SIM_STATE_NOT_PRESENT:
- ofono_warn("%s: sim not present", ofono_modem_get_path(modem));
- ofono_modem_set_powered(modem, true);
+ at_util_sim_state_query_free(data->sim_state_query);
+ data->sim_state_query = NULL;
+ data->sim_locked = false;
+ data->sim_ready = false;
+
+ if (!present) {
+ ofono_modem_set_powered(modem, TRUE);
+ ofono_warn("%s: sim not present", path);
+ return;
}
+
+ g_at_chat_send(data->aux, "AT+CPIN?", cpin_prefix, cpin_cb, modem,
+ NULL);
}
-static void cfun_enable(gboolean ok, GAtResult *result, gpointer user_data)
+static void cfun_cb(gboolean ok, GAtResult *result, gpointer user_data)
{
struct ofono_modem *modem = user_data;
struct quectel_data *data = ofono_modem_get_data(modem);
@@ -751,8 +696,24 @@ static void cfun_enable(gboolean ok, GAtResult *result, gpointer user_data)
}
dbus_hw_enable(modem);
+ data->sim_state_query = at_util_sim_state_query_new(data->aux,
+ 2, 20, sim_state_cb, modem,
+ NULL);
+}
+
+static void cfun_enable(gboolean ok, GAtResult *result, gpointer user_data)
+{
+ struct ofono_modem *modem = user_data;
+ struct quectel_data *data = ofono_modem_get_data(modem);
- g_at_chat_send(data->aux, "AT+CPIN?", cpin_prefix, cpin_query, modem,
+ DBG("%p ok %d", modem, ok);
+
+ if (!ok) {
+ close_serial(modem);
+ return;
+ }
+
+ g_at_chat_send(data->aux, "AT+CFUN=4", none_prefix, cfun_cb, modem,
NULL);
}
@@ -1108,8 +1069,6 @@ static int quectel_disable(struct ofono_modem *modem)
g_at_chat_send(data->aux, "AT+CFUN=0", cfun_prefix, cfun_disable, modem,
NULL);
- data->state = QUECTEL_STATE_INITIALIZING;
-
return -EINPROGRESS;
}
@@ -1146,22 +1105,18 @@ static void quectel_set_online(struct ofono_modem *modem, ofono_bool_t online,
static void quectel_pre_sim(struct ofono_modem *modem)
{
struct quectel_data *data = ofono_modem_get_data(modem);
+ struct ofono_sim *sim;
DBG("%p", modem);
- ofono_devinfo_create(modem, 0, "atmodem", data->aux);
- data->sim = ofono_sim_create(modem, data->vendor, "atmodem", data->aux);
- if (!data->sim)
- return;
+ ofono_voicecall_create(modem, data->vendor, "atmodem", data->aux);
+ sim = ofono_sim_create(modem, data->vendor, "atmodem", data->aux);
- switch (data->sim_state) {
- case OFONO_SIM_STATE_LOCKED_OUT:
- case OFONO_SIM_STATE_READY:
- ofono_sim_inserted_notify(data->sim, true);
- break;
- default:
- break;
- }
+ if (data->sim_locked || data->sim_ready)
+ ofono_sim_inserted_notify(sim, true);
+
+ if (data->sim_ready)
+ ofono_sim_initialized_notify(sim);
}
static void quectel_post_sim(struct ofono_modem *modem)
@@ -1179,31 +1134,9 @@ static void quectel_post_sim(struct ofono_modem *modem)
if (gprs && gc)
ofono_gprs_add_context(gprs, gc);
- /*
- * the sim related atoms must not be created until the modem is really
- * ready, so check the state here
- */
- switch (data->state) {
- case QUECTEL_STATE_INITIALIZING:
- /*
- * the modem is still initializing, so postpone the atom
- * creation until qinistat_cb() determines the modem is
- * ready
- */
- data->state = QUECTEL_STATE_POST_SIM;
- return;
- case QUECTEL_STATE_READY:
- /* the modem is ready, so create atoms below */
- break;
- default:
- return;
- }
-
ofono_sms_create(modem, data->vendor, "atmodem", data->aux);
ofono_phonebook_create(modem, data->vendor, "atmodem", data->aux);
- ofono_voicecall_create(modem, data->vendor, "atmodem", data->aux);
ofono_call_volume_create(modem, data->vendor, "atmodem", data->aux);
- data->state = QUECTEL_STATE_INITIALIZED;
}
static void quectel_post_online(struct ofono_modem *modem)
--
2.23.0
1 year, 5 months
[PATCH] udev: Adding PCIe as a subsystem in udev
by Antara Borwankar
Adding support for enumerating PCIe types of modems in ofono
---
plugins/udevng.c | 178 +++++++++++++++++++++++++++++++++++++++++--------------
1 file changed, 135 insertions(+), 43 deletions(-)
diff --git a/plugins/udevng.c b/plugins/udevng.c
index 1b54b4a..89bbdf3 100644
--- a/plugins/udevng.c
+++ b/plugins/udevng.c
@@ -41,6 +41,7 @@
enum modem_type {
MODEM_TYPE_USB,
MODEM_TYPE_SERIAL,
+ MODEM_TYPE_PCIE,
};
struct modem_info {
@@ -1229,26 +1230,47 @@ static gboolean setup_xmm7xxx(struct modem_info *modem)
info->interface, info->number, info->label,
info->sysattr, info->subsystem);
- if (g_strcmp0(modem->model,"095a") == 0) {
- if (g_strcmp0(info->subsystem, "tty") == 0) {
- if (g_strcmp0(info->number, "00") == 0)
- mdm = info->devnode;
- } else if (g_strcmp0(info->subsystem, "net") == 0) {
- if (g_strcmp0(info->number, "06") == 0)
- net = info->devnode;
- if (g_strcmp0(info->number, "08") == 0)
- net2 = info->devnode;
- if (g_strcmp0(info->number, "0a") == 0)
- net3 = info->devnode;
+ if (g_strcmp0(info->subsystem, "pci") == 0) {
+ if ((g_strcmp0(modem->vendor, "0x8086") == 0) &&
+ (g_strcmp0(modem->model, "0x7560") == 0)) {
+ mdm = "/dev/iat";
+ net = "inm0";
+ net2 = "inm1";
+ net3 = "inm2";
+ ofono_modem_set_string(modem->modem,
+ "CtrlPath", "/PCIE/IOSM/CTRL/1");
+ ofono_modem_set_string(modem->modem, "DataPath",
+ "/PCIE/IOSM/IPS/");
}
- } else {
- if (g_strcmp0(info->subsystem, "tty") == 0) {
- if (g_strcmp0(info->number, "02") == 0)
- mdm = info->devnode;
- } else if (g_strcmp0(info->subsystem, "net") == 0) {
- if (g_strcmp0(info->number, "00") == 0)
- net = info->devnode;
+ } else { /* For USB */
+ if (g_strcmp0(modem->model, "095a") == 0) {
+ if (g_strcmp0(info->subsystem, "tty") == 0) {
+ if (g_strcmp0(info->number, "00") == 0)
+ mdm = info->devnode;
+ } else if (g_strcmp0(info->subsystem, "net")
+ == 0) {
+ if (g_strcmp0(info->number, "06") == 0)
+ net = info->devnode;
+ if (g_strcmp0(info->number, "08") == 0)
+ net2 = info->devnode;
+ if (g_strcmp0(info->number, "0a") == 0)
+ net3 = info->devnode;
+ }
+ } else {
+ if (g_strcmp0(info->subsystem, "tty") == 0) {
+ if (g_strcmp0(info->number, "02") == 0)
+ mdm = info->devnode;
+ } else if (g_strcmp0(info->subsystem, "net")
+ == 0) {
+ if (g_strcmp0(info->number, "00") == 0)
+ net = info->devnode;
+ }
}
+
+ ofono_modem_set_string(modem->modem, "CtrlPath",
+ "/USBCDC/0");
+ ofono_modem_set_string(modem->modem, "DataPath",
+ "/USBHS/NCM/");
}
}
@@ -1266,9 +1288,6 @@ static gboolean setup_xmm7xxx(struct modem_info *modem)
if (net3)
ofono_modem_set_string(modem->modem, "NetworkInterface3", net3);
- ofono_modem_set_string(modem->modem, "CtrlPath", "/USBCDC/0");
- ofono_modem_set_string(modem->modem, "DataPath", "/USBHS/NCM/");
-
return TRUE;
}
@@ -1437,6 +1456,7 @@ static void destroy_modem(gpointer data)
switch (modem->type) {
case MODEM_TYPE_USB:
+ case MODEM_TYPE_PCIE:
for (list = modem->devices; list; list = list->next) {
struct device_info *info = list->data;
@@ -1467,6 +1487,7 @@ static gboolean check_remove(gpointer key, gpointer value, gpointer user_data)
switch (modem->type) {
case MODEM_TYPE_USB:
+ case MODEM_TYPE_PCIE:
for (list = modem->devices; list; list = list->next) {
struct device_info *info = list->data;
@@ -1599,7 +1620,8 @@ static void add_serial_device(struct udev_device *dev)
static void add_device(const char *syspath, const char *devname,
const char *driver, const char *vendor,
- const char *model, struct udev_device *device)
+ const char *model, struct udev_device *device,
+ enum modem_type type)
{
struct udev_device *usb_interface;
const char *devpath, *devnode, *interface, *number;
@@ -1612,25 +1634,13 @@ static void add_device(const char *syspath, const char *devname,
if (devpath == NULL)
return;
- devnode = udev_device_get_devnode(device);
- if (devnode == NULL) {
- devnode = udev_device_get_property_value(device, "INTERFACE");
- if (devnode == NULL)
- return;
- }
-
- usb_interface = udev_device_get_parent_with_subsystem_devtype(device,
- "usb", "usb_interface");
- if (usb_interface == NULL)
- return;
-
modem = g_hash_table_lookup(modem_list, syspath);
if (modem == NULL) {
modem = g_try_new0(struct modem_info, 1);
if (modem == NULL)
return;
- modem->type = MODEM_TYPE_USB;
+ modem->type = type;
modem->syspath = g_strdup(syspath);
modem->devname = g_strdup(devname);
modem->driver = g_strdup(driver);
@@ -1642,8 +1652,37 @@ static void add_device(const char *syspath, const char *devname,
g_hash_table_replace(modem_list, modem->syspath, modem);
}
- interface = udev_device_get_property_value(usb_interface, "INTERFACE");
- number = udev_device_get_property_value(device, "ID_USB_INTERFACE_NUM");
+ if (modem->type == MODEM_TYPE_USB) {
+ devnode = udev_device_get_devnode(device);
+ if (devnode == NULL) {
+ devnode = udev_device_get_property_value(device,
+ "INTERFACE");
+ if (devnode == NULL)
+ return;
+ }
+
+ usb_interface = udev_device_get_parent_with_subsystem_devtype(
+ device, "usb",
+ "usb_interface");
+ if (usb_interface == NULL)
+ return;
+
+ interface = udev_device_get_property_value(usb_interface,
+ "INTERFACE");
+ number = udev_device_get_property_value(device,
+ "ID_USB_INTERFACE_NUM");
+
+ label = udev_device_get_property_value(device, "OFONO_LABEL");
+ if (!label)
+ label = udev_device_get_property_value(usb_interface,
+ "OFONO_LABEL");
+ } else {
+ devnode = NULL;
+ interface = udev_device_get_property_value(device,
+ "INTERFACE");
+ number = NULL;
+ label = NULL;
+ }
/* If environment variable is not set, get value from attributes (or parent's ones) */
if (number == NULL) {
@@ -1657,11 +1696,6 @@ static void add_device(const char *syspath, const char *devname,
}
}
- label = udev_device_get_property_value(device, "OFONO_LABEL");
- if (!label)
- label = udev_device_get_property_value(usb_interface,
- "OFONO_LABEL");
-
subsystem = udev_device_get_subsystem(device);
if (modem->sysattr != NULL)
@@ -1855,9 +1889,64 @@ static void check_usb_device(struct udev_device *device)
return;
}
- add_device(syspath, devname, driver, vendor, model, device);
+ add_device(syspath, devname, driver, vendor, model, device,
+ MODEM_TYPE_USB);
}
+static struct {
+ const char *driver;
+ const char *drv;
+ const char *vid;
+ const char *pid;
+} pci_driver_list[] = {
+ { "xmm7xxx", "imc_ipc", "0x8086", "0x7560"},
+ { }
+};
+
+static void check_pci_device(struct udev_device *device)
+{
+ const char *syspath, *devname, *driver;
+ const char *vendor = NULL, *model = NULL, *drv = NULL;
+ unsigned int i;
+
+ syspath = udev_device_get_syspath(device);
+
+ if (syspath == NULL)
+ return;
+
+ devname = udev_device_get_devnode(device);
+ vendor = udev_device_get_sysattr_value(device, "vendor");
+ model = udev_device_get_sysattr_value(device, "device");
+ driver = udev_device_get_property_value(device, "OFONO_DRIVER");
+ drv = udev_device_get_property_value(device, "DRIVER");
+ DBG("%s [%s:%s]", drv, vendor, model);
+
+ if (vendor == NULL || model == NULL || drv == NULL)
+ return;
+
+ for (i = 0; pci_driver_list[i].driver; i++) {
+ if (g_str_equal(pci_driver_list[i].drv, drv) == FALSE)
+ continue;
+
+ if (pci_driver_list[i].vid) {
+ if (!g_str_equal(pci_driver_list[i].vid, vendor))
+ continue;
+ }
+
+ if (pci_driver_list[i].pid) {
+ if (!g_str_equal(pci_driver_list[i].pid, model))
+ continue;
+ }
+
+ driver = pci_driver_list[i].driver;
+ }
+
+ if (driver == NULL)
+ return;
+
+ add_device(syspath, devname, driver, vendor, model, device,
+ MODEM_TYPE_PCIE);
+}
static void check_device(struct udev_device *device)
{
const char *bus;
@@ -1872,6 +1961,8 @@ static void check_device(struct udev_device *device)
if ((g_str_equal(bus, "usb") == TRUE) ||
(g_str_equal(bus, "usbmisc") == TRUE))
check_usb_device(device);
+ else if (g_str_equal(bus, "pci") == TRUE)
+ check_pci_device(device);
else
add_serial_device(device);
@@ -1932,6 +2023,7 @@ static void enumerate_devices(struct udev *context)
udev_enumerate_add_match_subsystem(enumerate, "usbmisc");
udev_enumerate_add_match_subsystem(enumerate, "net");
udev_enumerate_add_match_subsystem(enumerate, "hsi");
+ udev_enumerate_add_match_subsystem(enumerate, "pci");
udev_enumerate_scan_devices(enumerate);
--
1.9.1
1 year, 5 months
[PATCH] atmodem: CGDCONT handling for cid 0
by Antara Borwankar
Added handling for cid 0 in +CGDCONT callback.
---
drivers/atmodem/gprs.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/atmodem/gprs.c b/drivers/atmodem/gprs.c
index 16f4927..defbba0 100644
--- a/drivers/atmodem/gprs.c
+++ b/drivers/atmodem/gprs.c
@@ -240,7 +240,7 @@ static void at_cgdcont_read_cb(gboolean ok, GAtResult *result,
return;
}
- cids = l_uintset_new(activated_cid);
+ cids = l_uintset_new_from_range(0,activated_cid);
l_uintset_put(cids, activated_cid);
--
1.9.1
1 year, 5 months
[PATCH] atmodem: CGDCONT handling for cid 0
by Antara Borwankar
Added handling for cid 0 in +CGDCONT callback.
---
drivers/atmodem/gprs.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/atmodem/gprs.c b/drivers/atmodem/gprs.c
index 16f4927..b637f73 100644
--- a/drivers/atmodem/gprs.c
+++ b/drivers/atmodem/gprs.c
@@ -240,7 +240,7 @@ static void at_cgdcont_read_cb(gboolean ok, GAtResult *result,
return;
}
- cids = l_uintset_new(activated_cid);
+ cids = l_uintset_new_from_range(0, activated_cid);
l_uintset_put(cids, activated_cid);
--
1.9.1
1 year, 5 months
Re: [PATCH v3] qmimodem: support wake on SMS receive
by Tom Nguyen
Hi Denis,
>From: Denis Kenzior <denkenz(a)gmail.com>
>
>Hi Tom,
>
>>>> Also, it may be clearer if the introduction of raw_read and the
>>>> refactoring of this function are done as a separate commit.
>>>>
>>>
>>> Hmm, looking at the "Quectel EC21" comment again, looks like the original code was done to address a quirk (ie, bug???) with that modem. I'll revert to reading both.
>
>Jonas was the one who introduced that, so he would be the one to ask :)
>
>>>
>>> But, per spec, the 2 message TLVs are mutually exclusive, depending on the route action configuration. I'm referring to setting "new_list->route[0].action =" in get_routes_cb(). So, we shouldn't need to always read both since one is guaranteed to fail.
>>>
>>> Also, the original code, if somehow both "notify" and "message" are NULL, it'll erroneously use a null notify. I'll address this in the revert.
>>>
>>
>> On 2nd thought, my change is still ok per that "Quectel EC21" comment. I'll keep my changes and add
>
>Yes, it looked like it would work even for the quirky ec21, but I don't
>have enough context to say for sure. Nor do I have a EC21 to test
>
>comment to explain the 2 TLV that are being queried. Also, I introduced
>raw_read because I need to pull QMI_WMS_RAW_READ out of event_notify to
>service both event_notify and the message list. So, I'd like to keep
>this in the same commit.
>
>Yes exactly my point. You can have the first commit simply perform the
>'pull QMI_WMS_RAW_READ out of event_notify' transformation, which is
>more or less self-contained. And then the second commit would use that
>new utility function in your message list code.
>
>Smaller commits are easier to review. When I mentor new contributors I
>always encourage them to split up their code as much as possible. In
>this particular instance I won't insist too hard since it is likely fine
>either way :)
>
>Regards,
>-Denis
Thank you, thank you, thank you for being lenient with me :)
I can appreciate incremental patches, will keep that in mind for future.
Now, lets see if my 4th update patch will post without problem...
Thanks,
Tom
1 year, 5 months
Re: [PATCH v3] qmimodem: support wake on SMS receive
by Tom Nguyen
Hi Denis,
>From: Denis Kenzior
>
>Hi Tom,
>
>On 05/23/2019 01:15 PM, Tom Nguyen wrote:
>> Some modems, like Quectel EC25, support waking the host platform from a suspend state upon an SMS reception. Current SMS handling configures the modem to not save incoming messages. On platforms where the modem's interfaces (eg, cdc-wdm, wwan, etc) disconnect on suspend and reconnect on resume, oFono will re-initialize. This can cause lost messages upon resume because the QMI indication is sent before oFono is ready.
>
>Note, the commit description should be broken up with no line longer
>than 72 characters.
>
>>
>> Changes to support suspend/resume with wake on SMS:
>> - On startup:
>> 1. Configure modem to save messages to NV and notify for class NONE.
>> 2. Delete all processed messages in modem memory to free space.
>> 3. Get list of unread messages, then get and delete each.
>> - After startup:
>> 1. Process message upon event indication and delete.
>> 2. Then check for possibly more messages to process.
>> ---
>> drivers/qmimodem/sms.c | 327 ++++++++++++++++++++++++++++++++++++++++---------
>> drivers/qmimodem/wms.h | 77 +++++++++---
>> 2 files changed, 332 insertions(+), 72 deletions(-)
>>
>
>So I can't seem to apply this patch:
>
>denkenz@localhost ~/ofono-master $ git am ~/merge/\[PATCH\ v3\]\
>qmimodem\:\ support\ wake\ on\ SMS\ receive.eml
>Applying: qmimodem: support wake on SMS receive
>error: corrupt patch at line 24
>Patch failed at 0001 qmimodem: support wake on SMS receive
>
>
Yikes, sorry about this. Apparently, there was a problem with my email. Somehow, some line feeds got messed up and carriage return where there wasn't one. This caused that commit message problem, and some of the coding style problems you pointed out.
For my follow up patch, I've changed the commit message to be more descriptive of the root change. New title is "qmimodem: change msg class none to store/notify".
<snip>
>> +static void get_msg_list_cb(struct qmi_result *result, void *user_data)
>> +{
>> + struct ofono_sms *sms = user_data;
>> + struct sms_data *data = ofono_sms_get_data(sms);
>> + struct qmi_param *param;
>> + const struct qmi_wms_result_msg_list *list;
>> + uint32_t cnt = 0;
>> + uint16_t tmp;
>> +
>> + DBG("");
>> +
>> + if (qmi_result_set_error(result, &tmp)) {
>> + DBG("Err: get msg list %d - %s", tmp,
>> + qmi_result_get_error(result));
>> + goto done;
>> + }
>> +
>> + list = qmi_result_get(result, QMI_WMS_RESULT_MSG_LIST, NULL);
>> + if (list == NULL) {
>> + DBG("Err: get msg list empty");
>> + goto done;
>> + }
>> +
>> + cnt = GUINT32_FROM_LE(list->cnt);
>> + DBG("msgs found %d", cnt);
>> +
>> + for (tmp = 0; tmp < cnt; tmp++) {
>> + DBG("unread type %d ndx %d", list->msg[tmp].type,
>> + GUINT32_FROM_LE(list->msg[tmp].ndx));
>> + }
>> +
>> + /* get 1st msg in list */
>> + if (cnt)
>> + raw_read(sms, list->msg[0].type,
>> + GUINT32_FROM_LE(list->msg[0].ndx));
>> + else
>> + data->msg_list_chk = false;
>
>So to me it looks like you're performing a message list, grabbing the
>first message to raw_read & delete, and upon deletion you're re-grabbing
>the message list. Can you not grab all messages in succession without
>resorting to re-doing the list operation?
>
>Or am I mis-reading the intent here?
>
You understand correctly. I've changed it to grab the list, read/delete each until list is done, then grab list again to check for empty before switching to event indication. I don't see a way to issue one read request to get all the messages.
<snip>
>> static void event_notify(struct qmi_result *result, void *user_data) @@ -367,66 +575,72 @@ static void event_notify(struct qmi_result *result, void *user_data)
>> struct ofono_sms *sms = user_data;
>> struct sms_data *data = ofono_sms_get_data(sms);
>> const struct qmi_wms_result_new_msg_notify *notify;
>> - const struct qmi_wms_result_message *message;
>> - uint16_t len;
>>
>> DBG("");
>>
>> - notify = qmi_result_get(result, QMI_WMS_RESULT_NEW_MSG_NOTIFY, &len);
>> + notify = qmi_result_get(result, QMI_WMS_RESULT_NEW_MSG_NOTIFY, NULL);
>> if (notify) {
>> - DBG("storage type %d index %d", notify->storage_type,
>> - GUINT32_FROM_LE(notify->storage_index));
>> - }
>> + /* route is store and notify */
>> + if (!qmi_result_get_uint8(result, QMI_WMS_RESULT_MSG_MODE,
>> + &data->msg_mode))
>> + DBG("msg mode not found, use mode %d", data->msg_mode);
>> +
>> + DBG("msg type %d ndx %d mode %d", notify->storage_type,
>> + GUINT32_FROM_LE(notify->storage_index), data->msg_mode);
>> +
>> + /* don't read if list is being processed, will find this msg */
>> + if (!data->msg_list_chk)
>> + raw_read(sms, notify->storage_type,
>> + GUINT32_FROM_LE(notify->storage_index));
>
>So I'm not familiar with QMI enough to truly know what is happening.
>But it looks like you are changing the logic slightly in this function.
>Before it would attempt to grab the QMI_WMS_RESULT_NEW_MSG_NOTIFY
>structure only for debug purposes, and instead attempt to grab the
>QMI_WMS_RESULT_MESSAGE in all cases. If the QMI_WMS_RESULT_MESSAGE was
>not present, then the raw-read stuff would be triggered. You're doing
>it slightly differently here. It may be worth a comment.
>
>Also, it may be clearer if the introduction of raw_read and the
>refactoring of this function are done as a separate commit.
>
Hmm, looking at the "Quectel EC21" comment again, looks like the original code was done to address a quirk (ie, bug???) with that modem. I'll revert to reading both.
But, per spec, the 2 message TLVs are mutually exclusive, depending on the route action configuration. I'm referring to setting "new_list->route[0].action =" in get_routes_cb(). So, we shouldn't need to always read both since one is guaranteed to fail.
Also, the original code, if somehow both "notify" and "message" are NULL, it'll erroneously use a null notify. I'll address this in the revert.
<snip>
>> static void get_routes_cb(struct qmi_result *result, void *user_data) @@ -445,7 +659,7 @@ static void get_routes_cb(struct qmi_result *result, void *user_data)
>> goto done;
>>
>> list = qmi_result_get(result, QMI_WMS_RESULT_ROUTE_LIST, &len);
>> - if (!list)
>> + if (!list)
>
>Generally we prefer pure style fixes to be done separately. Makes
>things easier to review.
>
Understood, I'll revert this.
<snip>
>> @@ -478,9 +692,9 @@ static void get_routes_cb(struct qmi_result *result, void *user_data)
>> qmi_param_append(param, QMI_WMS_PARAM_ROUTE_LIST, len, new_list);
>> qmi_param_append_uint8(param, QMI_WMS_PARAM_STATUS_REPORT, 0x01);
>>
>> - if (qmi_service_send(data->wms, QMI_WMS_SET_ROUTES, param,
>> - set_routes_cb, sms, NULL) > 0)
>> - return;
>> + if (qmi_service_send(data->wms, QMI_WMS_SET_ROUTES, param,
>> + set_routes_cb, sms, NULL) > 0)
>> + return;
>
>This change seems superfluous? And also the new code is against our
>coding style.
>
Oops, I screwed up on fixing its indent. Will revert this per above comment.
>>
>> qmi_param_free(param);
>>
>> @@ -524,6 +738,9 @@ static void create_wms_cb(struct qmi_service *service, void *user_data)
>>
>> data->wms = qmi_service_ref(service);
>>
>> + memset(&data->rd_msg_id, 0, sizeof(data->rd_msg_id));
>> + data->msg_mode = QMI_WMS_MESSAGE_MODE_GSMWCDMA;
>> +
>> qmi_service_register(data->wms, QMI_WMS_EVENT,
>> event_notify, sms, NULL);
>>
>
>Regards,
>-Denis
1 year, 5 months