aboutsummaryrefslogtreecommitdiffstats
AgeCommit message (Collapse)AuthorFilesLines
14 dayslog: Handle dladdr failureHEADmasterSteve Schrock1-2/+4
If unit/test-qmimodem-qmi times out while running under valgrind, valgrind complains about an uninitialized value being printed during abort signal logging. dladdr fails on the valgrind address (0x580BCE37 in the example below) but print_backtrace still tries to access the Dl_info structure which is not initialized. The fix is to handle the dladdr failure gracefully. ==36318== Conditional jump or move depends on uninitialised value(s) ==36318== at 0x4A862F8: __printf_buffer (vfprintf-process-arg.c:408) ==36318== by 0x4AA8067: __vsnprintf_internal (vsnprintf.c:96) ==36318== by 0x4B1D62B: __vsyslog_internal (syslog.c:220) ==36318== by 0x4B1DB83: vsyslog (syslog.c:100) ==36318== by 0x407C3F: ofono_error (log.c:92) ==36318== by 0x407FEB: print_backtrace (log.c:201) ==36318== by 0x40816B: signal_handler (log.c:228) ==36318== by 0x580BCE37: ??? (in /usr/libexec/valgrind/memcheck-arm64-linux)
2024-05-07Release 2.72.7Marcel Holtmann2-1/+7
2024-05-07qmi: Move the pending queues into qmi_device_qmuxSteve Schrock1-137/+132
Only qmux needs to asynchronously create service clients so the list of pending clients should move there. At the same time flatten the hashmap of queues of pending clients into a single queue that is linearly searched--the number of pending clients will be small so there is no need for any extra hashmap overhead or complexity.
2024-05-07qmi: Separate the pending family creation queuesSteve Schrock1-34/+39
The family_list hashmap is keyed by the client ID and service type, unless qmux is creating the first client for a service type. In that case the high bytes are 0x8000 instead of the client ID, and the value is a queue of clients waiting for that service instead of the service_family. This commit moves the pending clients into thir own hashmap to ensure that each hashmap contains a consistent type and eliminates the need for marking pending keys with 0x80000000.
2024-05-07atmodem: sim: when reading sim files, avoid incomplete result linesChristophe Ronco1-4/+12
Modem ME310G1 sometimes add incomplete result lines to first AT+CRSM command. Example: AT+CRSM=192,12258 +CRSM: 0 +CRSM: 144,0,62178202412183022FE28A01058B032F06068002000A880110 OK Parse all result lines starting with prefix until a line with at least sw1 and sw2 parameters is found.
2024-05-07qmimodem: Fix error path memory leak in gobiSteve Schrock1-0/+1
I noticed this leak when I terminated ofonod while gobi was retrying discovery on an unresponsive QMUX device. ==8257== 20 (16 direct, 4 indirect) bytes in 1 blocks are definitely lost in loss record 31 of 154 ==8257== at 0x4885118: malloc (in /usr/libexec/valgrind/vgpreload_memcheck-arm64-linux.so) ==8257== by 0x5A4737: l_malloc (util.c:49) ==8257== by 0x4669E3: qmi_param_new (qmi.c:2374) ==8257== by 0x466D73: qmi_param_new_uint8 (qmi.c:2449) ==8257== by 0x47D717: gobi_disable (gobi.c:482) ==8257== by 0x51BAD7: set_powered (modem.c:986) ==8257== by 0x51E8FB: __ofono_modem_shutdown (modem.c:2279) ==8257== by 0x518233: signal_handler (main.c:85) ==8257== by 0x496D14F: ??? (in /usr/lib/aarch64-linux-gnu/libglib-2.0.so.0.7800.0) ==8257== by 0x49CDE47: ??? (in /usr/lib/aarch64-linux-gnu/libglib-2.0.so.0.7800.0) ==8257== by 0x496DBFF: g_main_loop_run (in /usr/lib/aarch64-linux-gnu/libglib-2.0.so.0.7800.0) ==8257== by 0x518A23: main (main.c:314)
2024-05-06qmi: gprs-context: Obtain initial bearer IP supportDenis Kenzior2-9/+61
.read_settings is used by the core to setup the network interface for the initial bearer. This initial bearer is typically an internet context, but can be something else, depending on the carrier. The initial bearer might also be configured by the network itself, and can be IPv4, IPv6 or dual stack. Have the gprs-context driver query the initial attach parameters to obtain this information, and only then invoke the WDS Start Network command. Supporting Dual Stack contexts requires multiple WDS handles to be allocated, with each handle issuing a Start Network request with a different IP family preference. This is currently not supported by the underlying QMUX/QRTR transport. For now, choose invoke Start Network with IPv4 family preference for IPV4 and Dual Stack contexts, and IPv6 famiily preference for IPv6 contexts.
2024-05-06qmi: gprs-context: Parse IPv6 context settingsDenis Kenzior1-0/+58
Similarly to get_settings_ipv4, add get_settings_ipv6 function which will parse the relevant TLVs present when GET_SETTINGS response indicates IPv6 family is in use.
2024-05-06qmi: gprs-context: Split out IPv4 setting processingDenis Kenzior1-26/+43
Prepare to support IPv6 bearers by moving IPv4 bearer context processing into its own function. get_settings_ipv4() will be called if the reported IP Family TLV reports ipv4.
2024-05-06qmi: gprs: Remove magic number useDenis Kenzior1-1/+2
2024-05-06qmi: gprs: Remove IP Support Type parsingDenis Kenzior1-4/+0
This code was only used to print a message to log. Remove it for now. The IP type will actually be used by gprs-context driver to determine whether IPv4, IPv6 or Dual IP family interface should be activated.
2024-05-06qmi: netreg: Print network capabilityDenis Kenzior4-52/+99
Since gprs driver no longer uses DATA_CAPABILITY_STATUS TLV to report the bearer to the core, move the parsing of this element to network-registration atom driver. Introduce a new utility to convert the DATA_CAPABILITY_STATUS TLV to a string list. For now, simply print the capability when this TLV is received. While here, eliminate CDMA specific enumerations as they're now obsolete.
2024-05-06qmi: gprs: use Extended Data Bearer TechnologyDenis Kenzior3-3/+111
This TLV is reported by WDS "Event Report" indication and contains a better representation of the current bearer compared to the Data Service Capability TLV reported in the NAS Serving System indication. TLV: type = "Extended Data Bearer Technology" (0x2a) length = 16 value = 00:00:00:00:03:00:00:00:00:10:00:00:00:00:00:00 translated = [ data_bearer_technology = '3gpp' radio_access_technology = '3gpp-lte' extended_data_bearer_technology_3gpp = 'lte-fdd' ...] TLV: type = "Data Service Capability" (0x11) length = 2 value = 01:0B translated = { [0] = 'lte '} Some of the 5G and more esoteric technologies are not yet handled in this commit. Support for these technologies needs to be added in the core first. Modify the logic in the gprs driver to use this new mechanism.
2024-05-06qmi: wds: Fix up enum namingDenis Kenzior1-2/+2
Fixes: e075175baff2 ("qmi: wds: add utility to parse Data System Status tlv")
2024-05-03qmi: Don't return false when return signature is intDenis Kenzior1-1/+1
Fixes: 34d0183a9ff7 ("qmi: Introduce shutdown operation")
2024-05-03qmi: Don't return false when return signature is intDenis Kenzior1-1/+1
Fixes: a11e3942354c ("qmi: Introduce discover() driver method")
2024-05-02sim7100: create radio-settings atom for A76XX modemsMartin Hundebøll1-0/+2
2024-05-02Makefile: enable build of simcommodem radiosettingsMartin Hundebøll1-0/+3
This change was missing from commit c3da88e1 ("drivers: adding support for the SIMCom A7605E-H"). Add it now to allow radio-settings support for SIMCom A76XX modems.
2024-05-02udevng: register support for SIMCom A76XX USB serial modemMartin Hundebøll1-0/+53
Register the 1e0e:9011 usb id as a specialization of the sim7100 driver. Use a new setup() function to handle the different order (and amount) of USB endpoint numbers without introducing too much complexity to the existing setup() function.
2024-05-02sim7100: enable A76XX simcom vendor quirks for relevant atomsMartin Hundebøll1-5/+30
Use the recently added detection of modem model to apply the even more recently added SIMCom sub-vendor id when creating atoms. The "old" SIMCom vendor id is shared between the sim7100 and sim900 drivers, and so changing the 0 vendor id's for the existing ofono_*_create() calls might have unexpected side-effects. Avoid such changes by calling the needed ofono_*_create() functions separately for each model instead.
2024-05-02atmodem: introduce SIMCom A76XX vendor quirksMartin Hundebøll5-3/+8
As a preparation for adding support for the SIMCom A7672 modem, certain quirks are needed in the atmodem driver. The OFONO_VENDOR_SIMCOM enum is already shared by the existing sim7100 and sim900 drivers, so a new "sub-vendor" enum is needed. The new sub-vendor enum allows adding A7672 support to the sim7100 driver without changing behavior for other devices already supported. A few of the existing simcom vendor quirks are replaced by the new sub-vendor enum instead of making them apply to both. These places were introduced in commit c3da88e1 ("drivers: adding support for the SIMCom A7605E-H"), which should apply to the A7672E modem too.
2024-05-02sim7100: fix going offline for A76XX modemsMartin Hundebøll1-0/+10
When tearing down the PPP context, the SIMCom A7672 modem issues a NO CARRIER event on the control channel, which is detected as an error when processing the AT+CFUN=4 respones. Make the set_online(false) call succeed by ignoring the NO CARRIER event.
2024-05-02sim7100: implement set_online()Martin Hundebøll1-1/+34
Enter pre-sim state using AT+CFUN=4, and move the AT+CFUN=1 call into the added set_online() callback. The modem (at least the A7672E variant) generously issues unsolicited events between the CFUN command and the OK response, so match on the +CFUN: prefix only in set_online().
2024-05-02sim7100: query device model during enableMartin Hundebøll1-3/+41
Adding support for more simcom modems in the sim7100 driver requires certain variants handlings based on the present modem model. Default to an "unknown" variant to keep the existing behaviour, and introduce the A76XX model to use when later adding support for the A7672 vartiant.
2024-05-02sim7100: wait for modem to start while enablingMartin Hundebøll1-1/+1
The sim7100_enable() returns 0 just after queuing the AT+CFUN=1 command, which ofono core interprets as the modem being powered up and in pre-sim state. In fact, the pre-sim state isn't reached until the modem returns OK, which is caught in cfun_set_on_cb() in sim7100.c. Delay the transition from off to pre-sim until the respone is received by return EINPROGRESS instead, and let the (existing) ofono_modem_set_powered() call signal pre-sim to ofono core.
2024-05-02sim7100: simplify serial device openingMartin Hundebøll1-26/+5
Replace the g_at_{tty,syntax,chat} dance with a single call to g_at_util_open_device().
2024-05-01qmi: gprs: Obtain LTE attach parameters after indicationDenis Kenzior1-13/+23
It seems this TLV/Indication combination is needed in order for the GET_LTE_ATTACH_PARAMETERS command to succeed: ofonod[3257238]: Failed to query LTE attach params: 74 ofonod[3257238]: LTE bearer established but APN not set
2024-05-01qmi: wds: add utility to parse Data System Status tlvDenis Kenzior2-0/+55
2024-05-01qmi: gprs: Register for other notificationsDenis Kenzior1-2/+46
Register for additional notifications via Indication Register command.
2024-05-01qmi: gprs: register and listen to event reportsDenis Kenzior1-9/+79
This is mostly useful to obtain inter and intra RAT changes, data bearer changes, data transfer statistics, etc.
2024-05-01qmi: gprs: Split out GET_DEFAULT_PROFILE_NUMBER requestDenis Kenzior1-16/+26
This will allow request to be re-arranged into a new sequence easier in the future.
2024-05-01qmi: gprs: register to NAS indications earlierDenis Kenzior1-12/+2
We can register to NAS indications much earlier, as soon as the NAS service handle is created. Since the handle is now a 'lightweight' handle, all service registrations are automatically unregistered when the handle is destroyed. There's no need to track the registered indication id and to remove it separately.
2024-04-30udevng: Add support for Telit FN990Denis Kenzior1-2/+6
2024-04-30gobi: Use LOW_POWER instead of PERSIST_LOW_POWERDenis Kenzior2-3/+2
PERSIST_LOW_POWER setting is supposed to tell the device that it should not enter online state at the next bootup. Unfortunately, no USB devices tested seem to honor this setting. Telit devices in particular will turn off the SIM and become unusable until set back into online mode. Use low-power instead of persistent low power state instead. AlwaysOnline support is now no longer needed.
2024-04-29qmi: voicecall: Add free on the error pathDenis Kenzior1-0/+1
send_one_dtmf() allocates cb_data, but does not properly clean it up on the (rather unlikely) error path.
2024-04-29qmi: voicecall: Reflow the logic to avoid nestingDenis Kenzior1-13/+11
2024-04-29qmimodem: voicecall: Implement DTMF tonesAdam Pigg2-0/+133
The send_dtmf function sets up a call to send_one_dtmf, which will call the QMI_VOICE_START_CONTINUOUS_DTMF service function. The parameters to this call are a hard coded call-id and the DTMF character to send. start_cont_dtmf_cb will then be called which will set up a call to QMI_VOICE_STOP_CONTINUOUS_DTMF to stop the tone. Finally, stop_cont_dtmf_cb will check the final status.
2024-04-29udevng: Support Quectel RM502QDenis Kenzior1-0/+3
[37312.033140] usb 4-1: New USB device found, idVendor=2c7c, idProduct=0800, bcdDevice= 4.14 [37312.033149] usb 4-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3 [37312.033151] usb 4-1: Product: RM502Q-AE [37312.033153] usb 4-1: Manufacturer: Quectel
2024-04-29udevng: Add "option" module managed ports to gobi driverDenis Kenzior1-0/+1
This makes sure that any tty ports that are managed / created by the "option" module can still be utilized by the gobi driver.
2024-04-29qmi: gprs: Query default profile number at initDenis Kenzior1-75/+61
The current logic queries the default profile id every time the driver believes the default bearer has been attached. However, oFono does not modify the default profile number during its runtime. Query the default profile id at initialization time instead. While here, remove some magic numbers in favor of defined constants.
2024-04-29qmi: lte: Support additional attributesDenis Kenzior3-4/+32
Add support for setting APN Type (IPV4, IPV6 or Dual), Username and Password attributes of the profile used for the default bearer.
2024-04-29qmi: wds: Move enum conversion into wds.cDenis Kenzior4-16/+29
Introduce a new wds.c file which will house various utilities, such as enumeration conversion, that could be shared between multiple QMI based atom drivers. Move ofono_gprs_auth_method conversion here.
2024-04-29qmi: lte: Remove magic number useDenis Kenzior2-15/+28
Several commands were invoked using magic numbers, even though they're defined inside wds.h. Remove magic numbers from enumerations by introducing appropriate enums to wds.h. Similarly, use defined constants for parameter and result ids.
2024-04-26Release 2.62.6Marcel Holtmann2-1/+8
2024-04-26build: Add test-qmimodem-qmi to .gitignoreMarcel Holtmann1-0/+1
2024-04-26build: Require at least version 0.65 when building with external ELLMarcel Holtmann1-2/+2
2024-04-26atmodem: fix detection of ATD*99 for non-muxed serial portsMartin Hundebøll1-5/+4
The gprs context probe function has logic to detect whether CGDATA is supported by the modem, or if ATD*99 should be used instead. However, it seems like this logic was wrongly placed after registering for CGEV notification, which did an early return in case the passed chat did not have a slave. Thus the ATD*99 detection was skipped for USB modems using separate "virtual" serial ports for command and data channels (i.e. ttyUSB0 for AT and ttyUSB1 for PPP). Fix USB modem case by moving the check for a slave chat (and the registraion for CGEV notifications) to after the CGDATA check, which lets the ATD*99 check run uncodionally.
2024-04-26qmi: gprs-context: Actually send param to qmi_service_sendDenis Kenzior1-1/+1
The parameter structure was built, but not included into the qmi_service_send call resulting in a memory leak. Fixes: b6ced6c5c4c9 ("qmi: gprs-context: Request certain TLVs to be included")
2024-04-23qmimodem: Remove unregister/cancel_all functionsSteve Schrock3-20/+15
gobi was the final user of these functions in its disable function. It would perform this cleanup before sending a final message. This is not necessary because gobi does not register for any notifications and the only sends that might be in progress should only occur during initialization. If a client actually needs this functionality it should free the service and create a new one. These functions are still used internally in qmi.
2024-04-23qmimodem: Eliminate qmi_service reference countingSteve Schrock20-69/+51
Now that each client gets its own qmi_service object, there is no need to perform reference counting. qmi_service_ref has been removed and qmi_service_unref has been renamed to qmi_service_free.
2024-04-23qmimodem: Remove redundant unregister all callsSteve Schrock4-9/+1
Some of the qmimodem drivers were calling qmi_service_unregister_all before decrementing the reference count to 0. This is unnecessary because the service will unregister all as it is being destroyed.
2024-04-22qmi: voicecall: Remove redundant initialization to NULLDenis Kenzior1-20/+12
param was needlessly initialized to NULL in answer() and release_specific(). Since all error paths free both cbd and param, declare & initialize these variables at the start of the function. Handle dial() similarly for consistency.
2024-04-22qmi: voicecall: Remove ternary conditional useDenis Kenzior1-7/+4
Simplify the code a bit by removing the use of ternary conditional operation and replace it with a 'remote_number_tlv' variable. This also removed a slight coding violation where a mix of spaces and tabs was used for indentation.
2024-04-22qmi: voicecall: Fix up code style violationsDenis Kenzior1-6/+8
Fix up some style violations: - > 80 character lines - Redundant parenthesis Also, while here, fix up a typo: "informations" -> "information"
2024-04-22qmi: Remove redundant NULL check in qmi_param_newDenis Kenzior1-7/+1
l_new cannot fail, and thus cannot return NULL. Remove the check and simplify the code.
2024-04-22qmimodem: voicecall: Implement active call hangupAdam Pigg2-0/+83
hangup_active iterates the current list of calls, looking for the first active call and then calls release_specific. This then sets up the parameters for a call to QMI_VOICE_END_CALL, with the only parameters being the call-id. end_call_cb will then be called and will parse out the call-id and check for success.
2024-04-22qmimodem: voicecall: Implement call answerAdam Pigg2-0/+71
The answer function setup the parameters for a call to the service function QMI_VOICE_ANSWER_CALL. The only parameter is the call-id. answer_cb will then be called which retrieves the call-id and checks the status of the result.
2024-04-22qmimodem: voicecall: Implement call dialingAdam Pigg2-1/+444
Add voicecall dialling to the qmimodem driver Includes required infrastructure and setup of the QMI services Call State Handling =================== On initialisation, register the all_call_status_ind callback to be called for QMI_VOICE_IND_ALL_STATUS. This will handle notification of call status to the rest of the system Dial Handling ============= The dial function sets up the parameters for the QMI_VOICE_DIAL_CALL service. The parameters are the number to be called and the call type, which is currently hard coded to be QMI_VOICE_CALL_TYPE_VOICE. The dial_cb callback will then be called and will receive the call-id.
2024-04-22qmi unit: Validate notifications are independentSteve Schrock1-0/+57
Destroying one service should not affect notifications for different services of the same type.
2024-04-22qmi unit: Validate destroyed services do not notifySteve Schrock1-1/+34
Confirm that client notifications do occur after unref'ing (destroying) the service.
2024-04-22qmi unit: Validate creation of services of the same typeSteve Schrock1-1/+18
Confirm that there are no problems when clients create services for the same qmi type.
2024-04-22qmi: Prevent clients from unregistering for othersSteve Schrock1-6/+13
qmi_service_unregister was removing the registration that matched an integer ID. This would allow a client to unregister a different client's notification. While this is unlikely it could lead to very confusing bugs. This is easy to prevent by checking both the ID and the service handle.
2024-04-22qmi: Eliminate unnecessary casting to unsigned intSteve Schrock1-9/+5
uint16_t values were copied into unsigned ints before being passed to L_UINT_TO_PTR. Perhaps this was necessary when the glib macro GUINT_TO_POINTER was used, but it is not necessary now with the ell macro.
2024-04-22qmi: Create a better client service abstractionSteve Schrock1-105/+185
Currently any client can cancel any other client's requests and notifications. This change separates out the service "family" which is shared among clients that create services for the same qmi service type. The qmi_service gets its own unique handle so that clients are more independent and cannot interfere with other clients as easily.
2024-04-22qmi: Eliminate atomic ref countingSteve Schrock1-5/+3
This code is single-threaded so there is no need to use atomics. While here simplify qmi_service_ref.
2024-04-22qmi unit: Link to dlSteve Schrock1-1/+1
One of my VMs was getting a linker error when building test-qmimodem-qmi in maintainer mode: undefined reference to `dladdr' Add -ldl to fix this.
2024-04-17qmi unit: Add notification registration testSteve Schrock1-0/+55
2024-04-17qmi unit: Make test service sends more genericSteve Schrock1-23/+45
Clean up the functions so that they can be used to send indications in addition to responses in the future.
2024-04-17gobi: Do not wait for timeout to shutdownSteve Schrock1-1/+2
Now the qmi_device_shutdown() function can return a failure. It will do this if the qmi_device type does not support shutdown. When this happens gobi should immediately proceed with shutdown instead of waiting until the timeout occurs.
2024-04-16qmi: gprs-context: Request certain TLVs to be includedDenis Kenzior1-0/+18
Explicitly ask WDS service to include certain TLVs in its response. This is mainly needed to obtain the value of the negotiated MTU between the modem and the network. MTU is not included in the response otherwise.
2024-04-16qmi: gprs-context: Remove single-use structure definitionDenis Kenzior2-7/+4
This structure is defined in wds.h but only used once inside packet_status_notify(). It is unlikely to be used elsewhere since this TLV is specific to the connection status indication. Define/declare this structure directly in the handler instead.
2024-04-16qmi: wds: Convert defines to enumsDenis Kenzior2-9/+13
2024-04-16qmi: gprs-context: Convert QMI_WDS_AUTHENTICATION to an enumDenis Kenzior2-7/+10
QMI uses authentication type as a bitmap, with both PAP and CHAP support being selectable independently. Convert QMI_WDS_AUTHENTICATION* defines to an enumeration, removing QMI_WDS_AUTHENTICATION_NONE.
2024-04-16qmi: gprs-context: Move singleton defines to call siteDenis Kenzior2-33/+24
These defines are used only a single time, either as an enumeration for a parameter or result. Move them to be closer to the actual call site and do not use a QMI_WDS prefix.
2024-04-16qmi: gprs-context: Do not free/alloc unnecessarilyDenis Kenzior1-10/+5
In start_net_cb, a new cb_data object is allocated which contains the exact same information as the cb_data object being passed in as userdata. Use cb_data_ref/unref instead. While here, also fix an erroneous invocation of CALLBACK_WITH_SUCCESS if the GET_CURRENT_SETTINGS request was not queued successfully. An error should be generated instead.
2024-04-16qmimodem: wds: Introduce qmi_wds_ip_family enumDenis Kenzior2-2/+9
2024-04-10umlrunner: Allow EXTERNAL authenticationDenis Kenzior1-0/+6
Tools such as busctl use EXTERNAL authentication to DBus and get confused if EXTERNAL authentication is not enabled. For this, the root user must also exist inside /etc/passwd, or dbus-daemon is unable to accept auth requests using EXTERNAL authentication mechanism.
2024-04-08qmimodem: Default embedded modems endpoint IDSteve Schrock1-15/+17
Embedded QMI QRTR modems use an endpoint ID of 1. This will not be set by udevng, so gprs-context must handle this case.
2024-04-08udevng: Detect embedded qmi QRTR modemsSteve Schrock2-5/+119
Embedded qmi QRTR modems are identified by the existence of rmnet_ipaX and rmnet_dataX devices. Add a new "embedded" modem type so that these devices can be collected during enumeration and then configured for use by the gobi plugin. Modems of this type will be exposed as /gobiqrtr_X.
2024-04-08qmi unit: Ignore QRTR control packetsSteve Schrock1-0/+5
Sometimes the test server will receive a QRTR_TYPE_DEL_CLIENT control packet which is broadcast when the prior test client is destroyed. It is entirely schdeduler-dependent as to whether this broadcast will occur before or after the subsequent test's servers are created. If the test server receives a control packet, then test_send_data will fail. There is no need for the tests to be aware of any control packets at this time so it should simply ignore them. Fixes: 728db12daa68 ("qmi: Add unit test for QRTR qmi_service_send")
2024-04-08hfp_ag_bluez5: Fix use-after-freeDenis Kenzior1-80/+136
valgrind reports many use-after-free errors inside hfp_ag_bluez5.c when oFono is being shutdown. This is caused by hfp_ag plugin not tracking atom watches properly. Fix this by correctly removing both sim and voicecall atom watches appropriately. Since all modems are now tracked, remove the 'sim_hash' hash table and the 'modems' doubly-linked list. ofonod[29]: src/voicecall.c:voicecall_remove() atom: 0x5697140 ==29== Invalid read of size 8 ==29== at 0x48E28C9: g_list_remove (in /usr/lib/libglib-2.0.so.0.7800.3) ==29== by 0x4E8B84: sim_state_watch (hfp_ag_bluez5.c:353) ==29== by 0x4E8CDE: sim_watch (hfp_ag_bluez5.c:396) ==29== by 0x502F65: call_watches (modem.c:314) ==29== by 0x502FE2: __ofono_atom_unregister (modem.c:334) ==29== by 0x503381: flush_atoms (modem.c:483) ==29== by 0x50366D: modem_change_state (modem.c:586) ==29== by 0x504225: set_powered (modem.c:974) ==29== by 0x506966: modem_unregister (modem.c:2154) ==29== by 0x506BD2: ofono_modem_remove (modem.c:2220) ==29== by 0x4C8753: phonesim_exit (phonesim.c:1177) ==29== by 0x502925: __ofono_plugin_cleanup (plugin.c:201) ==29== Address 0x56c3350 is 0 bytes inside a block of size 24 free'd ==29== at 0x484488F: free (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==29== by 0x49093C0: g_slice_free_chain_with_offset (in /usr/lib/libglib-2.0.so.0.7800.3) ==29== by 0x4E90A3: hfp_ag_exit (hfp_ag_bluez5.c:514) ==29== by 0x502925: __ofono_plugin_cleanup (plugin.c:201) ==29== by 0x5015F8: main (main.c:315) ==29== Block was alloc'd at ==29== at 0x4841828: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==29== by 0x48EE762: g_malloc (in /usr/lib/libglib-2.0.so.0.7800.3) ==29== by 0x48E0FE8: g_list_append (in /usr/lib/libglib-2.0.so.0.7800.3) ==29== by 0x4E8BDD: sim_state_watch (hfp_ag_bluez5.c:365) ==29== by 0x53274E: call_state_watches (sim.c:374) ==29== by 0x535D1E: sim_set_ready (sim.c:1784) ==29== by 0x53611A: sim_imsi_obtained (sim.c:1885) ==29== by 0x536280: sim_imsi_cb (sim.c:1934) ==29== by 0x489FAA: at_cimi_cb (sim.c:455) ==29== by 0x4ED979: at_chat_finish_command (gatchat.c:465) ==29== by 0x4EDB84: at_chat_handle_command_response (gatchat.c:527) ==29== by 0x4EDE3F: have_line (gatchat.c:606) ==29== ... ofonod[29]: plugins/bluez5.c:bt_unregister_profile() Bluetooth: Unregistering profile /bluetooth/profile/hfp_ag ==29== Invalid read of size 8 ==29== at 0x48C8076: g_hash_table_lookup (in /usr/lib/libglib-2.0.so.0.7800.3) ==29== by 0x4E8CF4: sim_watch (hfp_ag_bluez5.c:398) ==29== by 0x502F65: call_watches (modem.c:314) ==29== by 0x502FE2: __ofono_atom_unregister (modem.c:334) ==29== by 0x503381: flush_atoms (modem.c:483) ==29== by 0x50366D: modem_change_state (modem.c:586) ==29== by 0x504225: set_powered (modem.c:974) ==29== by 0x506966: modem_unregister (modem.c:2154) ==29== by 0x506BD2: ofono_modem_remove (modem.c:2220) ==29== by 0x4C8753: phonesim_exit (phonesim.c:1177) ==29== by 0x502925: __ofono_plugin_cleanup (plugin.c:201) ==29== by 0x5015F8: main (main.c:315) ==29== Address 0x5133f58 is 56 bytes inside a block of size 96 free'd ==29== at 0x484488F: free (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==29== by 0x4E90CB: hfp_ag_exit (hfp_ag_bluez5.c:516) ==29== by 0x502925: __ofono_plugin_cleanup (plugin.c:201) ==29== by 0x5015F8: main (main.c:315) ==29== Block was alloc'd at ==29== at 0x4841828: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==29== by 0x48EE762: g_malloc (in /usr/lib/libglib-2.0.so.0.7800.3) ==29== by 0x48D3182: g_hash_table_new_full (in /usr/lib/libglib-2.0.so.0.7800.3) ==29== by 0x4E8FEB: hfp_ag_init (hfp_ag_bluez5.c:489) ==29== by 0x50286D: __ofono_plugin_init (plugin.c:175) ==29== by 0x5015C6: main (main.c:309) ... ==29== Invalid read of size 4 ==29== at 0x48D0483: g_hash_table_remove (in /usr/lib/libglib-2.0.so.0.7800.3) ==29== by 0x4E8D21: sim_watch (hfp_ag_bluez5.c:399) ==29== by 0x502F65: call_watches (modem.c:314) ==29== by 0x502FE2: __ofono_atom_unregister (modem.c:334) ==29== by 0x503381: flush_atoms (modem.c:483) ==29== by 0x50366D: modem_change_state (modem.c:586) ==29== by 0x504225: set_powered (modem.c:974) ==29== by 0x506966: modem_unregister (modem.c:2154) ==29== by 0x506BD2: ofono_modem_remove (modem.c:2220) ==29== by 0x4C8753: phonesim_exit (phonesim.c:1177) ==29== by 0x502925: __ofono_plugin_cleanup (plugin.c:201) ==29== by 0x5015F8: main (main.c:315) ==29== Address 0x5133f28 is 8 bytes inside a block of size 96 free'd ==29== at 0x484488F: free (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==29== by 0x4E90CB: hfp_ag_exit (hfp_ag_bluez5.c:516) ==29== by 0x502925: __ofono_plugin_cleanup (plugin.c:201) ==29== by 0x5015F8: main (main.c:315) ==29== Block was alloc'd at ==29== at 0x4841828: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==29== by 0x48EE762: g_malloc (in /usr/lib/libglib-2.0.so.0.7800.3) ==29== by 0x48D3182: g_hash_table_new_full (in /usr/lib/libglib-2.0.so.0.7800.3) ==29== by 0x4E8FEB: hfp_ag_init (hfp_ag_bluez5.c:489) ==29== by 0x50286D: __ofono_plugin_init (plugin.c:175) ==29== by 0x5015C6: main (main.c:309)
2024-04-08modem: remove atom entry prior to invoking the watch callbackDenis Kenzior1-7/+7
In __ofono_atom_free, the atom is removed from the list prior to invoking __ofono_atom_unregister. This ensures that any invocation of __ofono_atom_find or __ofono_modem_find_atom() will fail to find the just-removed object when invoked from the atom watch. The above does not hold in flush_atoms() implementation, which can lead to surprising results. Make sure that the atom is removed from the modem's atom list prior to invoking __ofono_atom_unregister in all cases.
2024-04-06build: Remove bluez4 configure magicDenis Kenzior1-12/+1
2024-04-06bluez4: Remove supportDenis Kenzior11-4264/+1
BlueZ 5 is now up to release 5.73, with the 5.0 release date being in late 2012. There's very little chance that anyone is using BlueZ 4 anymore. Remove it.
2024-04-05qmi: Add unit test for QRTR qmi_service_sendSteve Schrock1-1/+165
The unit test causes a qmi request to be sent to the test QRTR service and echos the data back in its response.
2024-04-05qmi: Create QRTR unit testing frameworkSteve Schrock2-0/+293
Use actual AF_QIPCRTR sockets to create test QRTR services that may be utilized to validate the functionality of the QRTR implementation of qmi_device. These initial tests validate that the qmi code is performing service lookup and instantiation properly.
2024-04-03unit: Add test cases with tags_filter providedDenis Kenzior2-7/+40
Replace the XYZ operator contexts with a set of two. One tagged as 'lte' and one tagged as '5g'. Add logic to the provision unit test to support filter tags.
2024-04-03examples: Fix use after free and resource leaksDenis Kenzior1-43/+108
The emulator example plugin does not track modem powered watches, and thus leaks them. Additionally, the plugin opens ports for both HFP and DUN emulators. However, only a single server watch is tracked, leading to the other watch being leaked. Since the modem powered watches are not tracked, they are never unregistered. This can lead to situations where emulator plugin is destroyed (and thus all data associated with it is freed) before all modems have been removed. When modems are removed subsequently, registered powered watches will be invoked. This will result in use-after-free errors being reported by valgrind.
2024-04-03provision: Add support for provision filter tagsDenis Kenzior1-2/+7
oFono main.conf configuration file can now contain an entry with group 'Provision' and key 'TagsFilter'. This entry is treated as a comma separated list of all tags that are accepted during context auto-provisioning. This can help to filter duplicate context entries from the provisioning database such that context auto-provisioning is successful without user intervention.
2024-04-03ofono: Add support for ofono main.conf settingsDenis Kenzior2-0/+33
It would be useful to support some oFono wide configuration settings that can be configured for the system. Introduce a new __ofono_get_config() function that will obtain the parsed settings file as a pointer to l_settings. The settings will be parsed from the configuration directory set using CONFIGURATION_DIRECTORY environment variable, or the default CONFIGDIR variable set during configuration/compilation.
2024-04-03data: Add tags for AT&T and T-Mobile contextsDenis Kenzior1-6/+12
AT&T uses several APNs, one for lte/4g devices, one for 5G capable devices and one for M2M. Use the newly introduced tags field to tag them appropriately. Similarly, for T-mobile, add "iot" tag to the iot specific APN configuration.
2024-04-03tools: lookup-apn: add support for optional tags filterDenis Kenzior1-7/+18
2024-04-03provisiondb: Add tags_filter supportDenis Kenzior5-19/+57
Also update unit tests and other users of provisiondb APIs due to the API change.
2024-04-03provisiontool: Add support for context tagsDenis Kenzior1-4/+6
Since this changes the size of the context structure, bump the version number generated by provisiontool.
2024-04-03data: Remove RESELLER settings from AT&TDenis Kenzior1-10/+0
This seems to be yet another MVNO, remove it for now.
2024-04-03data: Remove outdated T-mobile settingsDenis Kenzior1-35/+0
2024-04-03data: Mark some MVNOs via the "spn" attributeDenis Kenzior1-0/+5
Most likely these MVNOs use GID1/GID2 or some other magic to be auto-detected properly. Mark them using the SPN tag so major US carriers can be autodetected easier.
2024-04-03data: Remove AweSIM entryDenis Kenzior1-24/+0
It has the same MCC/MNC and APN settings as AT&T
2024-04-03sim: Simplify SPN management logicDenis Kenzior1-200/+153
The current implementation kicks off reading of the SPN only if an spn watch has been registered. This made sense at the time since the only atoms that used spn were netreg and gprs. Typically they were initialized in the post_online state, which in effect delayed SPN reading until that time. With the introduction of provisioning inside the LTE atom, the spn watch is always registered for LTE modems (nearly all modems now and going forward). Simplify the SPN reading logic by reading it once the sim has been initialized by kicking off the read procedure inside sim_ready(). While here, remove tracking of cphs_spn_watch, ef_spn_watch and cphs_spn_short_watch. All sim file watches are automatically destroyed once the ofono_sim_context is destroyed.
2024-04-03simutil: Convert eons APIs to use ellDenis Kenzior4-71/+63
While here, also remove sim_eons_optimize() as it is no longer needed. The ell queue implementation natively supports pushing to the back of a linked list. Also tighten up some length checks and make 'length' arguments unsigned.
2024-03-22quectel: Set modem lte capableDenis Kenzior1-0/+4
2024-03-22gobi: Set modem lte capableDenis Kenzior1-0/+1
2024-03-22ublox: Set modem lte capableDenis Kenzior1-0/+1
2024-03-22xmm7xxx: Set modem as lte capableDenis Kenzior1-0/+1
2024-03-22gemalto: Set modem lte capableDenis Kenzior1-1/+7
2024-03-22phonesim: Set modem lte capableDenis Kenzior1-0/+1
2024-03-22modem: add implementation for the Capabilities propertyDenis Kenzior2-0/+64
The Capabilities property is made available via GetProperties() D-Bus method. It is also emitted prior to emitting the PropertyChanged signal for the Powered property. This ensures that any clients that might use the capability information, will obtain it prior to the modem being enabled / powered up.
2024-03-22doc: Add new Modem.Capabilities propertyDenis Kenzior1-0/+6
The intent of this property is to give an early hint to external clients, such as ConnMan, about this modem's capabilities such that the clients can modify their behavior accordingly. For example, ConnMan might choose to drive the modem slightly differently if it knows that a modem is LTE capable.
2024-03-22modem: commonize interface string list generationDenis Kenzior1-12/+17
This code was repeated in multiple places, factor it out into a common function.
2024-03-21modem: commonize feature string list generationDenis Kenzior1-8/+16
This code was repeated in multiple places, factor it out into a common function.
2024-03-21phonesim: Allow phonesim to work with Multiplexer=internalDenis Kenzior1-46/+56
If use_mux code path was used, certain commands (like querying of the SIM status) were not sent, resulting in incomplete modem initialization. Fix that.
2024-03-19qmimodem: sms: Silence valgrind warningDenis Kenzior1-12/+14
ofonod[2670789]: drivers/qmimodem/sms.c:get_msg_protocol_cb() ==2670789== Conditional jump or move depends on uninitialised value(s) ==2670789== at 0x46552A: get_msg_protocol_cb (sms.c:565) ==2670789== by 0x45D5C1: service_send_callback (qmi.c:2762) ==2670789== by 0x4594F5: __rx_message (qmi.c:846) ==2670789== by 0x45A6A4: received_qmux_data (qmi.c:1393) ==2670789== by 0x58D71C: io_callback (io.c:105) ==2670789== by 0x58C073: l_main_iterate (main.c:461) ==2670789== by 0x500EC0: event_check (main.c:190) ==2670789== by 0x48FC09D: ??? (in /usr/lib/libglib-2.0.so.0.7800.3) ==2670789== by 0x49591CF: ??? (in /usr/lib/libglib-2.0.so.0.7800.3) ==2670789== by 0x48FBB96: g_main_loop_run (in /usr/lib/libglib-2.0.so.0.7800.3) ==2670789== by 0x5011F5: main (main.c:284) ==2670789== ofonod[2670789]: drivers/qmimodem/sms.c:get_msg_list() The warning is triggered because GET_MSG_PROTOCOL command succeeds and qmi_result_set_error() returns false. It seems the intent in this case is to use the msg_mode reported by the device by obtaining it using qmi_result_get_uint8. In case GET_MSG_PROTOCOL command fails, both CDMA and WCDMA messages should be queried.
2024-03-19qmimodem: Rework GET_CARD_STATUS retry logicDenis Kenzior1-39/+47
Port the retry logic from glib based implementation that uses g_timeout_add to use l_timeout instead. While here, fix the existing logic to not leak memory when a retry is performed. This happens in one of two ways: - When retry_cbd is allocated via cb_data_new, it is never freed when the timeout GSource fires. - If the timeout GSource is removed early (i.e. due to remove() being called), the associated retry_cbd is not freed Fix this by using cb_data_ref / cb_data_unref and utilize destroy callbacks properly.
2024-03-19qmi: Initialize group_id for control requestsSteve Schrock1-0/+1
valgrind found that for control requests, the group_id was not being set. The requests are being allocated using l_malloc which does not initialize memory to 0, unlike l_new. The impact is that cleanup of the requests during service closure or modem shutdown might incorrectly remove a control request from the queue. The fix is to always initialize this field to 0. Fixes: 0a4591e439ba ("qmi: Add an abstract group id to services and requests")
2024-03-18qmi: Allow QRTR services to be destroyedSteve Schrock1-2/+3
QRTR services were never being destroyed because they were being created with a reference count of 1 and immediately incrementing the count to 2.
2024-03-18qmi: Fix printing the wrong type for servicesSteve Schrock1-2/+2
The __debug_msg refactoring introduced a bug where the service transactions would not display the correct type in the log. The service transaction type is shifted to the left by one bit compared to the control transaction type so we need to perform a shift to be able to share a common debug logging function. Fixes: afa96ae4fa99 ("qmi: Clean up the __debug_msg function")
2024-03-18qmi: Discover timeout could cause a crashSteve Schrock1-19/+30
Sometimes the QRTR discover timeout would occur simply because the control packets are being processed slowly. Handle this by extending the timeout each time a service is discovered. Then ensure the discover data on the queue exists before processing it, just in case there was an actual timeout.
2024-03-18AUTHORS: Mention Steve's contributionsDenis Kenzior1-0/+1
2024-03-04qmimodem: Remove glib use from util.[ch]Denis Kenzior3-2/+5
glib use is retained by sim and sim-legacy drivers since these drivers utilize sim related utilities that have not yet been ported to ell. Also, sim driver uses a single glib timeout source
2024-03-04gobi: Replace g_try_new0 / g_free with ell equivalentsDenis Kenzior1-4/+2
2024-03-04qmimodem: Use l_new / l_freeDenis Kenzior17-157/+141
Convert from using GLib g_new0 / g_free to use ell
2024-03-04qmimodem: Use ell endianness converter helpersDenis Kenzior4-24/+24
2024-03-04qmimodem: Use stdbool instead of gbooleanDenis Kenzior2-10/+10
2024-03-04Release 2.52.5Marcel Holtmann2-1/+6
2024-03-01qmi: Enable QRTR service writes and readsSteve Schrock1-21/+98
For simplicity the QRTR write method simply skips the QMUX header. In the future it might make sense to add another ops function that would allocate a larger buffer and populate the QMUX header in the QMUX implementation.
2024-03-01qmi: Clean up the __debug_msg functionSteve Schrock1-75/+65
There was a lot of redundancy in the function and it was also not ready to handle QRTR messages that do not have a QMUX header.
2024-03-01qmi: Store the service info in the requestSteve Schrock1-19/+39
QRTR will need this to write to the appropriate node and port. While here create helper functions to simplify request allocation.
2024-03-01qmi: Add an abstract group id to services and requestsSteve Schrock1-13/+24
This will allow services and requests to be matched without using the QMUX client id which does not exist in QRTR.
2024-03-01qmimodem: Add support for "embedded" endpointsDenis Kenzior1-0/+2
2024-02-29voicecall: Refactor string_to_phone_numberDenis Kenzior8-35/+44
string_to_phone_number is used to convert a sanitized phone number string to struct ofono_phone_number. An unsafe strcpy is used for the conversion. Change string_to_phone_number in two ways: - Add a '__' prefix to make it clear that this API is private and care must be taken when using it. In this case, by sanitizing the input first - Use a safer strcpy version, namely l_strlcpy While here, add a sanitizing version of string_to_phone_number that can be used to sanitize and convert the input string in one operation. Also take the opportunity to convert some of the functions involved from GLib gboolean type to stdbool.
2024-02-29smsutil: Use a safer strlcpyDenis Kenzior3-11/+11
sms_address_from_string is meant as private API, to be used with string form addresses that have already been sanitized. However, to be safe, use a safe version of strcpy to avoid overflowing the buffer in case the input was not sanitized properly. While here, add a '__' prefix to the function name to help make it clearer that this API is private and should be used with more care.
2024-02-29simutil: Make sure set_length on the parent succeedsDenis Kenzior1-5/+6
2024-02-29smsutil: Check cbs_dcs_decode return valueDenis Kenzior1-1/+2
It is better to explicitly check the return value of cbs_dcs_decode instead of relying on udhi not being changed due to side-effects.
2024-02-29smsutil: ensure the address length in bytes <= 10Denis Kenzior1-1/+6
If a specially formatted SMS is received, it is conceivable that the address length might overflow the structure it is being parsed into. Ensure that the length in bytes of the address never exceeds 10.
2024-02-29voicecall: Drop unused GError variablesDenis Kenzior1-4/+2
GError return variables would possibly be allocated by g_key_file_get_* functions, but never used and never freed. Fix that.
2024-02-29qmi: Enable basic client creation if it is not subclassedSteve Schrock1-17/+64
QRTR does not require client ID allocation requests.
2024-02-29qmi: Allow for 16-bit service types in the type hashSteve Schrock1-6/+11
Only QMUX has client ids and they fit into 8 bits.
2024-02-29qmi: Add more service info to qmi_serviceSteve Schrock1-15/+14
QRTR will need to know the node and port for writes.
2024-02-29qmi: Create a method to find a service by typeSteve Schrock1-19/+22
2024-02-28emulator: Add missing error checksDenis Kenzior1-14/+42
2024-02-28voicecall: Handle possible NULL dereferenceDenis Kenzior1-2/+5
There may be circumstances when 'n' or 'o' are NULL. Make sure the next member is not dereferenced in this case.
2024-02-28sim-auth: Check for dbus_message_iter_init errorDenis Kenzior1-1/+2
2024-02-28emulator: Check cb isn't NULL before invokingDenis Kenzior1-1/+2
2024-02-28dbus: Drop default statementDenis Kenzior1-2/+4
In case any new ofono_error types are added, make sure the compiler warns if they're not handled properly.
2024-02-28qmi: add QRTR services to the queueSteve Schrock1-0/+11
2024-02-28qmi: Support dynamic service informationDenis Kenzior1-52/+66
On QMUX, service information is static. It is obtained via a CTL request and remains static for the duration of the connection. With QRTR, services can appear and disappear dynamically. Support this by converting the existing version_list / version_count member into a queue. struct qmi_version is now replaced by struct qmi_service_info with additional qrtr specific attributes.
2024-02-27qmimodem: QRTR service discoverySteve Schrock2-23/+267
QRTR service discovery works by sending QRTR_TYPE_NEW_LOOKUP to the special socket of type AF_QIPCRTR. Then the services are received one-by-one. Soon they will be stored and made available for use by the qmi client. There was a re-entrancy problem where the qmi_device could be destroyed in a callback, but then the code running would still try to access that device. This was solved by creating a common macro that would do things in the right order so that the qmi_device was not accessed again after calling back into the client. QRTR modem discovery and instantiation will be implemented later.
2024-02-26lte: Fix invalid cleanupDenis Kenzior1-3/+3
The intent was to have l_free apply to the settings variable, not the const ap variable. Also, while here, fix dereferencing ap if it is NULL. Fixes: 69adffb51633 ("lte: Add provisioning support")
2024-02-26voicecall: Fix use after freeDenis Kenzior1-49/+21
If voicecall_dbus_register is not successful, it will invoke voicecall_destroy, which frees the voicecall and associated data. Make sure to return early if this happens. While here, convert g_memdup2 and g_try_new0 use to ell.
2024-02-26voicecall: Fix memory leakDenis Kenzior1-2/+6
'number' is obtained using g_key_file_get_string (which returns a newly allocated string), but is never freed.
2024-02-26qmi: Make sure to set transaction id as LE16Denis Kenzior1-3/+3
Transaction identifier for QMI service messages was always read in as LE16 value, however when allocating a request it was set in host byte order. Fix that.
2024-02-26qmi: Move control_queue member to qmux subclassDenis Kenzior1-18/+24
control_queue is only used by the QMUX transport. Move it out from the qmi_device structure into the QMUX specific qmi_device_qmux structure.
2024-02-26qmi: Introduce write driver methodDenis Kenzior1-26/+42
Introduce a new write driver method which will abstract away the details of submitting a QMI message to the underlying device / protocol. qmi_device will continue managing the request queue and setup the l_io write handler accordingly.
2024-02-26qmi: Split RX path into QMUX and generic partsDenis Kenzior1-101/+110
handle_packet currently handles both CTL and generic service messages coming from the device. In all cases, QMUX framing is assumed. Split up this function into two, one for parsing and handling the CTL packets, and one for all other service messages. As a result, the reader handler is renamed to received_qmux_data() and set into l_io inside qmi_device_new_qmux() constructor.
2024-02-26qmi: Introduce __ctl_request_submitDenis Kenzior1-30/+41
__request_submit was handling both CTL and non-CTL requests. Split this function into two, one for submitting CTL requests, and one that handles normal service traffic. This allows CTL requests to be isolated into QMUX specific driver methods that use them. While here, also move next_control_tid member into the QMUX qmi_device subclass.
2024-02-26qmi: Move and rename QMUX sync logicDenis Kenzior1-29/+29
This logic is QMUX only, move it to be spatially near the rest of QMUX specific logic and just above where these functions are used.
2024-02-26qmi: Ensure tid is initializedDenis Kenzior1-0/+1
When the qmi_request structure is allocated, the tid member is never initialized properly. This is usually okay since the request is submitted afterwards, but it is still better to initialize this member properly.
2024-02-26qmi: Use FAM instead of allocating a memberDenis Kenzior1-26/+19
Instead of allocating a separate buffer inside the request object, use a flexible array member (FAM). This allows the request metadata and data to be allocated within the same memory region. The only downside is that the data buffer is not released once the request has been sent over the socket. Since most requests are quite small, this shouldn't affect performance.
2024-02-26core: Drop g_strdup useDenis Kenzior13-57/+53
Replace with l_strdup
2024-02-26voicecall: Drop use of g_strdupDenis Kenzior1-17/+17
Replace with l_strdup
2024-02-26network: Drop g_strdup useDenis Kenzior1-20/+9
Replace by l_strdup
2024-02-26gprs: Drop use of g_strdupDenis Kenzior1-37/+37
Replace with l_strdup
2024-02-26modem: Drop g_strdup useDenis Kenzior1-32/+32
Replace with l_strdup
2024-02-26sim: Remove g_strdup useDenis Kenzior1-11/+11
Replace by l_strdup
2024-02-26simutil: Remove use of g_strlcpyDenis Kenzior1-2/+2
Replace with l_strlcpy
2024-02-26network: Remove use of g_strlcpyDenis Kenzior1-2/+2
Replace with l_strlcpy
2024-02-26gprs: Remove use of g_str_has_prefixDenis Kenzior1-3/+3
Replace with l_str_has_prefix
2024-02-26sim: Replace g_strndup use with l_strndupDenis Kenzior1-3/+2
2024-02-26phonebook: Replace g_strndup use with l_strndupDenis Kenzior1-2/+2
2024-02-26plugins: Replace g_strndup use with l_strndupDenis Kenzior1-2/+2
2024-02-26smsutil: Remove g_strdup_printf useDenis Kenzior1-37/+34
Replace with l_strdup_printf. While here also replace use of g_free with free() where data returned by the invocation of standard C functions needs to be freed.
2024-02-26sim-auth: Remove g_strdup_printf useDenis Kenzior1-4/+4
Replace with l_strdup_printf
2024-02-26simfs: Remove g_strdup_printf useDenis Kenzior1-26/+22
Replace with l_strdup_printf
2024-02-26hfp_hf_bluez5: Drop use of g_strconcatDenis Kenzior1-4/+3
Replace with l_strdup_printf instead
2024-02-26ifxmodem: Remove g_strfreev useDenis Kenzior1-8/+9
Replace by l_strv_free
2024-02-26main: Remove g_printerr useDenis Kenzior1-3/+3
Replace by fprintf(stderr, ...)
2024-02-26voicecall: Remove g_strfreev and g_strdupv useDenis Kenzior1-9/+6
Replace by l_strv_free and l_strv_copy
2024-02-26sim: Remove g_strfreev useDenis Kenzior1-21/+18
Replace by l_strv_free
2024-02-26network: Remove g_strfreev useDenis Kenzior1-4/+4
Replace by l_strv_free
2024-02-26gprs: Remove g_strfreev and g_strdupv useDenis Kenzior1-6/+6
Replace by l_strv_free and l_strv_copy
2024-02-23qmimodem: Include linux/limits.h for PATH_MAXDenis Kenzior1-0/+1
2024-02-23qmimodem: Remove the final bits of glibSteve Schrock1-6/+5
2024-02-23qmimodem: Use l_io instead of GIOChannelSteve Schrock1-53/+26
2024-02-23qmimodem: Use l_queue instead of GList for pending service creationSteve Schrock1-15/+14
2024-02-23qmimodem: Use l_queue instead of GList for notificationsSteve Schrock1-27/+25
2024-02-22gobi: Fail early if re-tried discovery failsDenis Kenzior1-4/+3
2024-02-22qmimodem: Fail early if discovery already completeDenis Kenzior1-24/+3
If discovery has been completed successfully, tell the caller right away by returning a -EALREADY return code instead of scheduling for the discover callback to be invoked via the idle callback. Such logic has no real effect as the underlying CTL service is not queried again.
2024-02-22gobi: heed the qmi_device_discover returnDenis Kenzior1-2/+5
If qmi_device_discover attempt fails, fail right away.
2024-02-22qmi: Introduce discover() driver methodDenis Kenzior2-172/+188
On QMUX the discover operation queries all available services by sending a QMUX Control message and processing its reply. The reply contains a list of services and the corresponding major / minor version number. QRTR has a similar, but much more dynamic mechanism utilizing the QRTR nameserver. Services on QRTR can appear and disappear freely compared to services on QMUX. Abstract the discovery operation behind a discover() method in the ops structure, and move the QMUX specific implementation there. While here, change the return signature of qmi_device_discover() to return an int, such that better error reporting can be supported.
2024-02-22qmi: Introduce client_create driver methodDenis Kenzior1-219/+231
On QMUX, before using a particular QMI service, a client must first be created. Client creation is accomplished by sending a specific message to the control service and waiting for the reply. On QRTR, no such round trip is required. A QRTR socket can immediately access all services by virtue of creating a socket, with each QMI service allocating an implicit client identifier. Abstract away the client creation details behind the client_create() driver method. Rename the service_create_data structure to qmux_client_create_data in order to make it clear that this operation is QMUX specific.
2024-02-21qmi: Introduce client_release driver methodDenis Kenzior1-35/+41
When shutting down, any requested QMUX clients must be released properly. This is handled by sending a QMUX Control message with the service type and client id. QRTR doesn't have such a concept, a client is closed by virtue of closing the socket. Abstract away the implementation details behind client_release() driver method.
2024-02-21qmi: Rename qmi_device_unref to qmi_device_freeDenis Kenzior3-10/+4
Since reference counting wasn't used, rename qmi_device_unref to qmi_device_free.
2024-02-21qmi: Drop qmi_device_refDenis Kenzior2-11/+0
This API isn't being used, drop it.
2024-02-21qmimodem: Use l_free in qmi_free for consistencySteve Schrock1-3/+3
Eliminate the final gchar* as well.
2024-02-21qmimodem: Eliminate glib macrosSteve Schrock1-50/+50
2024-02-21qmimodem: Use l_idle and l_timeout for service creationSteve Schrock1-23/+19
2024-02-21qmimodem: Use l_idle for shutdown instead of g_timeoutSteve Schrock1-13/+13
2024-02-21qmimodem: Use l_timeout and l_idle for discoverySteve Schrock1-13/+29
2024-02-21qmimodem: Use l_queue_remove_if to eliminate double lookupSteve Schrock1-31/+19
2024-02-21gobi: Fail if device could not be createdDenis Kenzior1-0/+2
If for some reason the qmux device creation fails, indicate failure early and do not rely on the 5 second modem powered timeout.