/usr/share/ofono/scripts/set-sms-bearer is in ofono-scripts 1.21-1ubuntu1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | #!/usr/bin/python3
import sys
import dbus
if len(sys.argv) < 2:
print("Usage: %s <bearer> Bearer types: <cs-only> <ps-only> <cs-preferred> <ps-preferred>" %\
(sys.argv[0]))
sys.exit(1)
def message_bearer(sms, value):
try:
sms.SetProperty("Bearer", dbus.String(value))
except dbus.DBusException as e:
print("Unable to set Bearer[%s] - FAIL" % (value))
exit(1)
bus = dbus.SystemBus()
manager = dbus.Interface(bus.get_object('org.ofono', '/'),'org.ofono.Manager')
modems = manager.GetModems()
value = sys.argv[1]
for path, properties in modems:
print("Setting bearer for [ %s ]" % (path))
if "org.ofono.MessageManager" not in properties["Interfaces"]:
continue
sms = dbus.Interface(bus.get_object('org.ofono', path), 'org.ofono.MessageManager')
message_bearer(sms, value)
print("SMS Bearer updated for [ %s ]" % (path))
|