Compare commits

...

184 Commits

Author SHA1 Message Date
Slava Monich
e0ea7b54c6 [gprs] Fixed ofono_gprs_context memory leak. JB#54354 2022-03-14 05:06:41 +02:00
Slava Monich
01c5e7fc1a Version 1.29 2022-03-14 04:48:41 +02:00
Slava Monich
291530d291 [sim] OFONO_SIM_DRIVER_API_VERSION 2. JB#54354 2022-03-14 04:47:31 +02:00
Slava Monich
108611ef72 Merge pull request #24 from sailfish-on-dontbeevil/branch-1.29
[ofono] Upgrade ofono baseline to 1.29. JB#54354
2022-03-14 04:44:50 +02:00
Marcel Holtmann
a3c9fc793c Release 1.29 2022-03-11 15:35:22 +00:00
Richard Röjfors
03491c78e7 ublox: gprs-context: Fix router mode IP settings.
The ublox modems always run DHCP when in router mode.
Unfortunately the code overwrote the IP settings with
static IP settings while activating.

Now we respect the networking_mode regardless if
we read settings during activation or read settings
phase.
2022-03-11 15:35:22 +00:00
Antara Borwankar
c534b7e9b0 xmm7modem: Changes in plugin for DSSA functionality
Changed the sim driver vendor for xmm7modem from
OFONO_VENDOR_IFX to OFONO_VENDOR_XMM to handle DSSA functionality.
2022-03-11 15:35:22 +00:00
Antara Borwankar
35e7cd19e6 xmm7modem: handling of dual sim single active feature
Handled DSSA use case for xmm7modem. Added driver function
to switch between available card slots for SIM.

Only one SIM will be active at a given time. On calling this
function the active SIM will be removed and the card slot made
inactive and SIM in the other card slot will be made active.

Use case is similar to a SIM swap/change where one SIM is replaced
another SIM in the same slot.
2022-03-11 15:35:22 +00:00
Antara Borwankar
2ed8b1bb7f sim: added error handling in set slot callback
Adding the handling of error when the driver returns
CME ERROR:4.

This error will be returned for non xmm vendor modems
using ifxmodem driver for sim.
2022-03-11 15:35:22 +00:00
Richard Röjfors
8f65b01f4c ublox: Correct the USBCONF reply prefix
According to the u-blox AT Commands Manual and my tests
the response prefix of AT+UUSBCONF is "+UUSBCONF:", including
a colon. The colon was missing in the code, causing next step
to parse a number to fail, since a colon is not a number.
2022-03-11 15:35:22 +00:00
Richard Röjfors
1aa2ac5e67 ublox: Do not leave vendor_family unset
In a recent patch vendor family was only set if the device
did not support USBCONF, but that resulted in drivers
being registered the "generic" vendor. That caused
for instance netreg to use incorrect cmer mode and fail
on TOBY-L210.
2022-03-11 15:35:22 +00:00
Denis Kenzior
cb8a13433f sim: Initialize card_slot_count and active_card_slot
Initialize both to 1 so that SimManager does not erroneously show
ActiveCardSlot as 0 for drivers that do not (yet) setup these values.
2022-03-11 15:35:22 +00:00
Denis Kenzior
ee1c34cd7f sim: Emit PropertyChanged for ActiveCardSlot changes 2022-03-11 15:35:22 +00:00
Antara Borwankar
2b89f6d488 sim: handling of dual sim single active feature
Added implementation for handling CardSlotCount and ActiveCardSlot
properties for DSSA use case.
2022-03-11 15:35:22 +00:00
Antara Borwankar
32b886d89d sim: Added set function for CardSlotCount and ActiveCardSlot
Adding set function definition for CardSlotCount and ActiveCardSlot
properties.
2022-03-11 15:35:22 +00:00
Antara Borwankar
a9a3e024e1 doc: Added new properties to SimManager for DSSA
Adding two new properties to sim manager interface to handle
dual SIM single active use case.

CardSlotCount [readonly]
Contains the count of number of SIM card slots available.

ActiveCardSlot [readwrite]
Contains the index of the currently active SIM card slot
for dual SIM single active mode.
2022-03-11 15:35:22 +00:00
Jonas Bonn
8c432e5426 ublox: do not set bridge mode for TOBY L2
Trying to set the networking mode to "bridge" mode in the plugin is bogus
because the setting does not apply until after the device has been
reset.  Instead, the current setting should be queried.

If a user wants to set the modem networking mode, the setting should be
made outside of ofono.

The gprs-context driver has already been adjusted to query the
networking mode and to set things up accordingly.
2022-03-11 15:35:22 +00:00
Jonas Bonn
fc26876503 ublox: gprs-context: query networking mode for TOBY L2
The TOBY L2 may run in either "bridge" mode or "router" mode.  For this
model, query the configured mode so that the appropriate settings are
communicated when the context is activated.
2022-03-11 15:35:22 +00:00
Jonas Bonn
7461d52b10 ublox: TOBY L4 supports only router mode
The TOBY L4 supports only "router mode" where the modem presents a
network interface that one can run a DHCP client against.  Behind this
interface, the modem takes care of routing packets via NAT by:

i)  selecting the relevant context based on destination IP
ii) using the first activated context as the default route

In order to have the connection manager, thus, do the right thing, the
context only needs to report itself as being active and with the IP
settings set to method "dhcp".  There's no need for the connection manager
to know details like what IP address the context was assigned.

Tested with connman that does the right thing when it finds an active
"dhcp" context.
2022-03-11 15:35:22 +00:00
Jonas Bonn
9e2fd992b5 ublox: pass model_id to gprs-context driver
Depending on the transport used on the data connection we want either
the "atmodem" (PPP) driver or the "ubloxmodem".  For the "ubloxmodem",
we want to pass the model data so this patch wrangles some parameters to
make sure that right driver and right variant data are passed.
2022-03-11 15:35:22 +00:00
Jonas Bonn
1295539515 ublox: gprs-context: take model parameter 2022-03-11 15:35:22 +00:00
Jonas Bonn
65aa5aab14 ublox: pass model id to LTE plugin 2022-03-11 15:35:22 +00:00
Jonas Bonn
8da2178a96 ublox: extend LTE driver
There are a couple of semi-independent changes here:

* use the 'vendor' parameter to pass the modem 'model'
* support TOBY L4 modem which uses a fixed CID for configuring the EPS
default bearer
* add the setup of authentication parameters that was recently added to
the atmodem LTE driver
2022-03-11 15:35:22 +00:00
Jonas Bonn
181c74b1a9 Separate ATE and AT+CMEE commands
The TOBY L4 doesn't seem to like seeing these two commands on the same
line...
2022-03-11 15:35:22 +00:00
Jonas Bonn
a30ef13844 udevng: detect ublox TOBY L4
ttyACM0 (USB interface 02) is reportedly unreliable (breaking DHCP setup)
so the recommended approach is to use ttyACM2 (USB interface 06)
exclusively.
2022-03-11 15:35:22 +00:00
Jonas Bonn
ec85e50ab4 ublox: add TOBY L4 models 2022-03-11 15:35:22 +00:00
Jonas Bonn
1cedb9d750 ublox: add device flags
Some aspects of a device are detectable at runtime, like the USB profile
detection that was added in a patch preceding this one.  This patch
switches the driver over from creating a new "vendor id" for each
profile to just setting a flag.  This is more easily extensible as we
detect other features of the modem.
2022-03-11 15:35:22 +00:00
Jonas Bonn
a412839f45 udevng: ublox: Model string no longer used 2022-03-11 15:35:22 +00:00
Jonas Bonn
86af7cd7c9 ublox: query USBCONF for applicable devices
The TOBY L2 series of modems presents a number of different
configurations with different throughtput characteristics.  These
configurations are packaged up as USB profiles; moreover, changing the
profile actually changes the USB model ID so this is even more like
selecting a different "device" altogether.  Nonetheless, all we need to
know is which profile is selected in order to set things up correctly
and this can be queried directly.

This patch adds a call to UUSBCONF for applicable modems in order to
query the USB configuration to find out which profile is active.
2022-03-11 15:35:22 +00:00
Jonas Bonn
050332577c ublox: add model flag HAVE_USBCONF
This flag should be set on devices that support multiple USB profiles
and will be used to determine whether or not querying USB profiles is
appropriate/necessary.
2022-03-11 15:35:22 +00:00
Jonas Bonn
339814e429 ublox: query device model
This patch adds a call to CGMM into the modem_enable path in order to
establish the specific device model.  From this device model string, a
model-specific capabilities structure can be selected.
2022-03-11 15:35:22 +00:00
Jonas Bonn
278d7236c9 ublox: create model data structures
This sets up some device model data structures and adds some helpers for
manipulating them.  These data structures are a first step to trying to
support the large number of devices that ublox produces with a common
driver structure.
2022-03-11 15:35:22 +00:00
Jonas Bonn
15a9ea2977 ublox: make device selection more flexible
Many ublox modems can sit on either the USB bus or talk directly to a
UART.  The udev plugin mostly takes care of figuring out what ports to
talk to and the protocol is common for all devices after that.

This patch simplifies the setup a bit:
i)  There must always be an aux channel for communication with the modem
ii)  The aux channel may be found behind the string Aux for USB modems
or Device for serial modems
iii)  If the Modem string is set, use it; if not set, assume it's not
available.
2022-03-11 15:35:22 +00:00
Jonas Bonn
9910ab1693 atmodem: Remove TOBY_L2 vendor 2022-03-11 15:35:22 +00:00
Jonas Bonn
d5a3613fd4 ublox: drop vendor type for Toby L2 model 2022-03-11 15:35:22 +00:00
Jonas Bonn
d337893b39 atmodem: drop vendor type for Toby L2 model
The 'Toby L2'-specific vendor type is used only to prevent the CMER
command from attempting to set mode '3'.  For all u-blox models, mode
'3' is just an alias for mode '1'.  As such, mode '1' can be used in
place of mode '3', removing the model-specific quirk in favour of a
vendor-specific quirk.

With this change, the L2-specific vendor type is no longer needed.
2022-03-11 15:35:22 +00:00
Jonas Bonn
9ef41fdc2f Fix whitespace weirdness 2022-03-11 15:35:22 +00:00
Anirudh Gargi
c779a8b19d sim: fix segfault in sim atom
While adding the sim pin cache feature, pin_name could cause issue in
cases when sim pin is not there.

log:
ofonod[27810]: drivers/atmodem/sim.c:at_cpin_cb() crsm_pin_cb: READY
ofonod[27810]: src/sim.c:sim_pin_query_cb() sim->pin_type: 0, pin_type: 0
ofonod[27810]: Aborting (signal 11) [./src/ofonod]
ofonod[27810]: ++++++++ backtrace ++++++++
ofonod[27810]: #0  0x7fb7a7586cb0 in /lib/x86_64-linux-gnu/libc.so.6
ofonod[27810]: #1  0x7fb7a7693cd8 in /lib/x86_64-linux-gnu/libc.so.6
ofonod[27810]: #2  0x4d899b in sim_pin_query_cb() at src/sim.c:3174
ofonod[27810]: #3  0x4649e7 in at_cpin_cb() at drivers/atmodem/sim.c:1304
ofonod[27810]: #4  0x4a5d70 in at_chat_finish_command() at gatchat/gatchat.c:462
2022-03-11 15:35:22 +00:00
Denis Kenzior
81c7f886cb ifxmodem: Clean up the previous commit slightly
The if statements were over 80 characters and breaking them up made the
code look a bit uglier.  So refactor the if statements to just figure
out the data path 'n' parameter or return an error.  On success, form
the datapath string and return it.

Also bump the buffer size and use snprintf to be safe(r).
2022-03-11 15:35:22 +00:00
Antara Borwankar
4adac31b51 xmm7modem: data channel setup for xmm7modem
Added the implementation required to setup data channel
in ifxmodem gprs-context driver for xmm7modem vendor
2022-03-11 15:35:22 +00:00
Antara Borwankar
31bebd7ecf gprs-context: Adding get function for inteface
Added definition of get function to get interface value in
gprs-context
2022-03-11 15:35:22 +00:00
Antara Borwankar
f1965b1e2b gprs-context: adding get function for network interface
Added declaration of get function to get network interface
for gprs-context
2022-03-11 15:35:22 +00:00
Philippe De Swert
fed8c5b171 common: Add new NB-IoT technologies
Add lte-cat-m1 and lte-cat-nb1 technology identifiers.
2022-03-11 15:35:22 +00:00
Christophe Ronco
5e1f159ad1 qmi: support sim hotplug
Use card status indication to detect SIM removal and insertions
2022-03-11 15:35:22 +00:00
Antara Borwankar
972aea87e8 xmm7modem: Change in xmm7mode plugin for multiple PDP
Made changes in xmm7modem plugin to allow mutiple PDP context
activation and to assign correct network interface to the
activated PDP context.
2022-03-11 15:35:22 +00:00
Antara Borwankar
f4df805783 udevng: Detect multiple network interfaces for xmm7xxx 2022-03-11 15:35:22 +00:00
Denis Kenzior
1066668a4b gprs: Let gprs_context interface be settable once
This patch allows a driver to set the interface only once, instead of at
every context activation.  The previous way was originally designed for
PPP and RAW_IP based contexts which would have a (potentially)
differently named interface after each context activation due to use of
TUN/TAP.  This also worked for static high-speed interface setups as
well, since these usually had a single interface only.

For devices that support multiple high-speed interfaces it would be
advantageous to have each gprs_context get an interface assignment right
in the modem driver and skip having to setup the interface on every
activation.
2022-03-11 15:35:22 +00:00
Pičugins Arsenijs
c5029eafcf sim800: fix typo in model check code
Fixing a copy-paste error in SIM800 code
that results in a SIM900 modem being
detected as a SIM800 modem.
2022-03-11 15:35:22 +00:00
Nicolas Serafini
6ce1e081a4 qmimodem: Notify when SIM is initialized
Since the commit that introduced the notification API of a SIM inserted
and initialized I can not unlock the SIM card on a WP7607 modem.

The previously mentioned commit: 54d56d763e40bc44c99a9b24aa0477bd373ea085
2022-03-11 15:35:22 +00:00
Pavel Machek
91435c39ed test: better help text for dial-number
Better help text for "dial-number". Without details, user may be
tempted to pass 0|1 (as send-sms uses) or true|false.
2022-03-11 15:35:22 +00:00
Nandini Rebello
531afae6b2 modem: add support to clear cached pins.
If the modem is powered off via D-Bus, clear any cached PINs to make
sure that automatic PIN entry behavior is not activated.
2022-03-11 15:35:22 +00:00
Denis Kenzior
1c8a577a4b sim: Fix memory leaks introduced by sim pin caching 2022-03-11 15:35:22 +00:00
Nandini Rebello
bd175869f4 sim: Sim PIN1 cache upon modem reset/crash
Adding SIM PIN caching feature to oFono. oFono now caches the SIM PIN1
type against the ICCID throughout its lifetime in a link list and
enters implicitly upon modem reset/crash.

Note, that this behavior can violate 3GPP spec 21.111, section 5.3 -
User Data stored in ME if that section is interpreted very strictly.
However, our interpretation is that firmware resets are allowed, based
on historic precedent.  Helps in user experience by not barring out
cellular services unless pin is entered manually.

Handles cases of incorrect pin and sim pin changed externally.
Clear cached PIN incase modem disabled manually and selectively when
sim is removed.

Seperate 'pin_cache_enter_cb' added without dbus calls to handle
implict entering of cached pin.

For now this behavior is applicable to all modems by default.  In the
future it may be needed to make this behavior opt in or otherwise
configurable.
2022-03-11 15:35:22 +00:00
Marcel Holtmann
bcb08afc50 gitignore: unit/test-idmap binary 2022-03-11 15:35:22 +00:00
Slava Monich
eb8bfb57e9 [dbus-access] Added access control entry for SendDataMessage. JB#56657 2022-03-11 17:09:33 +02:00
Slava Monich
871eab499c Housekeeping 2022-03-11 17:09:17 +02:00
Slava Monich
dae12e74a4 Merge pull request #17 from LaakkonenJussi/jb56657
Add support for sending SMS data messages
2022-03-11 17:05:08 +02:00
Jussi Laakkonen
9f486aa91a [sms] Support setting endianess for SMS data messages. JB#56657
This implements support for selecting endianess for the SMS data message
multi-byte parameters. By default big endian is used but little endian
is required in some special protocols. Thus, omitting flag value results
in the "GSM" setting which is the big endian used by default.

This required adding a new sms_datagram_prepare_with_endianess() plugin
API call that is called by the original sms_datagram_prepare() with GSM
encoding.

This affects only the new SendDataMessage D-Bus API. A value 0x02 for
little endian is added to enum ofono_sms_data_flag().
2022-03-09 11:18:08 +02:00
Jussi Laakkonen
b015849e98 [sms] Add support for sending SMS data messages. Fixes JB#56657
This adds a new D-Bus API call "SendDataMessage" to be used for sending
a SMS data message. This is required especially by AML but can be
utilized for other uses as well.

The given message data is defined as a byte array so pre-encoded data
is only supported. Additionally source and destination ports as well as
flags are to be defined for the SMS data message. Flag
OFONO_SMS_DATA_FLAG_DELIVERY_REPORT (0x01) determine the need for
delivery reports. Other flags may be added later on.

This also implements the filter functionality for the SMS data messages.
This can be utilized by the plugins to react to the sent SMS data
messages appropriately.
2022-03-09 11:18:03 +02:00
Slava Monich
6c77fa2ddd Merge pull request #31 from monich/sim_api_ext
Add mechanism for extending ofono_sim_driver API
2022-02-23 20:10:26 +02:00
Slava Monich
09bd3cc5ac [ofono] Add mechanism for extending ofono_sim_driver API
This way struct ofono_sim_driver can be extended without having to
recompile all plugins in the world.
2022-02-23 20:09:47 +02:00
Slava Monich
1758eb3b2a Merge pull request #27 from monich/imei
Add API for querying IMEI from the modem
2022-02-23 19:59:39 +02:00
Slava Monich
faae02c2f4 Merge pull request #32 from LaakkonenJussi/allow_emerg_call_filter
Allow filtering for emergency calls
2022-02-23 19:56:22 +02:00
Jussi Laakkonen
d2abaa7776 [voicecall] Allow filtering for emergency calls. JB#56657
This removes the exceptions made for emergency calls to disallow
filtering of them via plugins. Thus, this allows the plugins to detect
if an emergency call is made and make an action based on it.
2022-02-23 14:36:37 +02:00
Slava Monich
78e83f877c [ofono] Added API for querying IMEI from the modem. JB#56657
ofono_devinfo_get_serial(ofono_modem_get_devinfo(modem))
2022-02-16 17:05:03 +02:00
Slava Monich
2b00591782 Merge pull request #23 from monich/ims
Expose ext_info bits to the plugins
2022-02-12 21:04:56 +02:00
Slava Monich
18b38db35f [ims] Expose ext_info bits to the plugins. JB#57408 2022-02-12 20:59:23 +02:00
Slava Monich
056cc73bae Merge pull request #22 from monich/ussd_decode
Add ofono_ussd_decode and ofono_ussd_decode_free API
2022-01-25 23:59:39 +02:00
Slava Monich
ad0d616696 [ofono] Add ofono_ussd_decode and ofono_ussd_decode_free API. JB#55524
Those are required by external plugins to properly support USSD sending.
ofono_ussd_decode_free() is basically a g_free() and its only purpose
is to keep ofono API glib-free. External plugins shouldn't make any
assumptions about how return values are allocated by the core.
2022-01-25 19:42:03 +02:00
Slava Monich
15d0364dc0 Version 1.28 2022-01-17 03:45:59 +02:00
Slava Monich
0faff9bf8d Updated upstream hash to point to 1.28 2022-01-17 03:43:29 +02:00
Slava Monich
9a2ef6c17d Merge pull request #20 from sailfish-on-dontbeevil/branch-1.28
[ofono] Updated baseline to 1.28. JB#42254
2022-01-17 03:40:14 +02:00
Slava Monich
aab3e8cca9 [voicecall] Added ofono_voicecall_is_emergency_number() API. JB#56657 2022-01-11 14:53:15 +02:00
Slava Monich
0538daab9d [ofono] Housekeeping
Fixed a typo
2022-01-11 05:46:59 +02:00
Slava Monich
24fd7e863c [unit] Added one more slot-manager test case 2022-01-10 21:10:26 +02:00
Slava Monich
3bdcd55ad8 Merge pull request #21 from monich/imsi-change
Fix re-evaluation of data slot after SIM change
2022-01-10 19:54:55 +02:00
Slava Monich
fb76fa7be1 [ofono] Fixed re-evaluation of data slot after SIM change. JB#56789
The way it was done, slot driver wasn't always notified about the
role change after IMSI update (e.g. when SIM gets hot-swapped or
enabled/disabled) which could result in mobile data remaining
disabled.
2022-01-10 19:16:41 +02:00
Marcel Holtmann
36c281e843 Release 1.28 2022-01-09 22:28:57 +00:00
Denis Kenzior
a4d5053c65 AUTHORS: Mention Pavel's contributions 2022-01-09 22:28:57 +00:00
Pavel Machek
2168d53bd6 rilmodem: fix compilation on gcc-6.3
gcc-6 fails to compile ofono due to #pragma directives. Limit them to
gcc versions where they are needed.
2022-01-09 22:28:57 +00:00
Denis Kenzior
258a623939 stkutil: Fix ofono_bool_t usage
The actual datatype is bool
2022-01-09 22:28:57 +00:00
Marcel Holtmann
d0208b2085 build: Use -fsigned-char and -fno-exceptions compiler options 2022-01-09 22:28:57 +00:00
Antara Borwankar
955ce593d2 ifxmodem: removing TAP/TUN support check for XMM vendor
skipping TAP/TUN support check from gprs-context probe for
xmm vendor. xmm modem does not require TAP/TUN support. Also
it is not enabled by default in enbedded yocto bsp.
2022-01-09 22:28:57 +00:00
Denis Kenzior
535b0e2e6e AUTHORS: Mention Khaled's contributions 2022-01-09 22:28:57 +00:00
Khaled Romdhani
2809230885 gemalto: Move atoms to post_online
when the voice call driver is probing, I noticed sometimes
a CME Error with the code = 4 (operation not supported)
related to AT commands "AT+CSSN=1,1" and "AT^SLCC=1".

In the current voice call implementation for Gemalto modems
the ofono_voicecall_create() is called on the gemalto_pre_sim().
The sim is not totaly readed by the module, it is not yet
online which is causing a sporadic problem at driver
intialization also when launching some outgoing/incoming calls.

This change moves the ofono_voicecall_create() to the
gemalto_post_online() to be sure that sim is well registred
and online.  Several other call related atoms are also moved to
post_online state.
2022-01-09 22:28:57 +00:00
Denis Kenzior
ad1037fbd2 stkutil: Use standard types 2022-01-09 22:28:57 +00:00
Denis Kenzior
75a10ccb5a rilmodem: Fix compiler error 2022-01-09 22:28:57 +00:00
Denis Kenzior
4745d6ed8a stkutil: Convert away from glib datatypes 2022-01-09 22:28:57 +00:00
Denis Kenzior
1a56f30091 stkagent: Use bool instead of gboolean / ofono_bool_t 2022-01-09 22:28:57 +00:00
Denis Kenzior
04021d8cf4 stktest: Fix immediate response test
Commit f39d7efb53 changed the amount of
time an immediate response text is displayed.  Fix stktest accordingly.
2022-01-09 22:28:57 +00:00
Denis Kenzior
16402d5056 stktest: Handle self-explanatory icons
At some point, self-explanatory icons meant that no text was sent to the
agent, yet stktest was never updated to reflect that behavior.  Update
this properly.
2022-01-09 22:28:57 +00:00
Denis Kenzior
8b90d7f8f1 unit: Fix memory leak 2022-01-09 22:28:57 +00:00
Denis Kenzior
db093dae3f drivers: Update to the new util api 2022-01-09 22:28:57 +00:00
Denis Kenzior
1cf235bc0d unit: update to the new util api 2022-01-09 22:28:57 +00:00
Denis Kenzior
dd2ec559af util: Use bool instead of gboolean 2022-01-09 22:28:57 +00:00
Slava Monich
25c11d6697 Updated upstream hash to point to 1.27 2022-01-10 00:12:23 +02:00
Slava Monich
0f789ddf25 Merge pull request #19 from sailfish-on-dontbeevil/branch-1.27
[ofono] Update baseline to 1.27. JB#42254
2022-01-10 00:07:34 +02:00
Slava Monich
cfae9cd095 include: Housekeeping 2022-01-10 00:01:23 +02:00
Marcel Holtmann
dca2747d5f Release 1.27 2022-01-08 08:39:08 +00:00
Antara Borwankar
b6df026722 xmm7modem: modified ofono.conf for coex agent
Added coex agent interface to ofono.conf
2022-01-08 08:39:08 +00:00
Denis Kenzior
aa1e36040d xmm7xxx: Various style cleanups 2022-01-08 08:39:08 +00:00
Antara Borwankar
227af51e10 xmm7modem: implemnetation of coexistence functionality
Added coex implementation in xmm7modem plugin
2022-01-08 08:39:08 +00:00
Pau Espin Pedrol
cbab683ac2 qmi: Fix Secondary DNS overwriting Primary DNS
inet_ntoa was called twice in a row and as a result both primay and
secondary DNS were pointing to same static buffer containing last
value (secondary DNS).

As a result, ofono always advertised the secondary DNS twice through
DBus ConnectionContext.GetProperties 'DomainNameServers'.

Related: https://osmocom.org/issues/3031
2022-01-08 08:39:08 +00:00
Antara Borwankar
8a42f7cf48 doc: Adding documetation for intel LTE coex
Added intel-lte-coex-api.txt which defines LTE coexistence
interface for intel modems.
2022-01-08 08:39:08 +00:00
Nandini Rebello
45b8b675ac test: Fix number of arguments check in change-pin
Fix the number of arguments checked in second case of change-pin.
2022-01-08 08:39:08 +00:00
Nandini Rebello
b977415db8 xmm7xxx: Adding case for SIM PIN locked state
Handling the case when SIM PIN is enabled for xmm7xxx modem.
2022-01-08 08:39:08 +00:00
Clement Viel
011377b505 sim800: add sim800 support 2022-01-08 08:39:08 +00:00
Clement Viel
7653e2b293 sim800: merge sim800 and sim900 documentation. 2022-01-08 08:39:08 +00:00
Slava Monich
0012a3e4f0 Updated upstream hash to point to 1.26 2022-01-08 04:50:14 +02:00
Slava Monich
40ec15a394 [ofono] Handle OFONO_GPRS_AUTH_METHOD_ANY. JB#42254 2022-01-08 04:29:08 +02:00
Slava Monich
cb2fd2de41 [include] Updated enum ofono_gprs_auth_method. JB#42254
For backward compatibility.
2022-01-08 04:28:55 +02:00
Slava Monich
3221ab9512 Merge pull request #18 from sailfish-on-dontbeevil/branch-1.26
Update to Ofono 1.26
2022-01-08 04:27:59 +02:00
Marcel Holtmann
06b58a3650 Release 1.26 2022-01-05 12:55:41 +00:00
Marcel Holtmann
e834b8c1a8 mbimmodem: Convert back to using __builtin_bswap16 with proper indexing 2022-01-05 12:55:41 +00:00
Marcel Holtmann
c6eaa7f108 mbimmodem: Fix conversion of strings into UTF16-LE on big endian 2022-01-05 12:55:41 +00:00
Marcel Holtmann
ccf340a896 mbimmodem: Fix endian issue with UTF16-LE to UTF16-CPU conversion 2022-01-05 12:55:41 +00:00
Denis Kenzior
c8577e681b mbimmodem: Fix compilation on 32-bit
CC       drivers/mbimmodem/mbim.o
drivers/mbimmodem/mbim.c: In function ‘command_write_handler’:
drivers/mbimmodem/mbim.c:490:3: warning: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 6 has type ‘size_t’ [-Wformat=]
   l_info("n_iov: %lu, %lu", n_iov + 1, (size_t) written);
   ^
drivers/mbimmodem/mbim.c:490:3: warning: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 7 has type ‘unsigned int’ [-Wformat=]
drivers/mbimmodem/mbim.c: In function ‘command_read_handler’:
drivers/mbimmodem/mbim.c:649:2: warning: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 6 has type ‘size_t’ [-Wformat=]
  l_info("header_offset: %lu", device->header_offset);
  ^
drivers/mbimmodem/mbim.c:650:2: warning: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 6 has type ‘size_t’ [-Wformat=]
  l_info("segment_bytes_remaining: %lu", device->segment_bytes_remaining);
  ^
2022-01-05 12:55:41 +00:00
Nandini Rebello
64f833d351 udevng: enhance udev detection for intel 7xxx modems
Handle newer 7xxx modem enumeration based on ProductId.
Preserving the previous gen support too.
2022-01-05 12:55:41 +00:00
Marcel Holtmann
0bd5121144 mbim: Add the missing mbim-private.h header into packages 2022-01-05 12:55:22 +00:00
Denis Kenzior
f7cd4d229f gemalto: Use GEMALTO vendor for netreg 2022-01-05 12:45:12 +00:00
Giacinto Cifelli
b55593d9ef atmodem: remove vendor Cinterion 2022-01-05 12:44:29 +00:00
Giacinto Cifelli
ab9fdb8af1 cinterion: use Gemalto vendor in netreg 2022-01-05 12:44:15 +00:00
Giacinto Cifelli
1daf3f62c2 atmodem: Change cinterion prefix to gemalto 2022-01-05 12:43:59 +00:00
Giacinto Cifelli
20359b88d2 atmodem: change vendor cinterion to gemalto 2022-01-05 12:42:49 +00:00
Giacinto Cifelli
4e1f39638d gemalto: Use Gemalto vendor for LTE atom 2022-01-05 12:41:51 +00:00
Jonas Bonn
22c5c3ae98 modem: global data is pre-zeroed
Module-local and global data are BSS symbols and don't require
zero-initialization.
2022-01-05 12:41:30 +00:00
Jonas Bonn
f3f3d6819d stkutil: remove test for impossible condition
'string' is an array and therefore never NULL so this test always fails.
2022-01-05 12:41:16 +00:00
Jonas Bonn
8934c398bb qmimodem: prevent use of unitialized variable
'index' may not be initialized in the error path so don't try to print a
message with it.
2022-01-05 12:40:39 +00:00
Jonas Bonn
14759305fd mbim: remove unused modem data
Neither the Vendor nor Model strings are used by the mbim plugin.
2022-01-05 12:40:17 +00:00
Giacinto Cifelli
df160a28f7 doc/common-patterns.txt: initial version 2022-01-05 12:35:39 +00:00
Denis Kenzior
90cc6a3862 atmodem: Make sure to use none_prefix
Otherwise all unsolicited notifications would also be consumed when
invoking +CGAUTH/+CGDCONT
2022-01-05 12:35:16 +00:00
Giacinto Cifelli
9176411489 atmodem: Add proto and authentication handling to lte
The ofono_lte_default_attach_info now handles also the protocol and the
authentication method, username and password.

Co-authored-by: Martin Baschin <martin.baschin@googlemail.com>
2022-01-05 12:35:03 +00:00
Giacinto Cifelli
c470ab5043 atmodem: Add reference counting to cb_data
the cb_data can be used by creating the structure with cb_data_new,
and then there are two possibilities:
- use it in a single callback function, and destroy it with a call to
  g_free.
  Example:
  - calling function:
    struct cb_data *cbd = cb_data_new(cb, data);
    if (g_at_chat_send(chat, buf, NULL, at_cgatt_cb, cbd, g_free) > 0)
	return;
    g_free(cbd);
  - called function (here at_cgatt_cb):
	static void at_cgatt_cb(gboolean ok, GAtResult *result,
						gpointer user_data)
	{
		struct cb_data *cbd = user_data;
		ofono_gprs_cb_t cb = cbd->cb;
		struct ofono_error error;

		decode_at_error(&error,
				g_at_result_final_response(result));

		cb(&error, cbd->data);
	}
    note the absence of explicit g_free(cbd);

- pass it through a train of callback functions, adding a reference at
  each pass cb_data_ref, and removing it with cb_data_unref.
  the use of cb_data_ref would replace a new object creation, while the
  use of cb_data_unref the use of g_free.
  Example:
  - calling function:
	struct cb_data *cbd = cb_data_new(cb, data);
	// no cb_ref at the creation
	if (g_at_chat_send(chat, buf, NULL,
				at_lte_set_default_attach_info_cb,
				cbd, cb_data_unref) > 0)
		goto end;
	cb_data_unref(cbd);
  - called function 1 (at_lte_set_default_attach_info_cb):
	static void at_lte_set_default_attach_info_cb(gboolean ok,
				GAtResult *result, gpointer user_data)
	{
		struct cb_data *cbd = user_data;

		cbd = cb_data_ref(cbd);
		if (g_at_chat_send(chat, buf, NULL,
				at_cgatt_cb, cbd, cb_data_unref) > 0)
			return;
		cb_data_unref(cbd);
	}
  - called function 2 (at_cgatt_cb):
    like above. no call to g_free or cb_data_unref. The terminal function
    doesn't need to know about the reference scheme.
2022-01-05 12:34:51 +00:00
Giacinto Cifelli
9c092bbe72 modem: Implement ofono_modem_set_timeout_hint
this patch provides the handling for the modem-depending powered timeout

It provides the trivial implementation for
ofono_modem_set_powered_timeout_hint, introducing the ofono_modem
variable timeout_hint, used together with the existing ofono_modem
variable timeout.

The default value, previously hardcoded as a magic number, is provided
by the DEFAULT_POWERED_TIMEOUT define and set as soon as the
ofono_modem struct is created, and then can be overwritten by the
aforementioned ofono_modem_set_powered_timeout_hint.
2022-01-05 12:34:35 +00:00
Giacinto Cifelli
2c41120b78 include: add ofono_modem_set_powered_timeout_hint
function to set the powered timeout for those cases where a device might
require longer time to boot (uncommon).

The function is effective if called before Powered=true,
so it is best called by modem detection logic and prior to calling
ofono_modem_register.
2022-01-05 12:34:07 +00:00
Giacinto Cifelli
88342a037c atmodem: added Gemalto vendor quirk for +CNMI 2022-01-05 12:32:25 +00:00
Giacinto Cifelli
75ff3e7bbf atmodem: Add at_util_get_cgdcont_command
The function at_util_get_cgdcont_command computes the AT+CGDCONT
string, as per 3GPP 27.007.
It uses a second function, at_util_gprs_proto_to_pdp_type,
that returns the pdp_type string for the command
2022-01-05 12:32:09 +00:00
Giacinto Cifelli
6abd0106b9 atmodem: Add at_util_gprs_auth_method_to_auth_proto
This function converts the ofono enum ofono_gprs_auth_method
into the value of the 3GPP 27.007 'auth_proto' variable of +CGAUTH so
that it can be passed directly to the AT command.
2022-01-05 12:31:51 +00:00
Denis Kenzior
85f9307c71 lte: Add additional sanity checks for username/password 2022-01-05 12:31:35 +00:00
Giacinto Cifelli
c5f48019ff lte: protocol and authentication for default ctx
Many LTE networks require user authentication, even for the default
context. In particular, most of the private APNs use this facility
to add some control on top of the MNO providing the service, so that
another user of the same network cannot access the private one.
As such, we add these parameters to the default context
settings that will attempt to use when registering to the network.

The additional parameters added by this patch are:  protocol, user, and
password.  These are sufficient to allow to connect to networks
available to the patch author where ofono previously failed to register
to the network at all.

Co-authored-by: Martin Baschin <martin.baschin@googlemail.com>
Co-authored-by: Denis Kenzior <denis.kenzior@intel.com>
2022-01-05 12:31:18 +00:00
Giacinto Cifelli
efa0627332 include: add proto and authentication parameters
The ofono_lte_default_attach_info is extended with protocol,
authentication method, username and password.

Co-authored-by: Martin Baschin <martin.baschin@googlemail.com>
2022-01-05 12:31:02 +00:00
Denis Kenzior
35e8201e96 doc: Mark new properties experimental
Just in case we need to redesign these in the near future
2022-01-05 12:30:32 +00:00
Giacinto Cifelli
b465782a10 doc: Add additional default attach parameters to LTE
Added 4 properties for handling the type of context and the
authentication method, exactly like in any gprs context handling.
The properties are named after the equivalent gprs-context one, for
compatibility and uniformity.

Co-authored-by: Martin Baschin <martin.baschin@googlemail.com>
2022-01-05 12:30:07 +00:00
Denis Kenzior
557f907b27 AUTHORS: Mention Giacinto's contributions 2022-01-05 12:29:54 +00:00
Giacinto Cifelli
9a354879d3 gemalto: added voice support
The plugin for Gemalto modems is enriched with all voice-related atoms,
as well as USSD.
All except the voicecall itself are from the atmodem, while the
voicecall is from gemaltomodem.
2022-01-05 12:29:38 +00:00
Giacinto Cifelli
e6799aacc9 gemalto: Add Gemalto specific voicecall atom
This atom uses the URC ^SLCC to monitor the call status, as well as
incoming calls.
Note the use in the atom of the variable GemaltoVtsQuotes: this is
needed to support future modules, as of today not yet available in the
plugin.
2022-01-05 12:26:56 +00:00
Jonas Bonn
f5d78b7e2f treewide: Remove superfluous use of _GNU_SOURCE
There are a large number of files in the tree that define _GNU_SOURCE
despite not actually using features hidden behind this flag.  This patch
removes all these definitions in one fell swoop...
2022-01-05 12:26:25 +00:00
Jonas Bonn
8fde6264c8 drivers: constify vtables
The driver vtables are read-only structures.  This patch declares them as
'const' allowing the compiler to (optionally) put them in the RELRO
section.  RELRO pages may be marked as read-only by the linker after
the relocations have been done ensuring that they aren't inadvertently
or maliciously altered at runtime.
2022-01-05 12:26:09 +00:00
Nandini Rebello
eb8371b02d test: add support for new languages
Adding new language support to set "alphabet" parameter.
2022-01-05 12:25:47 +00:00
Nandini Rebello
3b2bfa8943 sms: support 8 national lang in Alphabet property
Adding support for 8 additional languages for GSM 7 bit.
2022-01-05 12:15:23 +00:00
Nandini Rebello
d2e46f9a5f util: adding 8 national sms alphabets
Adding national language tables for hindi,kannada,malayalam,
oriya,punjabi,tamil,telugu and urdu.
2022-01-05 12:13:44 +00:00
Nandini Rebello
9b3ba1a2f0 doc: add support for 8 additional sms alphabets
Adding support for hindi,kannada,malayalam,oriya,punjabi,tamil,
telugu and urdu for GSM 7 bit.
2022-01-05 12:13:31 +00:00
Denis Kenzior
b36b0d86f6 xmm7modem: Fix memory leak in netmon 2022-01-05 12:13:17 +00:00
Denis Kenzior
655dd9ab5a phonesim: Fix memory leak 2022-01-05 12:13:00 +00:00
Nandini Rebello
74017fe30f sms: fix a missing entry in single shift table
Fix a missing char in the nation language set in single shift table
for a special character. Character set again validated.
2022-01-05 12:12:43 +00:00
Giacinto Cifelli
022b31b075 common: Move proto and auth_method related helpers
the following functions:
	gprs_proto_to_string
	gprs_proto_from_string
	gprs_auth_method_to_string
	gprs_auth_method_from_string

are moved from gprs.c to common.c, with related declaration in common.h
so that they can also be accessed from lte core functions
2022-01-05 12:09:50 +00:00
Giacinto Cifelli
6674cc3340 include: move auth_method and proto enumerations
ofono_gprs_proto and ofono_gprs_auth_method, and related length consts,
moved to types.h from gprs-context.h,
so that they can be shared also with lte core functions
2022-01-05 11:45:38 +00:00
Antara
a850fd8978 netmon: Enabled netmon atom for xmm7modem plugin
enabling netmon atom to report current serving cell measurements
for xmm7modem
2022-01-05 11:45:38 +00:00
Antara
c006d8b5ce netmon: Added netmon driver for xmm7modem
adding netmon driver for xmm7modem which uses intel proprietary
AT command +XMCI
2022-01-05 11:45:38 +00:00
Giacinto Cifelli
bf8e09da98 file-provision: support for auth type of NONE 2022-01-05 11:45:38 +00:00
Giacinto Cifelli
e60c6b16ff gprs-context: added OFONO_GPRS_AUTH_METHOD_NONE
This method makes explicit the lack of authentication.

When selected, the username and password are ignored, but they are not
changed in the user-defined properties for the context.
This treatment is necessary to allow setting independently auth_method,
username and password.

This method is also selected implicitly when username is set to
an empty string. Also this selection is done without changing the
user-defined auth_method for the context, so that the behavior is
consistent.
2022-01-05 11:36:53 +00:00
Giacinto Cifelli
c2dd50232f connman-api: added "none" auth_method 2022-01-05 11:36:53 +00:00
Giacinto Cifelli
fff50b8670 gatchat: support for auth NONE
Added authentication method G_AT_PPP_AUTH_METHOD_NONE and its handling.
2022-01-05 11:36:53 +00:00
Anirudh Gargi
0dd2d4874a xmm7xxx: enable sms and phonebook support 2022-01-05 11:36:53 +00:00
Denis Kenzior
b0e79b7564 AUTHORS: Mention Nandini's contributions 2022-01-05 11:36:53 +00:00
Nandini Rebello
e7f7197e5f test: Add test script to set sms alphabet 2022-01-05 11:36:53 +00:00
Nandini Rebello
fea0b49834 util: add bengali and gujrati sms alphabets 2022-01-05 11:36:53 +00:00
Nandini Rebello
e67bf1c41c doc: add support for 2 additional sms alphabets
Adding support for bengali and gujrati for GSM 7 bit.
2022-01-05 11:36:53 +00:00
Anirudh Gargi
3a5feec41d gprs: fix seg fault in case of NULL callback
In case of AT callback if callback handler is NULL, check for null
before calling the success macro.

Logs:
ofonod[32496]: src/network.c:current_operator_callback() 0x157ad60, (nil)
ofonod[32496]: src/gprs.c:netreg_status_changed() 0
ofonod[32496]: src/gprs.c:gprs_netreg_update() attach: 0, driver_attached: 1
ofonod[32496]: src/gprs.c:ofono_gprs_detached_notify() /xmm7xxx_0
ofonod[32496]: drivers/ifxmodem/gprs-context.c:ifx_gprs_detach_shutdown()
ofonod[32496]: drivers/ifxmodem/gprs-context.c:ifx_gprs_deactivate_primary() cid 0
ofonod[32496]: src/gprs.c:ofono_gprs_detached_notify() /xmm7xxx_0
ofonod[32496]: src/gprs.c:gprs_attach_callback() /xmm7xxx_0 error = 0
ofonod[32496]: drivers/ifxmodem/gprs-context.c:deactivate_cb() ok 0
ofonod[32496]: Aborting (signal 11) [./../src/ofonod]
ofonod[32496]: ++++++++ backtrace ++++++++
ofonod[32496]: +++++++++++++++++++++++++++
2022-01-05 11:36:53 +00:00
Anirudh Gargi
8457376df4 sms: allow sms send for EUTRAN sms only state
Patch to be considered, if support for EUTRAN SMS states accepted.

SMS registered flag while sending sms to consider the new EUTRAN
registered status also.
2022-01-05 11:36:53 +00:00
Adam Pigg
2aed406a96 network: add support eutran sms only states
EUTRAN SMS states mapped to registered and roaming respectively.
2022-01-05 11:36:49 +00:00
Anirudh Gargi
9ec0f966ef doc: Clarify LTE registration status documentation 2022-01-05 10:18:59 +00:00
Slava Monich
81b1bf3943 [packaging] Detect rpm version at build time. JB#55991 2021-12-17 13:56:07 +02:00
Slava Monich
c1bdd87f22 [unit] Avoid using g_key_file_save_to_file
Its use in a unit test is not significant enough to introduce
glib >= 2.40 requirement
2021-12-17 13:55:22 +02:00
Slava Monich
a796f670e1 [ofono] Fixed a few compilation warnings
plugins/cellinfo-netmon.c: In function 'cellinfo_netmon_notify':
plugins/cellinfo-netmon.c:85:44: warning: '%0*d' directive output may be truncated writing between 1 and 2147483647 bytes into a region of size 3 [-Wformat-truncation=]
     snprintf(s_mnc, OFONO_MAX_MNC_LENGTH, "%0*d",
                                            ^~~~
plugins/cellinfo-netmon.c:85:43: note: directive argument in the range [0, 999]
     snprintf(s_mnc, OFONO_MAX_MNC_LENGTH, "%0*d",
                                           ^~~~~~

src/gprs-provision.c: In function 'ofono_gprs_provision_get_settings':
src/gprs-provision.c:60:2: warning: implicit declaration of function 'strlen' [-Wimplicit-function-declaration]
  if (mcc == NULL || strlen(mcc) == 0 || mnc == NULL || strlen(mnc) == 0)
  ^

plugins/generic-phonebook.c: In function 'export_entries':
plugins/generic-phonebook.c:942:2: warning: implicit declaration of function 'strcmp' [-Wimplicit-function-declaration]
  if (strcmp(storage, "SM") != 0) {
  ^
2021-12-17 13:54:19 +02:00
Slava Monich
122998372d Merge pull request #16 from monich/cellinfo-netmon
Add ofono_cell_info based NetMon driver
2021-12-09 14:27:52 +02:00
Slava Monich
29a9190dce [plugins] Add ofono_cell_info based NetMon driver. JB#56038
Instantiate with ofono_netmon_create(modem, 0, "cellinfo", modem)
Requires slot driver to provide ofono_cell_info interface.
2021-12-09 14:21:39 +02:00
Slava Monich
3eba9c2518 Merge pull request #15 from monich/phonebook
Add generic phonebook plugin
2021-12-01 13:06:44 +02:00
Slava Monich
8bd27690bf [plugins] Add generic phonebook plugin. JB#55524
Instantiate with ofono_phonebook_create(modem, 0, "generic", modem)
2021-12-01 02:33:46 +02:00
Slava Monich
09074dc026 [include] Added ofono_slot_remove_all_handlers macro. JB#55524 2021-11-13 02:08:07 +02:00
Slava Monich
b6c5a7e33f [include] Define struct modem in types.h
Not having it defined prior to use may result in weird compilation
errors about pointer type being incompatible with iself, e.g.

expected struct ofono_modem * but argument is of type struct ofono_modem *
2021-11-05 15:11:30 +02:00
Slava Monich
9de9417ef1 [include] Defined enum ofono_call_mode. JB#55524
Just 'int type' gives no clue, which value means what.
2021-11-05 15:10:19 +02:00
Slava Monich
d5599452b4 Merge pull request #14 from monich/jb55900
[ofono] Pulled in a bug fix from upstream. JB#55900
2021-10-28 13:25:46 +03:00
Jimmy Gysens
b1f3d44524 gprs: clean context properly
After a context is detached, the context is not properly cleared. In
addition to releasing the context:

- Reset the context settings (IP, DNS, interface, ...).
- Signal the Active flag as false.
2021-10-28 02:58:52 +03:00
245 changed files with 10587 additions and 2185 deletions

1
ofono/.gitignore vendored
View File

@@ -43,6 +43,7 @@ unit/test-simutil
unit/test-mux
unit/test-caif
unit/test-cell-info
unit/test-cell-info-control
unit/test-cell-info-dbus
unit/test-stkutil
unit/test-cdmasms

View File

@@ -137,3 +137,7 @@ Varun Gargi <varun.gargi@intel.com>
Florent Beillonnet <florent.beillonnet@gmail.com>
Martin Hundebøll <martin@geanix.com>
Julien Tournier <tournier.julien@gmail.com>
Nandini Rebello <nandini.rebello@intel.com>
Giacinto Cifelli <gciofono@gmail.com>
Khaled Romdhani <khaledromdhani216@gmail.com>
Pavel Machek <pavel@ucw.cz>

View File

@@ -1,3 +1,30 @@
ver 1.29:
Fix issue with QMI and SIM initialized notification.
Add support for multiple PDP contexts and xmm7xxx modems.
Add support for handling Dual SIM Single Active feature
Add support for SIM PIN caching feature.
ver 1.28:
Fix issue with SIM initialization and Gemalto modems.
ver 1.27:
Add support for handling SIMCom based SIM800 modems.
Add support for SIM lock state with xmm7xxx modems.
Add support for coexistence feature with xmm7xxx modems.
ver 1.26:
Fix issue with AT callback handler and GPRS.
Fix issue with handling EUTRAN SMS only states.
Fix issue with handling MBIM strings on big endian.
Fix issue with missing char and SMS national language.
Fix issue with unsolicited notifications of +CGAUTH/+CGDCONT.
Add support for setting "none" authentication method.
Add support for SMS and phonebook with xmm7xxx modems.
Add support for voice features and Gemalto modems.
Add support for Bengali and Gujrati SMS alphabets.
Add support for 8 additional languages for GSM 7 bit
Add support for using internal Embedded Linux library.
ver 1.25:
Fix issue with handling GPRS context release.
Fix issue with GPRS context shutdown and Huawei modems.

View File

@@ -113,6 +113,9 @@ gril_sources = gril/gril.h gril/gril.c \
btio_sources = btio/btio.h btio/btio.c
builtin_modules += cellinfo_netmon generic_phonebook
builtin_sources += plugins/cellinfo-netmon.c plugins/generic-phonebook.c
if UDEV
builtin_cflags += @UDEV_CFLAGS@
builtin_libadd += @UDEV_LIBS@
@@ -409,14 +412,16 @@ builtin_modules += gemaltomodem
builtin_sources += drivers/atmodem/atutil.h \
drivers/gemaltomodem/gemaltomodem.h \
drivers/gemaltomodem/gemaltomodem.c \
drivers/gemaltomodem/location-reporting.c
drivers/gemaltomodem/location-reporting.c \
drivers/gemaltomodem/voicecall.c
builtin_modules += xmm7modem
builtin_sources += drivers/atmodem/atutil.h \
drivers/xmm7modem/xmm7modem.h \
drivers/xmm7modem/xmm7modem.c \
drivers/xmm7modem/radio-settings.c \
drivers/xmm7modem/ims.c
drivers/xmm7modem/ims.c \
drivers/xmm7modem/netmon.c
if PHONESIM
builtin_modules += phonesim
@@ -664,6 +669,7 @@ builtin_libadd += @ELL_LIBS@
if MBIMMODEM
mbim_sources = drivers/mbimmodem/mbim.h \
drivers/mbimmodem/mbim.c \
drivers/mbimmodem/mbim-private.h \
drivers/mbimmodem/mbim-desc.h \
drivers/mbimmodem/mbim-desc.c \
drivers/mbimmodem/mbim-message.h \
@@ -723,6 +729,7 @@ src_ofonod_SOURCES = $(builtin_sources) $(gatchat_sources) src/ofono.ver \
src/netmonagent.c src/netmonagent.h \
src/slot-manager.c src/slot-manager-dbus.c \
src/cell-info.c src/cell-info-dbus.c \
src/cell-info-control.c \
src/sim-info.c src/sim-info-dbus.c \
src/conf.c src/mtu-limit.c
@@ -888,7 +895,8 @@ test_scripts = test/backtrace \
test/test-serving-cell-info \
test/ims-register \
test/ims-unregister \
test/list-applications
test/list-applications \
test/set-sms-alphabet
if TEST
@@ -923,11 +931,19 @@ unit_test_cell_info_LDADD = @GLIB_LIBS@ -ldl
unit_objects += $(unit_test_cell_info_OBJECTS)
unit_tests += unit/test-cell-info
unit_test_cell_info_control_SOURCES = unit/test-cell-info-control.c \
unit/fake_cell_info.c src/cell-info.c \
src/cell-info-control.c src/log.c
unit_test_cell_info_control_CFLAGS = $(AM_CFLAGS) $(COVERAGE_OPT)
unit_test_cell_info_control_LDADD = @GLIB_LIBS@ -ldl
unit_objects += $(unit_test_cell_info_control_OBJECTS)
unit_tests += unit/test-cell-info-control
unit_test_cell_info_dbus_SOURCES = unit/test-dbus.c \
unit/test-cell-info-dbus.c unit/fake_cell_info.c \
src/cell-info.c src/cell-info-dbus.c \
gdbus/object.c src/dbus-clients.c \
src/dbus.c src/log.c
src/cell-info-control.c gdbus/object.c \
src/dbus-clients.c src/dbus.c src/log.c
unit_test_cell_info_dbus_CFLAGS = $(AM_CFLAGS) $(COVERAGE_OPT) \
@DBUS_GLIB_CFLAGS@
unit_test_cell_info_dbus_LDADD = @DBUS_GLIB_LIBS@ @GLIB_LIBS@ -ldl
@@ -954,8 +970,9 @@ unit_objects += $(unit_test_sim_info_dbus_OBJECTS)
unit_tests += unit/test-sim-info-dbus
unit_test_slot_manager_SOURCES = unit/test-slot-manager.c unit/fake_watch.c \
src/slot-manager.c src/cell-info.c src/sim-info.c \
src/storage.c src/log.c
unit/fake_cell_info.c src/slot-manager.c \
src/cell-info.c src/cell-info-control.c \
src/sim-info.c src/storage.c src/log.c
unit_test_slot_manager_CFLAGS = $(AM_CFLAGS) $(COVERAGE_OPT) \
-DSTORAGEDIR='"/tmp/ofono"'
unit_test_slot_manager_LDADD = @GLIB_LIBS@ -ldl
@@ -963,6 +980,7 @@ unit_objects += $(unit_test_slot_manager_OBJECTS)
unit_tests += unit/test-slot-manager
unit_test_watch_SOURCES = unit/test-watch.c src/watch.c \
src/cell-info.c src/cell-info-control.c \
src/log.c src/watchlist.c
unit_test_watch_CFLAGS = $(AM_CFLAGS) $(COVERAGE_OPT) \
-DSTORAGEDIR='"/tmp/ofono"'

View File

@@ -12,7 +12,8 @@ AC_DEFUN([AC_PROG_CC_PIE], [
AC_DEFUN([COMPILER_FLAGS], [
if (test "${CFLAGS}" = ""); then
CFLAGS="-Wall -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2"
CFLAGS="-Wall -O2 -fsigned-char -fno-exceptions"
CFLAGS="$CFLAGS -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2"
fi
if (test "$USE_MAINTAINER_MODE" = "yes"); then
CFLAGS="$CFLAGS -Werror -Wextra"

View File

@@ -1,5 +1,5 @@
AC_PREREQ(2.60)
AC_INIT(ofono, 1.25)
AC_INIT(ofono, 1.29)
AM_INIT_AUTOMAKE([foreign subdir-objects color-tests])
AC_CONFIG_HEADERS(config.h)

View File

@@ -0,0 +1,164 @@
Every project has its own recursive patterns, and oFono is not an exception.
This document describes the most common ones found in the code.
Typical flow for atom <-> atom driver operations
================================================
Most of the time, the core atom for a given request calls a function in
the atom driver, which generally executes some commands against the modem,
and can then return the results to the core.
For example:
dbus call: lte/SetProperty(DefaultAPN)
|
v
core: check APN validity, call the modem atom for execution in the modem
|
v
atom driver: schedules 'AT+CGDCONT=0,"IP","MyNiceAPN"' for execution
|
[ break in the flow: the functions return back to the core, the dbus request ]
[ is not answered at this time ]
...
[GLibMain event loop schedules the command, it is sent to the modem and the ]
[ modem's reply is obtained ]
|
v
atom driver: a callback function, optionally provided when AT command was
scheduled is now called
|
v
core: atom driver core callback function is now called. This was passed from
the core as an argument, earlier, when the atom driver operation was invoked,
along with some context data (opaque info for the atom driver containing core
atom owned data)
|
v
the core can now answer the dbus message
In the code, it looks like this:
//core call:
static DBusMessage *lte_set_property(DBusConnection *conn,
DBusMessage *msg, void *data)
{
struct ofono_lte *lte = data;
/*
* a block of code here processes the msg and fills the
* lte->pending_info structure
*/
lte->driver->set_default_attach_info(lte, &lte->pending_info,
lte_set_default_attach_info_cb, lte);
return NULL;
}
// lte_set_default_attach_info_cb is the core callback function,
// the lte structure is the parameter that it takes
//atom:
static void at_lte_set_default_attach_info(const struct ofono_lte *lte,
const struct ofono_lte_default_attach_info *info,
ofono_lte_cb_t cb, void *data)
{
struct lte_driver_data *ldd = ofono_lte_get_data(lte);
// next line creates a structure for the in-atom callback
struct cb_data *cbd = cb_data_new(cb, data);
if (g_at_chat_send(ldd->chat, "AT", NULL,
at_lte_set_default_attach_info_cb,
cbd, g_free) > 0)
return;
g_free(cbd);
CALLBACK_WITH_FAILURE(cb, data);
}
// here the structure is allocate dynamically, and since it is quite common,
// the function g_at_chat_send accepts the last 3 parameters:
// - in-atom callback function
// - in-atom callback data
// - destroy function for dynamically-allocated callback data
// NOTE: if g_at_chat_send fails, it does not free the memory, so it must be
// done after the call.
// Note also the callback to the core directly here if the g_at_chat_send fails.
//atom callback:
static void at_lte_set_default_attach_info_cb(gboolean ok, GAtResult *result,
gpointer user_data)
{
struct cb_data *cbd = user_data;
if (result == NULL) {
CALLBACK_WITH_FAILURE(cbd->cb, cbd->data);
return;
}
decode_at_error(&error, g_at_result_final_response(result));
cbd->cb(&error, cbd->data);
}
// note that here cbd must not be released, it will be done by the GAtChat
// after invoking the callback (at_lte_set_default_attach_info_cb)
// note also that the core function will be executed before cbd is released,
// so the last line of the code is ok.
Use of the cb_data in AT command based atom drivers
===================================================
the cb_data can be used by creating the structure with cb_data_new,
and then there are two possibilities:
- use it in a single callback function, and destroy it with a call to
g_free.
Example:
- calling function:
struct cb_data *cbd = cb_data_new(cb, data);
if (g_at_chat_send(chat, buf, NULL, at_cgatt_cb, cbd, g_free) > 0)
return;
g_free(cbd);
- called function (here at_cgatt_cb):
static void at_cgatt_cb(gboolean ok, GAtResult *result,
gpointer user_data)
{
struct cb_data *cbd = user_data;
ofono_gprs_cb_t cb = cbd->cb;
struct ofono_error error;
decode_at_error(&error,
g_at_result_final_response(result));
cb(&error, cbd->data);
}
note the absence of explicit g_free(cbd);
- pass it through a train of callback functions, adding a reference at
each pass cb_data_ref, and removing it with cb_data_unref.
the use of cb_data_ref would replace a new object creation, while the
use of cb_data_unref the use of g_free.
Example:
- calling function:
struct cb_data *cbd = cb_data_new(cb, data);
// no cb_ref at the creation
if (g_at_chat_send(chat, buf, NULL,
at_lte_set_default_attach_info_cb,
cbd, cb_data_unref) > 0)
goto end;
cb_data_unref(cbd);
- called function 1 (at_lte_set_default_attach_info_cb):
static void at_lte_set_default_attach_info_cb(gboolean ok,
GAtResult *result, gpointer user_data)
{
struct cb_data *cbd = user_data;
cbd = cb_data_ref(cbd);
if (g_at_chat_send(chat, buf, NULL,
at_cgatt_cb, cbd, cb_data_unref) > 0)
return;
cb_data_unref(cbd);
}
- called function 2 (at_cgatt_cb):
like above. no call to g_free or cb_data_unref. The terminal function
doesn't need to know about the reference scheme.

View File

@@ -201,7 +201,8 @@ Properties boolean Active [readwrite]
string AuthenticationMethod [readwrite]
Holds the PPP authentication method to use. Valid
values are "pap" and "chap". Defaults to "chap".
values are "pap", "chap" and "none".
Defaults to "chap".
string Username [readwrite]

View File

@@ -0,0 +1,137 @@
LTE Coexistence hierarchy
=========================
Service org.ofono
Interface org.ofono.intel.LteCoexistence
Object path [variable prefix]/{modem0,modem1,...}
Methods dict GetProperties()
Returns all coexistence configuration properties.
void SetProperty(string property, variant value)
Changes the value of the specified property. Only
properties that are listed as Read-write are changeable.
On success a PropertyChanged signal will be emitted.
Possible Errors: [service].Error.InProgress
[service].Error.InvalidArguments
[service].Error.Failed
void RegisterAgent(object path)
Registers an agent which will be called whenever the
modem initiates LTE Coexistence information.
Possible Errors: [service].Error.InProgress
[service].Error.InvalidArguments
[service].Error.InvalidFormat
[service].Error.Failed
void UnregisterAgent(object path)
Unregisters an agent.
Possible Errors: [service].Error.InvalidArguments
[service].Error.Failed
a(a{sv}) GetPlmnHistory()
Requests for LTE Plmn history list stored in NVM to
retrieve geo location history like MobileNetworkCode,
MobileCountryCode, LteBandsFDD, LteBandsTDD,
ChannelBandwidth.
Refer to the sections below for which property types
are available, their valid value ranges and
applicability to different cell types.
Signals PropertyChanged(string property, variant value)
This signal indicates a changed value of the given
property.
Properties string Band [readwrite]
Frequency band in which the modem is operating when
using "lte" mode.
boolean BTActive [readwrite]
Contains whether BT Coex is activated or not.
boolean WLANActive [readwrite]
Contains whether WLAN Coex is activated or not.
string WLANBandwidth [readwrite]
Contains the frequency WLAN Coex is activated on, when
"CoexWLANActive" is active.
The possible values are:
- "20MHz"
- "40MHz"
- "80MHz"
LTECoexistenceAgent Hierarchy [experimental]
=============================
Service unique name
Interface org.ofono.intel.LteCoexistenceAgent
Object path freely definable
Methods void ReceiveBluetoothNotification(array{byte} notification,
dict info) [noreply]
Requests the agent to process Bluetooth related LTE
Coexistence information. The dictionary info contains
vector table with modem recommended Safe Tx/Rx band and
range information.The properties involved are
'SafeTxMin', 'SafeRxMin', 'SafeTxMax', 'SafeRxMax' and
'SafeVector'.
Possible Errors: None
void ReceiveWiFiNotification(array{byte} notification,
dict info) [noreply]
Requests the agent to process WiFi related LTE
Coexistence information. The dictionary info contains
vector table with modem recommended SafeTx/Rx band and
range information. The properties involved are
'SafeTxMin', 'SafeRxMin', 'SafeTxMax', 'SafeRxMax' and
'SafeVector'.
Possible Errors: None
void Release() [noreply]
Agent is being released, possibly because of oFono
terminating, Coex interface is being torn down or modem
off. No UnregisterAgent call is needed.
LTE Plmn history params
=======================
uint16 MobileNetworkCode [readonly, optional]
Contains the MNC of the cell.
uint16 MobileCountryCode [readonly, optional]
Contains the MCC of the cell.
uint32 LteBandsFDD [readonly, optional]
Contains the Lte FDD band. Valid range of values is 1 to 32 as per
3GPP 36.101 Section 5.5.
uint32 LteBandsTDD [readonly, optional]
Contains the Lte TDD band. Valid range of values is 33 to 64 as per
3GPP 36.101 Section 5.5.
byte ChannelBandwidth [readonly, optional]
Contains the Channel bandwidth. Valid range of values is 0 to 6 as per
3GPP 36.101 Section 5.6.

View File

@@ -33,3 +33,39 @@ Properties string DefaultAccessPointName [readwrite]
Setting this property to an empty string clears the
default APN from the modem.
string Protocol [readwrite, experimental]
Holds the protocol for this context. Valid values
are: "ip", "ipv6" and "dual". Default value is "ip".
string AuthenticationMethod [readwrite, experimental]
Sets the Method used for the authentication
for the default APN.
Available values are "none", "pap" and "chap".
Default is "none".
If the AuthenticationMethod is set to 'none',
no authentication is performed for the default attach
APN. Username and Password properties are ignored,
even if containing a valid value. If Username or
Password are empty, AuthenticationMethod is implicitly
assumed to be set to 'none'.
If the default APN supports authentication and it
fails, then it is up to the network how to proceed.
In general LTE access is denied and the modem can
fallback to a legacy technology if capable and another
radio technology is available.
string Username [readwrite, experimental]
Holds the username to be used for authentication
purposes.
string Password [readwrite, experimental]
Holds the password to be used for authentication
purposes.

View File

@@ -104,6 +104,16 @@ Properties string ServiceCenterAddress
"turkish" - Turkish alphabet
"spanish" - Spanish alphabet
"portuguese" - Portuguese alphabet
"bengali" - Bengali alphabet
"gujarati" - Gujarati alphabet
"hindi" - Hindi alphabet
"kannada" - Kannada alphabet
"malayalam" - Malayalam alphabet
"oriya" - Oriya alphabet
"punjabi"- Punjabi alphabet
"tamil" - Tamil alphabet
"telugu" - Telugu alphabet
"urdu" - Urdu alphabet
The standard, language-specific alphabets are defined
in 3GPP TS23.038, Annex A. By default, oFono uses

View File

@@ -82,7 +82,9 @@ Properties string Mode [readonly]
string Status [readonly]
The current registration status of a modem.
The current registration status of a modem. In case
technology is 'lte', 'registered' and 'roaming' may
not necessarily mean voice calling available.
The possible values are:
"unregistered" Not registered to any network

View File

@@ -205,3 +205,15 @@ Properties boolean Present [readonly]
Contains the SIM's ImsPrivateIdentity, read from the
ISIM.
uint32 CardSlotCount [readonly, experimental]
Contains the count of number of SIM card slots available.
uint32 ActiveCardSlot [readwrite, experimental]
Contains the index of the currently active SIM card slot
for dual SIM single active mode.
This property will range from 1 (default) to
CardSlotCount (max) value.

View File

@@ -10,3 +10,13 @@ On the i-Tetra tracking device, the SIM900 is accessed
via N_GSM mux device. We use ofono as SMS message
service and incoming voice calls service, so we
use /dev/gsmtty1 provided by N_GSM mux.
SIM800 modem usage
==================
When using sim800 modem, the udev rule is the same as the
sim900 rule :
KERNEL=="ttyS3", ENV{OFONO_DRIVER}="sim900"
Because the SIM800 and SIM900 code are the merged into one driver.

View File

@@ -3,6 +3,7 @@
* oFono - Open Source Telephony
*
* Copyright (C) 2008-2011 Intel Corporation. All rights reserved.
* Copyright (C) 2018 Gemalto M2M
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
@@ -654,3 +655,46 @@ int at_util_get_ipv4_address_and_netmask(const char *addrnetmask,
return ret;
}
int at_util_gprs_auth_method_to_auth_prot(
enum ofono_gprs_auth_method auth_method)
{
switch (auth_method) {
case OFONO_GPRS_AUTH_METHOD_ANY:
case OFONO_GPRS_AUTH_METHOD_PAP:
return 1;
case OFONO_GPRS_AUTH_METHOD_CHAP:
return 2;
case OFONO_GPRS_AUTH_METHOD_NONE:
return 0;
}
return 0;
}
const char *at_util_gprs_proto_to_pdp_type(enum ofono_gprs_proto proto)
{
switch (proto) {
case OFONO_GPRS_PROTO_IPV6:
return "IPV6";
case OFONO_GPRS_PROTO_IPV4V6:
return "IPV4V6";
break;
case OFONO_GPRS_PROTO_IP:
return "IP";
}
return NULL;
}
char *at_util_get_cgdcont_command(guint cid, enum ofono_gprs_proto proto,
const char *apn)
{
const char *pdp_type = at_util_gprs_proto_to_pdp_type(proto);
if (!apn)
return g_strdup_printf("AT+CGDCONT=%u", cid);
return g_strdup_printf("AT+CGDCONT=%u,\"%s\",\"%s\"", cid, pdp_type,
apn);
}

View File

@@ -3,6 +3,7 @@
* oFono - Open Source Telephony
*
* Copyright (C) 2008-2011 Intel Corporation. All rights reserved.
* Copyright (C) 2018 Gemalto M2M
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
@@ -86,7 +87,24 @@ void at_util_sim_state_query_free(struct at_util_sim_state_query *req);
int at_util_get_ipv4_address_and_netmask(const char *addrnetmask,
char *address, char *netmask);
int at_util_gprs_auth_method_to_auth_prot(
enum ofono_gprs_auth_method auth_method);
const char *at_util_gprs_proto_to_pdp_type(enum ofono_gprs_proto proto);
/*
* at_util_get_cgdcont_command
* if the apn pointer is NULL, the context will be removed: the resulting
* string will be like: AT+CGDCONT=7
* but if apn pointer is not NULL and the string is empty, then
* this function will create a normal context with empty apn, like:
* AT+CGDCONT=4,"IPV6",""
*/
char *at_util_get_cgdcont_command(guint cid, enum ofono_gprs_proto proto,
const char *apn);
struct cb_data {
gint ref_count;
void *cb;
void *data;
void *user;
@@ -97,12 +115,29 @@ static inline struct cb_data *cb_data_new(void *cb, void *data)
struct cb_data *ret;
ret = g_new0(struct cb_data, 1);
ret->ref_count = 1;
ret->cb = cb;
ret->data = data;
return ret;
}
static inline struct cb_data *cb_data_ref(struct cb_data *cbd)
{
cbd->ref_count++;
return cbd;
}
static inline void cb_data_unref(gpointer user_data)
{
struct cb_data *cbd = user_data;
if (--cbd->ref_count)
return;
g_free(cbd);
}
static inline int at_util_convert_signal_strength(int strength)
{
int result;

View File

@@ -23,7 +23,6 @@
#include <config.h>
#endif
#define _GNU_SOURCE
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
@@ -212,7 +211,7 @@ static void at_call_barring_remove(struct ofono_call_barring *cb)
ofono_call_barring_set_data(cb, NULL);
}
static struct ofono_call_barring_driver driver = {
static const struct ofono_call_barring_driver driver = {
.name = "atmodem",
.probe = at_call_barring_probe,
.remove = at_call_barring_remove,

View File

@@ -23,7 +23,6 @@
#include <config.h>
#endif
#define _GNU_SOURCE
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
@@ -264,7 +263,7 @@ static void at_ccfc_remove(struct ofono_call_forwarding *cf)
ofono_call_forwarding_set_data(cf, NULL);
}
static struct ofono_call_forwarding_driver driver = {
static const struct ofono_call_forwarding_driver driver = {
.name = "atmodem",
.probe = at_ccfc_probe,
.remove = at_ccfc_remove,

View File

@@ -23,7 +23,6 @@
#include <config.h>
#endif
#define _GNU_SOURCE
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
@@ -331,7 +330,7 @@ static void at_caoc_remove(struct ofono_call_meter *cm)
ofono_call_meter_set_data(cm, NULL);
}
static struct ofono_call_meter_driver driver = {
static const struct ofono_call_meter_driver driver = {
.name = "atmodem",
.probe = at_caoc_probe,
.remove = at_caoc_remove,

View File

@@ -23,7 +23,6 @@
#include <config.h>
#endif
#define _GNU_SOURCE
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
@@ -398,7 +397,7 @@ static void at_call_settings_remove(struct ofono_call_settings *cs)
ofono_call_settings_set_data(cs, NULL);
}
static struct ofono_call_settings_driver driver = {
static const struct ofono_call_settings_driver driver = {
.name = "atmodem",
.probe = at_call_settings_probe,
.remove = at_call_settings_remove,

View File

@@ -23,7 +23,6 @@
#include <config.h>
#endif
#define _GNU_SOURCE
#include <string.h>
#include <stdio.h>
@@ -207,7 +206,7 @@ static void at_call_volume_remove(struct ofono_call_volume *cv)
g_free(cvd);
}
static struct ofono_call_volume_driver driver = {
static const struct ofono_call_volume_driver driver = {
.name = "atmodem",
.probe = at_call_volume_probe,
.remove = at_call_volume_remove,

View File

@@ -23,7 +23,6 @@
#include <config.h>
#endif
#define _GNU_SOURCE
#include <string.h>
#include <stdio.h>
@@ -304,7 +303,7 @@ static void at_cbs_remove(struct ofono_cbs *cbs)
g_free(data);
}
static struct ofono_cbs_driver driver = {
static const struct ofono_cbs_driver driver = {
.name = "atmodem",
.probe = at_cbs_probe,
.remove = at_cbs_remove,

View File

@@ -153,7 +153,7 @@ static void at_devinfo_remove(struct ofono_devinfo *info)
g_at_chat_unref(chat);
}
static struct ofono_devinfo_driver driver = {
static const struct ofono_devinfo_driver driver = {
.name = "atmodem",
.probe = at_devinfo_probe,
.remove = at_devinfo_remove,

View File

@@ -24,7 +24,6 @@
#include <config.h>
#endif
#define _GNU_SOURCE
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
@@ -263,7 +262,7 @@ static void at_gnss_remove(struct ofono_gnss *gnss)
g_free(gd);
}
static struct ofono_gnss_driver driver = {
static const struct ofono_gnss_driver driver = {
.name = "atmodem",
.probe = at_gnss_probe,
.remove = at_gnss_remove,

View File

@@ -23,7 +23,6 @@
#include <config.h>
#endif
#define _GNU_SOURCE
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
@@ -488,7 +487,7 @@ static void at_gprs_context_remove(struct ofono_gprs_context *gc)
g_free(gcd);
}
static struct ofono_gprs_context_driver driver = {
static const struct ofono_gprs_context_driver driver = {
.name = "atmodem",
.probe = at_gprs_context_probe,
.remove = at_gprs_context_remove,

View File

@@ -24,7 +24,6 @@
#include <config.h>
#endif
#define _GNU_SOURCE
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
@@ -456,7 +455,6 @@ static void gprs_initialized(gboolean ok, GAtResult *result, gpointer user_data)
FALSE, gprs, NULL);
break;
case OFONO_VENDOR_UBLOX:
case OFONO_VENDOR_UBLOX_TOBY_L2:
g_at_chat_register(gd->chat, "+UREG:", ublox_ureg_notify,
FALSE, gprs, NULL);
g_at_chat_send(gd->chat, "AT+UREG=1", none_prefix,
@@ -642,7 +640,7 @@ static void at_gprs_remove(struct ofono_gprs *gprs)
g_free(gd);
}
static struct ofono_gprs_driver driver = {
static const struct ofono_gprs_driver driver = {
.name = "atmodem",
.probe = at_gprs_probe,
.remove = at_gprs_remove,

View File

@@ -3,6 +3,7 @@
* oFono - Open Source Telephony
*
* Copyright (C) 2017 Intel Corporation. All rights reserved.
* Copyright (C) 2018 Gemalto M2M
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
@@ -23,7 +24,6 @@
#include <config.h>
#endif
#define _GNU_SOURCE
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
@@ -41,45 +41,88 @@
#include "atmodem.h"
static const char *none_prefix[] = { NULL };
struct lte_driver_data {
GAtChat *chat;
struct ofono_lte_default_attach_info pending_info;
};
static void at_lte_set_default_attach_info_cb(gboolean ok, GAtResult *result,
static void at_lte_set_auth_cb(gboolean ok, GAtResult *result,
gpointer user_data)
{
struct cb_data *cbd = user_data;
ofono_lte_cb_t cb = cbd->cb;
struct ofono_error error;
DBG("ok %d", ok);
decode_at_error(&error, g_at_result_final_response(result));
cb(&error, cbd->data);
}
static void at_lte_set_default_attach_info_cb(gboolean ok, GAtResult *result,
gpointer user_data)
{
struct cb_data *cbd = user_data;
ofono_lte_cb_t cb = cbd->cb;
void *data = cbd->data;
struct lte_driver_data *ldd = cbd->user;
struct ofono_error error;
char buf[32 + OFONO_GPRS_MAX_USERNAME_LENGTH +
OFONO_GPRS_MAX_PASSWORD_LENGTH + 1];
size_t buflen = sizeof(buf);
size_t len;
enum ofono_gprs_auth_method auth_method;
if (!ok) {
decode_at_error(&error, g_at_result_final_response(result));
cb(&error, data);
return;
}
auth_method = ldd->pending_info.auth_method;
/* change the authentication method if the parameters are invalid */
if (!*ldd->pending_info.username || !*ldd->pending_info.password)
auth_method = OFONO_GPRS_AUTH_METHOD_NONE;
len = snprintf(buf, buflen, "AT+CGAUTH=0,%d",
at_util_gprs_auth_method_to_auth_prot(auth_method));
buflen -= len;
if (auth_method != OFONO_GPRS_AUTH_METHOD_NONE)
snprintf(buf + len, buflen, ",\"%s\",\"%s\"",
ldd->pending_info.username,
ldd->pending_info.password);
cbd = cb_data_ref(cbd);
if (g_at_chat_send(ldd->chat, buf, none_prefix,
at_lte_set_auth_cb, cbd, cb_data_unref) > 0)
return;
cb_data_unref(cbd);
CALLBACK_WITH_FAILURE(cb, data);
}
static void at_lte_set_default_attach_info(const struct ofono_lte *lte,
const struct ofono_lte_default_attach_info *info,
ofono_lte_cb_t cb, void *data)
{
struct lte_driver_data *ldd = ofono_lte_get_data(lte);
char buf[32 + OFONO_GPRS_MAX_APN_LENGTH + 1];
struct cb_data *cbd = cb_data_new(cb, data);
char *buf = at_util_get_cgdcont_command(0, info->proto, info->apn);
DBG("LTE config with APN: %s", info->apn);
cbd->user = ldd;
memcpy(&ldd->pending_info, info, sizeof(ldd->pending_info));
if (strlen(info->apn) > 0)
snprintf(buf, sizeof(buf), "AT+CGDCONT=0,\"IP\",\"%s\"",
info->apn);
else
snprintf(buf, sizeof(buf), "AT+CGDCONT=0,\"IP\"");
/* We can't do much in case of failure so don't check response. */
if (g_at_chat_send(ldd->chat, buf, NULL,
at_lte_set_default_attach_info_cb, cbd, g_free) > 0)
return;
if (g_at_chat_send(ldd->chat, buf, none_prefix,
at_lte_set_default_attach_info_cb,
cbd, cb_data_unref) > 0)
goto end;
cb_data_unref(cbd);
CALLBACK_WITH_FAILURE(cb, data);
end:
g_free(buf);
}
static gboolean lte_delayed_register(gpointer user_data)
@@ -124,7 +167,7 @@ static void at_lte_remove(struct ofono_lte *lte)
g_free(ldd);
}
static struct ofono_lte_driver driver = {
static const struct ofono_lte_driver driver = {
.name = "atmodem",
.probe = at_lte_probe,
.remove = at_lte_remove,

View File

@@ -24,7 +24,6 @@
#include <config.h>
#endif
#define _GNU_SOURCE
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
@@ -179,7 +178,7 @@ static int option_parse_tech(GAtResult *result)
return tech;
}
static int cinterion_parse_tech(GAtResult *result)
static int gemalto_parse_tech(GAtResult *result)
{
int tech = -1;
GAtResultIter iter;
@@ -235,13 +234,13 @@ static void at_creg_cb(gboolean ok, GAtResult *result, gpointer user_data)
cb(&error, status, lac, ci, tech, cbd->data);
}
static void cinterion_query_tech_cb(gboolean ok, GAtResult *result,
static void gemalto_query_tech_cb(gboolean ok, GAtResult *result,
gpointer user_data)
{
struct tech_query *tq = user_data;
int tech;
tech = cinterion_parse_tech(result);
tech = gemalto_parse_tech(result);
ofono_netreg_status_notify(tq->netreg,
tq->status, tq->lac, tq->ci, tech);
@@ -880,7 +879,7 @@ static void telit_ciev_notify(GAtResult *result, gpointer user_data)
ofono_netreg_strength_notify(netreg, strength);
}
static void cinterion_ciev_notify(GAtResult *result, gpointer user_data)
static void gemalto_ciev_notify(GAtResult *result, gpointer user_data)
{
struct ofono_netreg *netreg = user_data;
struct netreg_data *nd = ofono_netreg_get_data(netreg);
@@ -1560,12 +1559,12 @@ static void creg_notify(GAtResult *result, gpointer user_data)
option_query_tech_cb, tq, g_free) > 0)
return;
break;
case OFONO_VENDOR_CINTERION:
if (g_at_chat_send(nd->chat, "AT^SMONI",
smoni_prefix,
cinterion_query_tech_cb, tq, g_free) > 0)
return;
break;
case OFONO_VENDOR_GEMALTO:
if (g_at_chat_send(nd->chat, "AT^SMONI",
smoni_prefix,
gemalto_query_tech_cb, tq, g_free) > 0)
return;
break;
}
g_free(tq);
@@ -1656,8 +1655,11 @@ static ofono_bool_t build_cmer_string(char *buf, int *cmer_opts,
DBG("");
switch (nd->vendor) {
case OFONO_VENDOR_UBLOX_TOBY_L2:
/* UBX-13002752 R33: TOBY L2 doesn't support mode 2 and 3 */
case OFONO_VENDOR_UBLOX:
/* For all u-blox models, mode 3 is equivalent to mode 1;
* since some models do not support setting modes 2 nor 3
* (see UBX-13002752), we prefer mode 1 for all models.
*/
mode = "1";
break;
default:
@@ -2032,12 +2034,12 @@ static void at_creg_set_cb(gboolean ok, GAtResult *result, gpointer user_data)
g_at_chat_send(nd->chat, "AT*TLTS=1", none_prefix,
NULL, NULL, NULL);
break;
case OFONO_VENDOR_CINTERION:
case OFONO_VENDOR_GEMALTO:
/*
* We can't set rssi bounds from Cinterion responses
* We can't set rssi bounds from Gemalto responses
* so set them up to specified values here
*
* Cinterion rssi signal strength specified as:
* Gemalto rssi signal strength specified as:
* 0 <= -112dBm
* 1 - 4 signal strengh in 15 dB steps
* 5 >= -51 dBm
@@ -2051,7 +2053,7 @@ static void at_creg_set_cb(gboolean ok, GAtResult *result, gpointer user_data)
g_at_chat_send(nd->chat, "AT^SIND=\"rssi\",1", none_prefix,
NULL, NULL, NULL);
g_at_chat_register(nd->chat, "+CIEV:",
cinterion_ciev_notify, FALSE, netreg, NULL);
gemalto_ciev_notify, FALSE, netreg, NULL);
break;
case OFONO_VENDOR_NOKIA:
case OFONO_VENDOR_SAMSUNG:
@@ -2155,7 +2157,7 @@ static void at_netreg_remove(struct ofono_netreg *netreg)
g_free(nd);
}
static struct ofono_netreg_driver driver = {
static const struct ofono_netreg_driver driver = {
.name = "atmodem",
.probe = at_netreg_probe,
.remove = at_netreg_remove,

View File

@@ -23,7 +23,6 @@
#include <config.h>
#endif
#define _GNU_SOURCE
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
@@ -593,7 +592,7 @@ static void at_phonebook_remove(struct ofono_phonebook *pb)
g_free(pbd);
}
static struct ofono_phonebook_driver driver = {
static const struct ofono_phonebook_driver driver = {
.name = "atmodem",
.probe = at_phonebook_probe,
.remove = at_phonebook_remove,

View File

@@ -23,7 +23,6 @@
#include <config.h>
#endif
#define _GNU_SOURCE
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
@@ -76,6 +75,7 @@ static const char *cuad_prefix[] = { "+CUAD:", NULL };
static const char *ccho_prefix[] = { "+CCHO:", NULL };
static const char *crla_prefix[] = { "+CRLA:", NULL };
static const char *cgla_prefix[] = { "+CGLA:", NULL };
static const char *xcmscsc_prefix[] = { "+XCMSCSC:", NULL};
static const char *none_prefix[] = { NULL };
static void append_file_path(char *buf, const unsigned char *path,
@@ -1161,6 +1161,7 @@ static void at_pin_retries_query(struct ofono_sim *sim,
DBG("");
switch (sd->vendor) {
case OFONO_VENDOR_XMM:
case OFONO_VENDOR_IFX:
if (g_at_chat_send(sd->chat, "AT+XPINCNT", xpincnt_prefix,
xpincnt_cb, cbd, g_free) > 0)
@@ -1222,7 +1223,6 @@ static void at_pin_retries_query(struct ofono_sim *sim,
return;
break;
case OFONO_VENDOR_UBLOX:
case OFONO_VENDOR_UBLOX_TOBY_L2:
if (g_at_chat_send(sd->chat, "AT+UPINCNT", upincnt_prefix,
upincnt_cb, cbd, g_free) > 0)
return;
@@ -1922,6 +1922,83 @@ static void at_logical_access(struct ofono_sim *sim, int session_id,
CALLBACK_WITH_FAILURE(cb, NULL, 0, data);
}
static void xcmscsc_query_cb(gboolean ok, GAtResult *result, gpointer user)
{
struct ofono_sim *sim = user;
struct sim_data *sd = ofono_sim_get_data(sim);
GAtResultIter iter;
int active_slot;
if (!ok)
goto done;
g_at_result_iter_init(&iter, result);
if (!g_at_result_iter_next(&iter, "+XCMSCSC:"))
goto done;
g_at_result_iter_skip_next(&iter);
g_at_result_iter_skip_next(&iter);
g_at_result_iter_next_number(&iter, &active_slot);
/* set active SIM slot */
ofono_sim_set_active_card_slot(sim, active_slot + 1);
done:
/* Query supported <fac>s */
g_at_chat_send(sd->chat, "AT+CLCK=?", clck_prefix,
at_clck_query_cb, sim, NULL);
}
static void at_xcmscsc_test_cb(gboolean ok, GAtResult *result, gpointer user)
{
struct ofono_sim *sim = user;
struct sim_data *sd = ofono_sim_get_data(sim);
GAtResultIter iter;
int card_slot_count;
if (!ok)
goto done;
g_at_result_iter_init(&iter, result);
if (!g_at_result_iter_next(&iter, "+XCMSCSC:"))
goto done;
g_at_result_iter_skip_next(&iter);
g_at_result_iter_skip_next(&iter);
if (!g_at_result_iter_open_list(&iter))
goto done;
g_at_result_iter_skip_next(&iter);
if (!g_at_result_iter_next_number(&iter, &card_slot_count))
goto done;
/* Set num slots */
ofono_sim_set_card_slot_count(sim, card_slot_count + 1);
/*
* enable reporting of MSIM remap status information
* and enable automatic acceptance of MSIM Remap
* acknowledgement
*/
g_at_chat_send(sd->chat, "AT+XCMSRS=2", none_prefix,
NULL, NULL, NULL);
/* Query active card slot */
g_at_chat_send(sd->chat, "AT+XCMSCSC?", xcmscsc_prefix,
xcmscsc_query_cb, sim, NULL);
return;
done:
/* Query supported <fac>s */
g_at_chat_send(sd->chat, "AT+CLCK=?", clck_prefix,
at_clck_query_cb, sim, NULL);
}
static int at_sim_probe(struct ofono_sim *sim, unsigned int vendor,
void *data)
{
@@ -1940,6 +2017,10 @@ static int at_sim_probe(struct ofono_sim *sim, unsigned int vendor,
if (at_clck_cpwd_fac[i])
sd->passwd_type_mask |= (1 << i);
if (sd->vendor == OFONO_VENDOR_XMM)
return g_at_chat_send(sd->chat, "AT+XCMSCSC=?", xcmscsc_prefix,
at_xcmscsc_test_cb, sim, NULL) ? 0 : -1;
/* Query supported <fac>s */
return g_at_chat_send(sd->chat, "AT+CLCK=?", clck_prefix,
at_clck_query_cb, sim, NULL) ? 0 : -1;
@@ -1959,7 +2040,47 @@ static void at_sim_remove(struct ofono_sim *sim)
g_free(sd);
}
static struct ofono_sim_driver driver = {
static void xcmscsc_cb(gboolean ok, GAtResult *result,
gpointer user_data)
{
struct cb_data *cbd = user_data;
ofono_sim_set_active_card_slot_cb_t cb = cbd->cb;
struct ofono_error error;
decode_at_error(&error, g_at_result_final_response(result));
if (cb)
cb(&error, cbd->data);
}
static void at_set_active_card_slot(struct ofono_sim *sim, unsigned int index,
ofono_sim_set_active_card_slot_cb_t cb, void *data)
{
struct sim_data *sd = ofono_sim_get_data(sim);
struct cb_data *cbd = cb_data_new(cb, data);
char cmd[43];
if (sd->vendor != OFONO_VENDOR_XMM) {
struct ofono_error error;
error.type = OFONO_ERROR_TYPE_CME;
error.error = 4;
cb(&error, data);
return;
}
/* Enable single SIM mode for indicated card slot id */
snprintf(cmd, sizeof(cmd), "AT+XCMSCSC=1,0,%u,1", index);
if (g_at_chat_send(sd->chat, cmd, none_prefix, xcmscsc_cb,
cbd, g_free) > 0)
return;
g_free(cbd);
CALLBACK_WITH_FAILURE(cb, data);
}
static const struct ofono_sim_driver driver = {
.name = "atmodem",
.probe = at_sim_probe,
.remove = at_sim_remove,
@@ -1984,10 +2105,11 @@ static struct ofono_sim_driver driver = {
.session_read_binary = at_session_read_binary,
.session_read_record = at_session_read_record,
.session_read_info = at_session_read_info,
.logical_access = at_logical_access
.logical_access = at_logical_access,
.set_active_card_slot = at_set_active_card_slot
};
static struct ofono_sim_driver driver_noef = {
static const struct ofono_sim_driver driver_noef = {
.name = "atmodem-noef",
.probe = at_sim_probe,
.remove = at_sim_remove,

View File

@@ -23,7 +23,6 @@
#include <config.h>
#endif
#define _GNU_SOURCE
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
@@ -859,8 +858,18 @@ static gboolean build_cnmi_string(char *buf, int *cnmi_opts,
data->cnma_enabled ? "21" : "1", FALSE))
return FALSE;
switch (data->vendor) {
case OFONO_VENDOR_GEMALTO:
mode = "0";
break;
default:
/* Sounds like 2 is the sanest mode */
mode = "20";
break;
}
/* Always deliver CB via +CBM, otherwise don't deliver at all */
if (!append_cnmi_element(buf, &len, cnmi_opts[2], "20", FALSE))
if (!append_cnmi_element(buf, &len, cnmi_opts[2], mode, FALSE))
return FALSE;
/*
@@ -1320,7 +1329,7 @@ static void at_sms_remove(struct ofono_sms *sms)
ofono_sms_set_data(sms, NULL);
}
static struct ofono_sms_driver driver = {
static const struct ofono_sms_driver driver = {
.name = "atmodem",
.probe = at_sms_probe,
.remove = at_sms_remove,

View File

@@ -23,7 +23,6 @@
#include <config.h>
#endif
#define _GNU_SOURCE
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
@@ -223,7 +222,7 @@ static void at_stk_remove(struct ofono_stk *stk)
g_free(sd);
}
static struct ofono_stk_driver driver = {
static const struct ofono_stk_driver driver = {
.name = "atmodem",
.probe = at_stk_probe,
.remove = at_stk_remove,

View File

@@ -23,7 +23,6 @@
#include <config.h>
#endif
#define _GNU_SOURCE
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
@@ -92,7 +91,7 @@ static const unsigned char *ucs2_gsm_to_packed(const char *content,
return NULL;
}
packed = pack_7bit_own_buf(gsm, written, 0, TRUE, msg_len, 0, msg);
packed = pack_7bit_own_buf(gsm, written, 0, true, msg_len, 0, msg);
g_free(gsm);
return packed;
@@ -137,7 +136,7 @@ static void cusd_parse(GAtResult *result, struct ofono_ussd *ussd)
switch (data->charset) {
case AT_UTIL_CHARSET_GSM:
msg_ptr = pack_7bit_own_buf((const guint8 *) content,
-1, 0, TRUE, &msg_len,
-1, 0, true, &msg_len,
0, msg);
break;
@@ -201,7 +200,7 @@ static void at_ussd_request(struct ofono_ussd *ussd, int dcs,
unsigned char unpacked_buf[182];
long written;
unpack_7bit_own_buf(pdu, len, 0, TRUE, sizeof(unpacked_buf),
unpack_7bit_own_buf(pdu, len, 0, true, sizeof(unpacked_buf),
&written, 0, unpacked_buf);
if (written < 1)
@@ -327,7 +326,7 @@ static void at_ussd_remove(struct ofono_ussd *ussd)
g_free(data);
}
static struct ofono_ussd_driver driver = {
static const struct ofono_ussd_driver driver = {
.name = "atmodem",
.probe = at_ussd_probe,
.remove = at_ussd_remove,

View File

@@ -46,8 +46,6 @@ enum ofono_vendor {
OFONO_VENDOR_QUECTEL,
OFONO_VENDOR_QUECTEL_M95,
OFONO_VENDOR_UBLOX,
OFONO_VENDOR_UBLOX_TOBY_L2,
OFONO_VENDOR_CINTERION,
OFONO_VENDOR_XMM,
OFONO_VENDOR_GEMALTO,
};

View File

@@ -23,7 +23,6 @@
#include <config.h>
#endif
#define _GNU_SOURCE
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
@@ -1155,7 +1154,7 @@ static void at_voicecall_remove(struct ofono_voicecall *vc)
g_free(vd);
}
static struct ofono_voicecall_driver driver = {
static const struct ofono_voicecall_driver driver = {
.name = "atmodem",
.probe = at_voicecall_probe,
.remove = at_voicecall_remove,

View File

@@ -23,7 +23,6 @@
#include <config.h>
#endif
#define _GNU_SOURCE
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
@@ -292,7 +291,7 @@ static void calypso_stk_remove(struct ofono_stk *stk)
g_free(sd);
}
static struct ofono_stk_driver driver = {
static const struct ofono_stk_driver driver = {
.name = "calypsomodem",
.probe = calypso_stk_probe,
.remove = calypso_stk_remove,

View File

@@ -23,7 +23,6 @@
#include <config.h>
#endif
#define _GNU_SOURCE
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
@@ -402,7 +401,7 @@ static void calypso_voicecall_remove(struct ofono_voicecall *vc)
g_free(vd);
}
static struct ofono_voicecall_driver driver = {
static const struct ofono_voicecall_driver driver = {
.name = "calypsomodem",
.probe = calypso_voicecall_probe,
.remove = calypso_voicecall_remove,

View File

@@ -23,7 +23,6 @@
#include <config.h>
#endif
#define _GNU_SOURCE
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
@@ -323,7 +322,7 @@ static void cdma_connman_remove(struct ofono_cdma_connman *cm)
g_free(cd);
}
static struct ofono_cdma_connman_driver driver = {
static const struct ofono_cdma_connman_driver driver = {
.name = "cdmamodem",
.probe = cdma_connman_probe,
.remove = cdma_connman_remove,

View File

@@ -153,7 +153,7 @@ static void cdma_devinfo_remove(struct ofono_devinfo *info)
ofono_devinfo_set_data(info, NULL);
}
static struct ofono_devinfo_driver driver = {
static const struct ofono_devinfo_driver driver = {
.name = "cdmamodem",
.probe = cdma_devinfo_probe,
.remove = cdma_devinfo_remove,

View File

@@ -23,7 +23,6 @@
#include <config.h>
#endif
#define _GNU_SOURCE
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
@@ -143,7 +142,7 @@ static void cdma_voicecall_remove(struct ofono_cdma_voicecall *vc)
g_free(vd);
}
static struct ofono_cdma_voicecall_driver driver = {
static const struct ofono_cdma_voicecall_driver driver = {
.name = "cdmamodem",
.probe = cdma_voicecall_probe,
.remove = cdma_voicecall_remove,

View File

@@ -73,7 +73,7 @@ static void dun_gprs_attached_status(struct ofono_gprs *gprs,
CALLBACK_WITH_SUCCESS(cb, 1, data);
}
static struct ofono_gprs_driver driver = {
static const struct ofono_gprs_driver driver = {
.name = "dunmodem",
.probe = dun_gprs_probe,
.remove = dun_gprs_remove,

View File

@@ -107,7 +107,7 @@ static void dun_netreg_remove(struct ofono_netreg *netreg)
g_free(nd);
}
static struct ofono_netreg_driver driver = {
static const struct ofono_netreg_driver driver = {
.name = "dunmodem",
.probe = dun_netreg_probe,
.remove = dun_netreg_remove,

View File

@@ -3,6 +3,7 @@
* oFono - Open Source Telephony
*
* Copyright (C) 2017 Vincent Cesson. All rights reserved.
* Copyright (C) 2018 Gemalto M2M
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
@@ -35,12 +36,14 @@
static int gemaltomodem_init(void)
{
gemalto_location_reporting_init();
gemalto_voicecall_init();
return 0;
}
static void gemaltomodem_exit(void)
{
gemalto_voicecall_exit();
gemalto_location_reporting_exit();
}

View File

@@ -3,6 +3,7 @@
* oFono - Open Source Telephony
*
* Copyright (C) 2017 Vincent Cesson. All rights reserved.
* Copyright (C) 2018 Gemalto M2M
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
@@ -23,3 +24,6 @@
extern void gemalto_location_reporting_init();
extern void gemalto_location_reporting_exit();
extern void gemalto_voicecall_init();
extern void gemalto_voicecall_exit();

View File

@@ -23,7 +23,6 @@
#include <config.h>
#endif
#define _GNU_SOURCE
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
@@ -217,7 +216,7 @@ static void gemalto_location_reporting_remove(struct ofono_location_reporting *l
g_free(gd);
}
static struct ofono_location_reporting_driver driver = {
static const struct ofono_location_reporting_driver driver = {
.name = "gemaltomodem",
.type = OFONO_LOCATION_REPORTING_TYPE_NMEA,
.probe = gemalto_location_reporting_probe,

View File

@@ -0,0 +1,576 @@
/*
*
* oFono - Open Source Telephony
*
* Copyright (C) 2008-2011 Intel Corporation. All rights reserved.
* Copyright (C) 2018 Gemalto M2M
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <errno.h>
#include <glib.h>
#include <ofono/log.h>
#include <ofono/modem.h>
#include <ofono/voicecall.h>
#include "gatchat.h"
#include "gatresult.h"
#include "common.h"
#include "gemaltomodem.h"
static const char *clcc_prefix[] = { "+CLCC:", NULL };
static const char *none_prefix[] = { NULL };
struct voicecall_data {
GAtChat *chat;
GSList *calls;
unsigned int local_release;
GSList *new_calls;
};
struct release_id_req {
struct ofono_voicecall *vc;
ofono_voicecall_cb_t cb;
void *data;
int id;
};
struct change_state_req {
struct ofono_voicecall *vc;
ofono_voicecall_cb_t cb;
void *data;
int affected_types;
};
static void generic_cb(gboolean ok, GAtResult *result, gpointer user_data)
{
struct change_state_req *req = user_data;
struct voicecall_data *vd = ofono_voicecall_get_data(req->vc);
struct ofono_error error;
decode_at_error(&error, g_at_result_final_response(result));
if (ok && req->affected_types) {
GSList *l;
struct ofono_call *call;
for (l = vd->calls; l; l = l->next) {
call = l->data;
if (req->affected_types & (1 << call->status))
vd->local_release |= (1 << call->id);
}
}
req->cb(&error, req->data);
}
static void gemalto_call_common(const char *cmd, struct ofono_voicecall *vc,
GAtResultFunc result_cb,
unsigned int affected_types,
ofono_voicecall_cb_t cb, void *data)
{
struct voicecall_data *vd = ofono_voicecall_get_data(vc);
struct change_state_req *req = g_new0(struct change_state_req, 1);
req->vc = vc;
req->cb = cb;
req->data = data;
req->affected_types = affected_types;
if (g_at_chat_send(vd->chat, cmd, none_prefix,
result_cb, req, g_free) > 0)
return;
g_free(req);
CALLBACK_WITH_FAILURE(cb, data);
}
static void gemalto_answer(struct ofono_voicecall *vc,
ofono_voicecall_cb_t cb, void *data)
{
gemalto_call_common("ATA", vc, generic_cb, 0, cb, data);
}
static void gemalto_hangup_all(struct ofono_voicecall *vc,
ofono_voicecall_cb_t cb, void *data)
{
unsigned int affected = (1 << CALL_STATUS_INCOMING) |
(1 << CALL_STATUS_DIALING) |
(1 << CALL_STATUS_ALERTING) |
(1 << CALL_STATUS_WAITING) |
(1 << CALL_STATUS_HELD) |
(1 << CALL_STATUS_ACTIVE);
/* Hangup all calls */
gemalto_call_common("AT+CHUP", vc, generic_cb, affected, cb, data);
}
static void gemalto_hangup(struct ofono_voicecall *vc,
ofono_voicecall_cb_t cb, void *data)
{
unsigned int affected = (1 << CALL_STATUS_ACTIVE);
/* Hangup current active call */
gemalto_call_common("AT+CHLD=1", vc, generic_cb, affected, cb, data);
}
static void gemalto_hold_all_active(struct ofono_voicecall *vc,
ofono_voicecall_cb_t cb, void *data)
{
unsigned int affected = (1 << CALL_STATUS_ACTIVE);
gemalto_call_common("AT+CHLD=2", vc, generic_cb, affected, cb, data);
}
static void gemalto_release_all_held(struct ofono_voicecall *vc,
ofono_voicecall_cb_t cb, void *data)
{
unsigned int affected = (1 << CALL_STATUS_INCOMING) |
(1 << CALL_STATUS_WAITING);
gemalto_call_common("AT+CHLD=0", vc, generic_cb, affected, cb, data);
}
static void gemalto_set_udub(struct ofono_voicecall *vc,
ofono_voicecall_cb_t cb, void *data)
{
unsigned int affected = (1 << CALL_STATUS_INCOMING) |
(1 << CALL_STATUS_WAITING);
gemalto_call_common("AT+CHLD=0", vc, generic_cb, affected, cb, data);
}
static void gemalto_release_all_active(struct ofono_voicecall *vc,
ofono_voicecall_cb_t cb, void *data)
{
unsigned int affected = (1 << CALL_STATUS_ACTIVE);
gemalto_call_common("AT+CHLD=1", vc, generic_cb, affected, cb, data);
}
static void release_id_cb(gboolean ok, GAtResult *result, gpointer user_data)
{
struct release_id_req *req = user_data;
struct voicecall_data *vd = ofono_voicecall_get_data(req->vc);
struct ofono_error error;
decode_at_error(&error, g_at_result_final_response(result));
if (ok)
vd->local_release = 1 << req->id;
req->cb(&error, req->data);
}
static void gemalto_release_specific(struct ofono_voicecall *vc, int id,
ofono_voicecall_cb_t cb, void *data)
{
struct voicecall_data *vd = ofono_voicecall_get_data(vc);
struct release_id_req *req = g_new0(struct release_id_req, 1);
char buf[32];
req->vc = vc;
req->cb = cb;
req->data = data;
req->id = id;
snprintf(buf, sizeof(buf), "AT+CHLD=1%d", id);
if (g_at_chat_send(vd->chat, buf, none_prefix,
release_id_cb, req, g_free) > 0)
return;
g_free(req);
CALLBACK_WITH_FAILURE(cb, data);
}
static void gemalto_private_chat(struct ofono_voicecall *vc, int id,
ofono_voicecall_cb_t cb, void *data)
{
char buf[32];
snprintf(buf, sizeof(buf), "AT+CHLD=2%d", id);
gemalto_call_common(buf, vc, generic_cb, 0, cb, data);
}
static void gemalto_create_multiparty(struct ofono_voicecall *vc,
ofono_voicecall_cb_t cb, void *data)
{
gemalto_call_common("AT+CHLD=3", vc, generic_cb, 0, cb, data);
}
static void gemalto_transfer(struct ofono_voicecall *vc,
ofono_voicecall_cb_t cb, void *data)
{
/* Held & Active */
unsigned int affected = (1 << CALL_STATUS_ACTIVE) |
(1 << CALL_STATUS_HELD);
/* Transfer can puts held & active calls together and disconnects
* from both. However, some networks support transferring of
* dialing/ringing calls as well.
*/
affected |= (1 << CALL_STATUS_DIALING) |
(1 << CALL_STATUS_ALERTING);
gemalto_call_common("AT+CHLD=4", vc, generic_cb, affected, cb, data);
}
static void gemalto_send_dtmf(struct ofono_voicecall *vc, const char *dtmf,
ofono_voicecall_cb_t cb, void *data)
{
struct ofono_modem *modem = ofono_voicecall_get_modem(vc);
int use_quotes = ofono_modem_get_integer(modem, "GemaltoVtsQuotes");
int len = strlen(dtmf);
int s;
int i;
char *buf;
/* strlen("+VTS=\"T\";") = 9 + initial AT + null */
buf = (char *)alloca(len * 9 + 3);
if (use_quotes)
s = sprintf(buf, "AT+VTS=\"%c\"", dtmf[0]);
else
s = sprintf(buf, "AT+VTS=%c", dtmf[0]);
for (i = 1; i < len; i++) {
if (use_quotes)
s += sprintf(buf + s, ";+VTS=\"%c\"", dtmf[i]);
else
s += sprintf(buf + s, ";+VTS=%c", dtmf[i]);
}
gemalto_call_common(buf, vc, generic_cb, 0, cb, data);
}
static void gemalto_dial(struct ofono_voicecall *vc,
const struct ofono_phone_number *ph,
enum ofono_clir_option clir,
ofono_voicecall_cb_t cb, void *data)
{
struct cb_data *cbd = cb_data_new(cb, data);
char buf[256];
size_t len;
cbd->user = vc;
if (ph->type == 145)
len = snprintf(buf, sizeof(buf), "ATD+%s", ph->number);
else
len = snprintf(buf, sizeof(buf), "ATD%s", ph->number);
switch (clir) {
case OFONO_CLIR_OPTION_INVOCATION:
len += snprintf(buf+len, sizeof(buf)-len, "I");
break;
case OFONO_CLIR_OPTION_SUPPRESSION:
len += snprintf(buf+len, sizeof(buf)-len, "i");
break;
default:
break;
}
snprintf(buf + len, sizeof(buf) - len, ";");
gemalto_call_common(buf, vc, generic_cb, 0, cb, data);
}
static void gemalto_parse_slcc(GAtResult *result, GSList **l,
ofono_bool_t *ret_mpty, gboolean *last)
{
GAtResultIter iter;
int id, dir, status, type;
ofono_bool_t mpty;
struct ofono_call *call;
const char *str = "";
int number_type = 129;
if (last)
*last = TRUE;
g_at_result_iter_init(&iter, result);
g_at_result_iter_next(&iter, "^SLCC:");
if (!g_at_result_iter_next_number(&iter, &id))
return;
if (last)
*last = FALSE;
if (id == 0)
return;
if (!g_at_result_iter_next_number(&iter, &dir))
return;
if (!g_at_result_iter_next_number(&iter, &status))
return;
if (status > 5)
return;
if (!g_at_result_iter_next_number(&iter, &type))
return;
if (!g_at_result_iter_next_number(&iter, &mpty))
return;
/* skip 'Reserved=0' parameter, only difference from CLCC */
if (!g_at_result_iter_skip_next(&iter))
return;
if (g_at_result_iter_next_string(&iter, &str))
g_at_result_iter_next_number(&iter, &number_type);
call = g_new0(struct ofono_call, 1);
ofono_call_init(call);
call->id = id;
call->direction = dir;
call->status = status;
call->type = type;
strncpy(call->phone_number.number, str,
OFONO_MAX_PHONE_NUMBER_LENGTH);
call->phone_number.type = number_type;
if (strlen(str) > 0)
call->clip_validity = 2;
else
call->clip_validity = 0;
*l = g_slist_insert_sorted(*l, call, at_util_call_compare);
if (ret_mpty)
*ret_mpty = mpty;
}
static void clcc_cb(gboolean ok, GAtResult *result, gpointer user_data)
{
struct ofono_voicecall *vc = user_data;
struct voicecall_data *vd = ofono_voicecall_get_data(vc);
GSList *l;
if (!ok)
return;
vd->calls = at_util_parse_clcc(result, NULL);
for (l = vd->calls; l; l = l->next)
ofono_voicecall_notify(vc, l->data);
}
/*
* ^SLCC, except for one RFU parameter (see above in the parsing), is identical
* to +CLCC, but as URC it is parsed line by line, and the last line is
* indicated by an empty "^SLCC:" (equivalent to the "OK" for CLCC).
*/
static void slcc_notify(GAtResult *result, gpointer user_data)
{
struct ofono_voicecall *vc = user_data;
struct voicecall_data *vd = ofono_voicecall_get_data(vc);
GSList *n, *o;
struct ofono_call *nc, *oc;
gboolean last;
gemalto_parse_slcc(result, &vd->new_calls, NULL, &last);
if (!last)
return;
n = vd->new_calls;
o = vd->calls;
while (n || o) {
nc = n ? n->data : NULL;
oc = o ? o->data : NULL;
if (oc && (nc == NULL || (nc->id > oc->id))) {
enum ofono_disconnect_reason reason;
if (vd->local_release & (1 << oc->id))
reason = OFONO_DISCONNECT_REASON_LOCAL_HANGUP;
else
reason = OFONO_DISCONNECT_REASON_REMOTE_HANGUP;
if (!oc->type)
ofono_voicecall_disconnected(vc, oc->id,
reason, NULL);
o = o->next;
} else if (nc && (oc == NULL || (nc->id < oc->id))) {
if (nc->type == 0) /* new call, signal it */
ofono_voicecall_notify(vc, nc);
n = n->next;
} else {
DBG("modify call part");
/* notify in case of changes */
if (memcmp(nc, oc, sizeof(*nc)))
ofono_voicecall_notify(vc, nc);
n = n->next;
o = o->next;
}
}
g_slist_free_full(vd->calls, g_free);
vd->calls = vd->new_calls;
vd->new_calls = NULL;
vd->local_release = 0;
}
static void cssi_notify(GAtResult *result, gpointer user_data)
{
struct ofono_voicecall *vc = user_data;
GAtResultIter iter;
int code, index;
g_at_result_iter_init(&iter, result);
if (!g_at_result_iter_next(&iter, "+CSSI:"))
return;
if (!g_at_result_iter_next_number(&iter, &code))
return;
if (!g_at_result_iter_next_number(&iter, &index))
index = 0;
ofono_voicecall_ssn_mo_notify(vc, 0, code, index);
}
static void cssu_notify(GAtResult *result, gpointer user_data)
{
struct ofono_voicecall *vc = user_data;
GAtResultIter iter;
int code;
int index;
const char *num;
struct ofono_phone_number ph;
ph.number[0] = '\0';
ph.type = 129;
g_at_result_iter_init(&iter, result);
if (!g_at_result_iter_next(&iter, "+CSSU:"))
return;
if (!g_at_result_iter_next_number(&iter, &code))
return;
if (!g_at_result_iter_next_number_default(&iter, -1, &index))
goto out;
if (!g_at_result_iter_next_string(&iter, &num))
goto out;
strncpy(ph.number, num, OFONO_MAX_PHONE_NUMBER_LENGTH);
if (!g_at_result_iter_next_number(&iter, &ph.type))
return;
out:
ofono_voicecall_ssn_mt_notify(vc, 0, code, index, &ph);
}
static void gemalto_voicecall_initialized(gboolean ok, GAtResult *result,
gpointer user_data)
{
struct ofono_voicecall *vc = user_data;
struct voicecall_data *vd = ofono_voicecall_get_data(vc);
DBG("voicecall_init: registering to notifications");
/* NO CARRIER, NO ANSWER, BUSY, NO DIALTONE are handled through SLCC */
g_at_chat_register(vd->chat, "^SLCC:", slcc_notify, FALSE, vc, NULL);
g_at_chat_register(vd->chat, "+CSSI:", cssi_notify, FALSE, vc, NULL);
g_at_chat_register(vd->chat, "+CSSU:", cssu_notify, FALSE, vc, NULL);
ofono_voicecall_register(vc);
/* Populate the call list */
g_at_chat_send(vd->chat, "AT+CLCC", clcc_prefix, clcc_cb, vc, NULL);
}
static int gemalto_voicecall_probe(struct ofono_voicecall *vc,
unsigned int vendor, void *data)
{
GAtChat *chat = data;
struct voicecall_data *vd;
vd = g_new0(struct voicecall_data, 1);
vd->chat = g_at_chat_clone(chat);
ofono_voicecall_set_data(vc, vd);
g_at_chat_send(vd->chat, "AT+CSSN=1,1", NULL, NULL, NULL, NULL);
g_at_chat_send(vd->chat, "AT^SLCC=1", NULL,
gemalto_voicecall_initialized, vc, NULL);
return 0;
}
static void gemalto_voicecall_remove(struct ofono_voicecall *vc)
{
struct voicecall_data *vd = ofono_voicecall_get_data(vc);
ofono_voicecall_set_data(vc, NULL);
g_at_chat_unref(vd->chat);
g_free(vd);
}
static const struct ofono_voicecall_driver driver = {
.name = "gemaltomodem",
.probe = gemalto_voicecall_probe,
.remove = gemalto_voicecall_remove,
.dial = gemalto_dial,
.answer = gemalto_answer,
.hangup_all = gemalto_hangup_all,
.hangup_active = gemalto_hangup,
.hold_all_active = gemalto_hold_all_active,
.release_all_held = gemalto_release_all_held,
.set_udub = gemalto_set_udub,
.release_all_active = gemalto_release_all_active,
.release_specific = gemalto_release_specific,
.private_chat = gemalto_private_chat,
.create_multiparty = gemalto_create_multiparty,
.transfer = gemalto_transfer,
.send_tones = gemalto_send_dtmf
};
void gemalto_voicecall_init(void)
{
ofono_voicecall_driver_register(&driver);
}
void gemalto_voicecall_exit(void)
{
ofono_voicecall_driver_unregister(&driver);
}

View File

@@ -23,7 +23,6 @@
#include <config.h>
#endif
#define _GNU_SOURCE
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
@@ -218,7 +217,7 @@ static void hfp_call_volume_remove(struct ofono_call_volume *cv)
g_free(vd);
}
static struct ofono_call_volume_driver driver = {
static const struct ofono_call_volume_driver driver = {
.name = "hfpmodem",
.probe = hfp_call_volume_probe,
.remove = hfp_call_volume_remove,

View File

@@ -91,7 +91,7 @@ static void hfp_devinfo_remove(struct ofono_devinfo *info)
g_free(dd);
}
static struct ofono_devinfo_driver driver = {
static const struct ofono_devinfo_driver driver = {
.name = "hfpmodem",
.probe = hfp_devinfo_probe,
.remove = hfp_devinfo_remove,

View File

@@ -24,7 +24,6 @@
#include <config.h>
#endif
#define _GNU_SOURCE
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
@@ -411,7 +410,7 @@ static void hfp_hf_indicator(struct ofono_handsfree *hf,
CALLBACK_WITH_FAILURE(cb, data);
}
static struct ofono_handsfree_driver driver = {
static const struct ofono_handsfree_driver driver = {
.name = "hfpmodem",
.probe = hfp_handsfree_probe,
.remove = hfp_handsfree_remove,

View File

@@ -24,7 +24,6 @@
#include <config.h>
#endif
#define _GNU_SOURCE
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
@@ -343,7 +342,7 @@ static void hfp_netreg_remove(struct ofono_netreg *netreg)
g_free(nd);
}
static struct ofono_netreg_driver driver = {
static const struct ofono_netreg_driver driver = {
.name = "hfpmodem",
.probe = hfp_netreg_probe,
.remove = hfp_netreg_remove,

View File

@@ -23,7 +23,6 @@
#include <config.h>
#endif
#define _GNU_SOURCE
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
@@ -196,7 +195,7 @@ static void hfp_siri_set_eyes_free_mode(struct ofono_siri *siri,
CALLBACK_WITH_FAILURE(cb, NULL);
}
static struct ofono_siri_driver driver = {
static const struct ofono_siri_driver driver = {
.name = "hfpmodem",
.probe = hfp_siri_probe,
.remove = hfp_siri_remove,

View File

@@ -23,7 +23,6 @@
#include <config.h>
#endif
#define _GNU_SOURCE
#include <stdio.h>
#include <string.h>
#include <errno.h>

View File

@@ -23,7 +23,6 @@
#include <config.h>
#endif
#define _GNU_SOURCE
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
@@ -1303,7 +1302,7 @@ static void hfp_voicecall_remove(struct ofono_voicecall *vc)
g_free(vd);
}
static struct ofono_voicecall_driver driver = {
static const struct ofono_voicecall_driver driver = {
.name = "hfpmodem",
.probe = hfp_voicecall_probe,
.remove = hfp_voicecall_remove,

View File

@@ -23,7 +23,6 @@
#include <config.h>
#endif
#define _GNU_SOURCE
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
@@ -379,7 +378,7 @@ static void hso_gprs_context_remove(struct ofono_gprs_context *gc)
g_free(gcd);
}
static struct ofono_gprs_context_driver driver = {
static const struct ofono_gprs_context_driver driver = {
.name = "hsomodem",
.probe = hso_gprs_context_probe,
.remove = hso_gprs_context_remove,

View File

@@ -23,7 +23,6 @@
#include <config.h>
#endif
#define _GNU_SOURCE
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
@@ -199,7 +198,7 @@ static void hso_radio_settings_remove(struct ofono_radio_settings *rs)
g_free(rsd);
}
static struct ofono_radio_settings_driver driver = {
static const struct ofono_radio_settings_driver driver = {
.name = "hsomodem",
.probe = hso_radio_settings_probe,
.remove = hso_radio_settings_remove,

View File

@@ -23,7 +23,6 @@
#include <config.h>
#endif
#define _GNU_SOURCE
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
@@ -113,7 +112,7 @@ static void huawei_audio_settings_remove(struct ofono_audio_settings *as)
g_free(asd);
}
static struct ofono_audio_settings_driver driver = {
static const struct ofono_audio_settings_driver driver = {
.name = "huaweimodem",
.probe = huawei_audio_settings_probe,
.remove = huawei_audio_settings_remove,

View File

@@ -23,7 +23,6 @@
#include <config.h>
#endif
#define _GNU_SOURCE
#include <glib.h>
#include <errno.h>
@@ -210,7 +209,7 @@ static void huawei_cdma_netreg_remove(struct ofono_cdma_netreg *netreg)
g_at_chat_unref(chat);
}
static struct ofono_cdma_netreg_driver driver = {
static const struct ofono_cdma_netreg_driver driver = {
.name = "huaweimodem",
.probe = huawei_cdma_netreg_probe,
.remove = huawei_cdma_netreg_remove,

View File

@@ -23,7 +23,6 @@
#include <config.h>
#endif
#define _GNU_SOURCE
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
@@ -339,7 +338,7 @@ static void huawei_gprs_context_remove(struct ofono_gprs_context *gc)
g_free(gcd);
}
static struct ofono_gprs_context_driver driver = {
static const struct ofono_gprs_context_driver driver = {
.name = "huaweimodem",
.probe = huawei_gprs_context_probe,
.remove = huawei_gprs_context_remove,

View File

@@ -23,7 +23,6 @@
#include <config.h>
#endif
#define _GNU_SOURCE
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
@@ -569,7 +568,7 @@ static void huawei_radio_settings_remove(struct ofono_radio_settings *rs)
g_free(rsd);
}
static struct ofono_radio_settings_driver driver = {
static const struct ofono_radio_settings_driver driver = {
.name = "huaweimodem",
.probe = huawei_radio_settings_probe,
.remove = huawei_radio_settings_remove,

View File

@@ -204,7 +204,7 @@ static void huawei_ussd_remove(struct ofono_ussd *ussd)
g_free(data);
}
static struct ofono_ussd_driver driver = {
static const struct ofono_ussd_driver driver = {
.name = "huaweimodem",
.probe = huawei_ussd_probe,
.remove = huawei_ussd_remove,

View File

@@ -23,7 +23,6 @@
#include <config.h>
#endif
#define _GNU_SOURCE
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
@@ -497,7 +496,7 @@ static void huawei_voicecall_remove(struct ofono_voicecall *vc)
g_free(vd);
}
static struct ofono_voicecall_driver driver = {
static const struct ofono_voicecall_driver driver = {
.name = "huaweimodem",
.probe = huawei_voicecall_probe,
.remove = huawei_voicecall_remove,

View File

@@ -23,7 +23,6 @@
#include <config.h>
#endif
#define _GNU_SOURCE
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
@@ -403,7 +402,7 @@ static void icera_gprs_context_remove(struct ofono_gprs_context *gc)
g_free(gcd);
}
static struct ofono_gprs_context_driver driver = {
static const struct ofono_gprs_context_driver driver = {
.name = "iceramodem",
.probe = icera_gprs_context_probe,
.remove = icera_gprs_context_remove,

View File

@@ -23,7 +23,6 @@
#include <config.h>
#endif
#define _GNU_SOURCE
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
@@ -212,7 +211,7 @@ static void icera_radio_settings_remove(struct ofono_radio_settings *rs)
g_free(rsd);
}
static struct ofono_radio_settings_driver driver = {
static const struct ofono_radio_settings_driver driver = {
.name = "iceramodem",
.probe = icera_radio_settings_probe,
.remove = icera_radio_settings_remove,

View File

@@ -23,7 +23,6 @@
#include <config.h>
#endif
#define _GNU_SOURCE
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
@@ -382,7 +381,7 @@ static void ifx_audio_settings_remove(struct ofono_audio_settings *as)
g_free(asd);
}
static struct ofono_audio_settings_driver driver = {
static const struct ofono_audio_settings_driver driver = {
.name = "ifxmodem",
.probe = ifx_audio_settings_probe,
.remove = ifx_audio_settings_remove,

View File

@@ -23,7 +23,6 @@
#include <config.h>
#endif
#define _GNU_SOURCE
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
@@ -167,7 +166,7 @@ static void ifx_ctm_remove(struct ofono_ctm *ctm)
g_free(ctmd);
}
static struct ofono_ctm_driver driver = {
static const struct ofono_ctm_driver driver = {
.name = "ifxmodem",
.probe = ifx_ctm_probe,
.remove = ifx_ctm_remove,

View File

@@ -23,7 +23,6 @@
#include <config.h>
#endif
#define _GNU_SOURCE
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
@@ -261,6 +260,45 @@ error:
failed_setup(gc, NULL, TRUE);
}
static void cgdata_cb(gboolean ok, GAtResult *result, gpointer user_data)
{
struct ofono_gprs_context *gc = user_data;
struct gprs_context_data *gcd = ofono_gprs_context_get_data(gc);
DBG("ok %d", ok);
if (!ok) {
ofono_error("Failed to establish session");
failed_setup(gc, result, TRUE);
return;
}
CALLBACK_WITH_SUCCESS(gcd->cb, gcd->cb_data);
}
static const char *get_datapath(struct ofono_modem *modem,
const char *interface)
{
static char datapath[256];
char n;
if (!strcmp(interface,
ofono_modem_get_string(modem, "NetworkInterface")))
n = '0';
else if (!strcmp(interface,
ofono_modem_get_string(modem, "NetworkInterface2")))
n = '1';
else if (!strcmp(interface,
ofono_modem_get_string(modem, "NetworkInterface3")))
n = '2';
else
return NULL;
snprintf(datapath, sizeof(datapath), "%s%c",
ofono_modem_get_string(modem, "DataPath"), n);
return datapath;
}
static void cgcontrdp_cb(gboolean ok, GAtResult *result, gpointer user_data)
{
struct ofono_gprs_context *gc = user_data;
@@ -270,8 +308,11 @@ static void cgcontrdp_cb(gboolean ok, GAtResult *result, gpointer user_data)
const char *laddrnetmask = NULL;
const char *gw = NULL;
const char *interface;
const char *dns[3];
const char *ctrlpath;
const char *datapath;
char buf[512];
const char *interface;
DBG("ok %d", ok);
@@ -328,9 +369,10 @@ static void cgcontrdp_cb(gboolean ok, GAtResult *result, gpointer user_data)
DBG("DNS2: %s\n", gcd->dns2);
DBG("Gateway: %s\n", gcd->gateway);
interface = ofono_modem_get_string(modem, "NetworkInterface");
ctrlpath = ofono_modem_get_string(modem, "CtrlPath");
interface = ofono_gprs_context_get_interface(gc);
datapath = get_datapath(modem, interface);
ofono_gprs_context_set_interface(gc, interface);
ofono_gprs_context_set_ipv4_address(gc, gcd->address, TRUE);
if (gcd->netmask[0])
@@ -341,7 +383,17 @@ static void cgcontrdp_cb(gboolean ok, GAtResult *result, gpointer user_data)
ofono_gprs_context_set_ipv4_dns_servers(gc, dns);
CALLBACK_WITH_SUCCESS(gcd->cb, gcd->cb_data);
snprintf(buf, sizeof(buf), "AT+XDATACHANNEL=1,1,\"%s\",\"%s\",2,%u",
ctrlpath, datapath, gcd->active_context);
g_at_chat_send(gcd->chat, buf, none_prefix, NULL, NULL, NULL);
snprintf(buf, sizeof(buf), "AT+CGDATA=\"M-RAW_IP\",%u",
gcd->active_context);
if (g_at_chat_send(gcd->chat, buf, none_prefix, cgdata_cb,
gc, NULL) > 0)
return;
CALLBACK_WITH_FAILURE(gcd->cb, gcd->cb_data);
}
static void ifx_read_settings(struct ofono_gprs_context *gc)
@@ -514,6 +566,9 @@ static void deactivate_cb(gboolean ok, GAtResult *result, gpointer user_data)
if (gcd->vendor != OFONO_VENDOR_XMM)
g_at_chat_resume(gcd->chat);
if (!gcd->cb)
return;
CALLBACK_WITH_SUCCESS(gcd->cb, gcd->cb_data);
}
@@ -608,9 +663,11 @@ static int ifx_gprs_context_probe(struct ofono_gprs_context *gc,
DBG("");
if (stat(TUN_DEV, &st) < 0) {
ofono_error("Missing support for TUN/TAP devices");
return -ENODEV;
if (vendor != OFONO_VENDOR_XMM) {
if (stat(TUN_DEV, &st) < 0) {
ofono_error("Missing support for TUN/TAP devices");
return -ENODEV;
}
}
if (vendor != OFONO_VENDOR_XMM) {
@@ -652,7 +709,7 @@ static void ifx_gprs_context_remove(struct ofono_gprs_context *gc)
g_free(gcd);
}
static struct ofono_gprs_context_driver driver = {
static const struct ofono_gprs_context_driver driver = {
.name = "ifxmodem",
.probe = ifx_gprs_context_probe,
.remove = ifx_gprs_context_remove,

View File

@@ -23,7 +23,6 @@
#include <config.h>
#endif
#define _GNU_SOURCE
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
@@ -201,7 +200,7 @@ static void ifx_radio_settings_remove(struct ofono_radio_settings *rs)
g_free(rsd);
}
static struct ofono_radio_settings_driver driver = {
static const struct ofono_radio_settings_driver driver = {
.name = "ifxmodem",
.probe = ifx_radio_settings_probe,
.remove = ifx_radio_settings_remove,

View File

@@ -23,7 +23,6 @@
#include <config.h>
#endif
#define _GNU_SOURCE
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
@@ -307,7 +306,7 @@ static void ifx_stk_remove(struct ofono_stk *stk)
g_free(sd);
}
static struct ofono_stk_driver driver = {
static const struct ofono_stk_driver driver = {
.name = "ifxmodem",
.probe = ifx_stk_probe,
.remove = ifx_stk_remove,

View File

@@ -23,7 +23,6 @@
#include <config.h>
#endif
#define _GNU_SOURCE
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
@@ -1019,7 +1018,7 @@ static void ifx_voicecall_remove(struct ofono_voicecall *vc)
g_free(vd);
}
static struct ofono_voicecall_driver driver = {
static const struct ofono_voicecall_driver driver = {
.name = "ifxmodem",
.probe = ifx_voicecall_probe,
.remove = ifx_voicecall_remove,

View File

@@ -23,7 +23,6 @@
#include <config.h>
#endif
#define _GNU_SOURCE
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
@@ -117,7 +116,7 @@ static void isi_audio_settings_remove(struct ofono_audio_settings *as)
g_free(asd);
}
static struct ofono_audio_settings_driver driver = {
static const struct ofono_audio_settings_driver driver = {
.name = "isimodem",
.probe = isi_audio_settings_probe,
.remove = isi_audio_settings_remove,

View File

@@ -23,7 +23,6 @@
#include <config.h>
#endif
#define _GNU_SOURCE
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -429,7 +428,7 @@ static void isi_call_barring_remove(struct ofono_call_barring *barr)
g_free(data);
}
static struct ofono_call_barring_driver driver = {
static const struct ofono_call_barring_driver driver = {
.name = "isimodem",
.probe = isi_call_barring_probe,
.remove = isi_call_barring_remove,

View File

@@ -23,7 +23,6 @@
#include <config.h>
#endif
#define _GNU_SOURCE
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -457,7 +456,7 @@ static void isi_call_forwarding_remove(struct ofono_call_forwarding *cf)
g_free(data);
}
static struct ofono_call_forwarding_driver driver = {
static const struct ofono_call_forwarding_driver driver = {
.name = "isimodem",
.probe = isi_call_forwarding_probe,
.remove = isi_call_forwarding_remove,

View File

@@ -23,7 +23,6 @@
#include <config.h>
#endif
#define _GNU_SOURCE
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -118,7 +117,7 @@ static void isi_call_meter_remove(struct ofono_call_meter *cm)
g_free(data);
}
static struct ofono_call_meter_driver driver = {
static const struct ofono_call_meter_driver driver = {
.name = "isimodem",
.probe = isi_call_meter_probe,
.remove = isi_call_meter_remove,

View File

@@ -23,7 +23,6 @@
#include <config.h>
#endif
#define _GNU_SOURCE
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -405,7 +404,7 @@ static void isi_call_settings_remove(struct ofono_call_settings *cs)
g_free(data);
}
static struct ofono_call_settings_driver driver = {
static const struct ofono_call_settings_driver driver = {
.name = "isimodem",
.probe = isi_call_settings_probe,
.remove = isi_call_settings_remove,

View File

@@ -23,7 +23,6 @@
#include <config.h>
#endif
#define _GNU_SOURCE
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -229,7 +228,7 @@ static void isi_cbs_remove(struct ofono_cbs *cbs)
g_free(cd);
}
static struct ofono_cbs_driver driver = {
static const struct ofono_cbs_driver driver = {
.name = "isimodem",
.probe = isi_cbs_probe,
.remove = isi_cbs_remove,

View File

@@ -23,7 +23,6 @@
#include <config.h>
#endif
#define _GNU_SOURCE
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>

View File

@@ -23,7 +23,6 @@
#include <config.h>
#endif
#define _GNU_SOURCE
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -252,7 +251,7 @@ static void isi_devinfo_remove(struct ofono_devinfo *info)
g_free(data);
}
static struct ofono_devinfo_driver driver = {
static const struct ofono_devinfo_driver driver = {
.name = "isimodem",
.probe = isi_devinfo_probe,
.remove = isi_devinfo_remove,

View File

@@ -23,7 +23,6 @@
#include <config.h>
#endif
#define _GNU_SOURCE
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
@@ -659,7 +658,7 @@ static void isi_gprs_context_remove(struct ofono_gprs_context *gc)
g_free(cd);
}
static struct ofono_gprs_context_driver driver = {
static const struct ofono_gprs_context_driver driver = {
.name = "isimodem",
.probe = isi_gprs_context_probe,
.remove = isi_gprs_context_remove,

View File

@@ -23,7 +23,6 @@
#include <config.h>
#endif
#define _GNU_SOURCE
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -490,7 +489,7 @@ error:
g_free(cbd);
}
static struct ofono_gprs_driver driver = {
static const struct ofono_gprs_driver driver = {
.name = "isimodem",
.probe = isi_gprs_probe,
.remove = isi_gprs_remove,

View File

@@ -23,7 +23,6 @@
#include <config.h>
#endif
#define _GNU_SOURCE
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -1165,7 +1164,7 @@ static void isi_netreg_remove(struct ofono_netreg *netreg)
g_free(data);
}
static struct ofono_netreg_driver isimodem = {
static const struct ofono_netreg_driver isimodem = {
.name = "isimodem",
.probe = isi_netreg_probe,
.remove = isi_netreg_remove,

View File

@@ -340,7 +340,7 @@ static void isi_phonebook_remove(struct ofono_phonebook *pb)
g_free(data);
}
static struct ofono_phonebook_driver driver = {
static const struct ofono_phonebook_driver driver = {
.name = "isimodem",
.probe = isi_phonebook_probe,
.remove = isi_phonebook_remove,

View File

@@ -23,7 +23,6 @@
#include <config.h>
#endif
#define _GNU_SOURCE
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -365,7 +364,7 @@ static void isi_radio_settings_remove(struct ofono_radio_settings *rs)
g_free(rd);
}
static struct ofono_radio_settings_driver driver = {
static const struct ofono_radio_settings_driver driver = {
.name = "isimodem",
.probe = isi_radio_settings_probe,
.remove = isi_radio_settings_remove,

View File

@@ -23,7 +23,6 @@
#include <config.h>
#endif
#define _GNU_SOURCE
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -969,7 +968,7 @@ static void isi_sim_remove(struct ofono_sim *sim)
g_free(data);
}
static struct ofono_sim_driver driver = {
static const struct ofono_sim_driver driver = {
.name = "isimodem",
.probe = isi_sim_probe,
.remove = isi_sim_remove,

View File

@@ -24,7 +24,6 @@
#include <config.h>
#endif
#define _GNU_SOURCE
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -1121,7 +1120,7 @@ static void isi_sms_remove(struct ofono_sms *sms)
g_free(sd);
}
static struct ofono_sms_driver driver = {
static const struct ofono_sms_driver driver = {
.name = "isimodem",
.probe = isi_sms_probe,
.remove = isi_sms_remove,

View File

@@ -24,7 +24,6 @@
#include <config.h>
#endif
#define _GNU_SOURCE
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

View File

@@ -24,7 +24,6 @@
#include <config.h>
#endif
#define _GNU_SOURCE
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -1651,7 +1650,7 @@ static void uicc_sim_remove(struct ofono_sim *sim)
g_free(data);
}
static struct ofono_sim_driver driver = {
static const struct ofono_sim_driver driver = {
.name = "wgmodem2.5",
.probe = uicc_sim_probe,
.remove = uicc_sim_remove,

View File

@@ -23,7 +23,6 @@
#include <config.h>
#endif
#define _GNU_SOURCE
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -276,7 +275,7 @@ static void isi_ussd_remove(struct ofono_ussd *ussd)
g_free(data);
}
static struct ofono_ussd_driver driver = {
static const struct ofono_ussd_driver driver = {
.name = "isimodem",
.probe = isi_ussd_probe,
.remove = isi_ussd_remove,

View File

@@ -23,7 +23,6 @@
#include <config.h>
#endif
#define _GNU_SOURCE
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -1935,7 +1934,7 @@ static void isi_remove(struct ofono_voicecall *call)
g_free(data);
}
static struct ofono_voicecall_driver driver = {
static const struct ofono_voicecall_driver driver = {
.name = "isimodem",
.probe = isi_probe,
.remove = isi_remove,

View File

@@ -88,7 +88,7 @@ static void mbim_devinfo_remove(struct ofono_devinfo *info)
l_free(dd);
}
static struct ofono_devinfo_driver driver = {
static const struct ofono_devinfo_driver driver = {
.name = "mbim",
.probe = mbim_devinfo_probe,
.remove = mbim_devinfo_remove,

View File

@@ -23,7 +23,6 @@
#include <config.h>
#endif
#define _GNU_SOURCE
#include <stdint.h>
#include <stdbool.h>
#include <errno.h>
@@ -444,7 +443,7 @@ static void mbim_gprs_context_remove(struct ofono_gprs_context *gc)
l_free(gcd);
}
static struct ofono_gprs_context_driver driver = {
static const struct ofono_gprs_context_driver driver = {
.name = "mbim",
.probe = mbim_gprs_context_probe,
.remove = mbim_gprs_context_remove,

View File

@@ -23,7 +23,6 @@
#include <config.h>
#endif
#define _GNU_SOURCE
#include <stdint.h>
#include <stdbool.h>
#include <inttypes.h>
@@ -280,7 +279,7 @@ static void mbim_gprs_remove(struct ofono_gprs *gprs)
l_free(gd);
}
static struct ofono_gprs_driver driver = {
static const struct ofono_gprs_driver driver = {
.name = "mbim",
.probe = mbim_gprs_probe,
.remove = mbim_gprs_remove,

View File

@@ -197,7 +197,7 @@ static bool _iter_copy_string(struct mbim_message_iter *iter,
if (L_CPU_TO_LE16(0x8000) != 0x8000) {
uint16_t *le = (uint16_t *) buf;
for (i = 0; i < len; i+= 2)
for (i = 0; i < len / 2; i++)
le[i] = __builtin_bswap16(le[i]);
}
@@ -1131,7 +1131,7 @@ bool mbim_message_builder_append_basic(struct mbim_message_builder *builder,
if (L_CPU_TO_LE16(0x8000) != 0x8000) {
size_t i;
for (i = 0; i < len - 2; i += 2)
for (i = 0; i < len / 2; i++)
utf16[i] = __builtin_bswap16(utf16[i]);
}

View File

@@ -487,7 +487,7 @@ static bool command_write_handler(struct l_io *io, void *user_data)
written = TEMP_FAILURE_RETRY(write(fd, buf, pos));
l_info("n_iov: %lu, %lu", n_iov + 1, (size_t) written);
l_info("n_iov: %zu, %zu", n_iov + 1, (size_t) written);
if (written < 0)
return false;
@@ -646,8 +646,8 @@ static bool command_read_handler(struct l_io *io, void *user_data)
l_info("hdr->len: %u", L_LE32_TO_CPU(hdr->len));
l_info("header_size: %u", header_size);
l_info("header_offset: %lu", device->header_offset);
l_info("segment_bytes_remaining: %lu", device->segment_bytes_remaining);
l_info("header_offset: %zu", device->header_offset);
l_info("segment_bytes_remaining: %zu", device->segment_bytes_remaining);
iov[n_iov].iov_base = device->segment + L_LE32_TO_CPU(hdr->len) -
device->header_offset -

View File

@@ -23,7 +23,6 @@
#include <config.h>
#endif
#define _GNU_SOURCE
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
@@ -395,7 +394,7 @@ static void mbim_netreg_remove(struct ofono_netreg *netreg)
l_free(nd);
}
static struct ofono_netreg_driver driver = {
static const struct ofono_netreg_driver driver = {
.name = "mbim",
.probe = mbim_netreg_probe,
.remove = mbim_netreg_remove,

View File

@@ -509,7 +509,7 @@ static void mbim_sim_remove(struct ofono_sim *sim)
l_free(sd);
}
static struct ofono_sim_driver driver = {
static const struct ofono_sim_driver driver = {
.name = "mbim",
.probe = mbim_sim_probe,
.remove = mbim_sim_remove,

View File

@@ -23,7 +23,6 @@
#include <config.h>
#endif
#define _GNU_SOURCE
#include <string.h>
#include <errno.h>
#include <stdint.h>
@@ -496,7 +495,7 @@ static void mbim_sms_remove(struct ofono_sms *sms)
l_free(sd);
}
static struct ofono_sms_driver driver = {
static const struct ofono_sms_driver driver = {
.name = "mbim",
.probe = mbim_sms_probe,
.remove = mbim_sms_remove,

View File

@@ -23,7 +23,6 @@
#include <config.h>
#endif
#define _GNU_SOURCE
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
@@ -511,7 +510,7 @@ static void mbm_gprs_context_remove(struct ofono_gprs_context *gc)
g_free(gcd);
}
static struct ofono_gprs_context_driver driver = {
static const struct ofono_gprs_context_driver driver = {
.name = "mbmmodem",
.probe = mbm_gprs_context_probe,
.remove = mbm_gprs_context_remove,

View File

@@ -24,7 +24,6 @@
#include <config.h>
#endif
#define _GNU_SOURCE
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
@@ -231,7 +230,7 @@ static void mbm_location_reporting_remove(struct ofono_location_reporting *lr)
g_free(gd);
}
static struct ofono_location_reporting_driver driver = {
static const struct ofono_location_reporting_driver driver = {
.name = "mbmmodem",
.type = OFONO_LOCATION_REPORTING_TYPE_NMEA,
.probe = mbm_location_reporting_probe,

View File

@@ -23,7 +23,6 @@
#include <config.h>
#endif
#define _GNU_SOURCE
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
@@ -262,7 +261,7 @@ static void mbm_stk_remove(struct ofono_stk *stk)
g_free(sd);
}
static struct ofono_stk_driver driver = {
static const struct ofono_stk_driver driver = {
.name = "mbmmodem",
.probe = mbm_stk_probe,
.remove = mbm_stk_remove,

View File

@@ -23,7 +23,6 @@
#include <config.h>
#endif
#define _GNU_SOURCE
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
@@ -195,7 +194,7 @@ static void nw_radio_settings_remove(struct ofono_radio_settings *rs)
g_free(rsd);
}
static struct ofono_radio_settings_driver driver = {
static const struct ofono_radio_settings_driver driver = {
.name = "nwmodem",
.probe = nw_radio_settings_probe,
.remove = nw_radio_settings_remove,

Some files were not shown because too many files have changed in this diff Show More