2014-03-11 16:39:22 +00:00
|
|
|
#!/usr/bin/python3
|
2013-09-10 16:01:18 +00:00
|
|
|
|
|
|
|
import sys
|
|
|
|
import dbus
|
|
|
|
|
|
|
|
if (len(sys.argv) < 2):
|
2014-03-11 16:39:18 +00:00
|
|
|
print("Usage: %s [modem] icon_id" % (sys.argv[0]))
|
2013-09-10 16:01:18 +00:00
|
|
|
sys.exit(1)
|
|
|
|
|
|
|
|
bus = dbus.SystemBus()
|
|
|
|
|
|
|
|
manager = dbus.Interface(bus.get_object('org.ofono', '/'),
|
|
|
|
'org.ofono.Manager')
|
|
|
|
|
|
|
|
modems = manager.GetModems()
|
|
|
|
modem = modems[0][0]
|
|
|
|
|
|
|
|
if (len(sys.argv) == 2):
|
|
|
|
icon = sys.argv[1]
|
|
|
|
elif (len(sys.argv) == 3):
|
|
|
|
modem = sys.argv[1]
|
|
|
|
icon = sys.argv[2]
|
|
|
|
|
2014-03-11 16:39:18 +00:00
|
|
|
print("Using modem %s" % modem)
|
2013-09-10 16:01:18 +00:00
|
|
|
|
|
|
|
sim = dbus.Interface(bus.get_object('org.ofono', modem),
|
|
|
|
'org.ofono.SimManager')
|
|
|
|
icon = sim.GetIcon(dbus.Byte(int(icon)))
|
|
|
|
xpm = ""
|
|
|
|
for byte in icon:
|
|
|
|
xpm += str(byte)
|
|
|
|
f = open("/tmp/icon.xpm", 'w')
|
|
|
|
f.write(xpm)
|
|
|
|
f.close()
|