[MERGED] osmo-gsm-tester[master]: modem: Identify modems by sysfs path instead of ofono dbus path
Pau Espin Pedrol has submitted this change and it was merged. Change subject: modem: Identify modems by sysfs path instead of ofono dbus path .. modem: Identify modems by sysfs path instead of ofono dbus path ofono dbus paths are non-deterministic and can change over time for a given modem. For instance when ofono is restartd or if a modem crashes and the object is destroyed and re-announced by udev. Requires at least ofono 1df92289d4e09a1e2db0b189b5153a4c238f98f1, which implemented the feature to export the sysfs path to modem properties. Related: OS#2509 Change-Id: Ibc45a196abadded2706dc9d57b6a3a796b43a201 --- M example/resources.conf M src/osmo_gsm_tester/modem.py 2 files changed, 19 insertions(+), 9 deletions(-) Approvals: Pau Espin Pedrol: Looks good to me, approved Jenkins Builder: Verified diff --git a/example/resources.conf b/example/resources.conf index ce370a6..fb2ac9f 100644 --- a/example/resources.conf +++ b/example/resources.conf @@ -67,16 +67,16 @@ band: GSM-1900 modem: -- label: sierra_1 - path: '/sierra_1' +- label: sierra_1st + path: '/sys/devices/pci:00/:00:12.2/usb1/1-1/1-1.2' imsi: '90170009031' ki: '80A37E6FDEA931EAC92FFA5F671EFEAD' auth_algo: 'comp128v1' ciphers: [a5_0, a5_1] features: ['sms', 'voice', 'ussd', 'gprs'] -- label: sierra_2 - path: '/sierra_2' +- label: sierra_2nd + path: '/sys/devices/pci:00/:00:12.2/usb1/1-1/1-1.3' imsi: '90170009029' ki: '00969E283349D354A8239E877F2E0866' auth_algo: 'comp128v1' @@ -84,7 +84,7 @@ features: ['sms', 'voice', 'ussd', 'gprs'] - label: ec20 - path: '/gobi_0' + path: '/sys/devices/pci:00/:00:12.2/usb1/1-1/1-1.6' imsi: '90170009030' ki: 'BB70807226393CDBAC8DD3439FF54252' auth_algo: 'comp128v1' @@ -92,7 +92,7 @@ features: ['sms', 'ussd', 'gprs'] - label: gobi2k - path: '/gobi_3' + path: '/sys/devices/pci:00/:00:12.2/usb1/1-1/1-1.5' imsi: '90170009032' ki: '2F70DCA43C45ACB97E947FDD0C7CA30A' auth_algo: 'comp128v1' diff --git a/src/osmo_gsm_tester/modem.py b/src/osmo_gsm_tester/modem.py index 5afd2d1..96b65d8 100644 --- a/src/osmo_gsm_tester/modem.py +++ b/src/osmo_gsm_tester/modem.py @@ -92,6 +92,14 @@ root = systembus_get('/') return sorted(root.GetModems()) +def get_dbuspath_from_syspath(syspath): +modems = list_modems() +for dbuspath, props in modems: +if props.get('SystemPath', '') == syspath: +return dbuspath +raise ValueError('could not find %s in modem list: %s' % (syspath, modems)) + + def _async_result_handler(obj, result, user_data): '''Generic callback dispatcher called from glib loop when an async method call has returned. This callback is set up by method dbus_async_call.''' @@ -341,10 +349,12 @@ def __init__(self, conf): self.conf = conf -self.path = conf.get('path') -super().__init__(log.C_TST, self.path) +self.syspath = conf.get('path') +self.dbuspath = get_dbuspath_from_syspath(self.syspath) +super().__init__(log.C_TST, self.dbuspath) +self.dbg('creating from syspath %s', self.syspath) self.sms_received_list = [] -self.dbus = ModemDbusInteraction(self.path) +self.dbus = ModemDbusInteraction(self.dbuspath) self.register_attempts = 0 self.call_list = [] # one Cancellable can handle several concurrent methods. -- To view, visit https://gerrit.osmocom.org/6858 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: Ibc45a196abadded2706dc9d57b6a3a796b43a201 Gerrit-PatchSet: 4 Gerrit-Project: osmo-gsm-tester Gerrit-Branch: master Gerrit-Owner: Pau Espin Pedrol Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Pau Espin Pedrol
osmo-gsm-tester[master]: modem: Identify modems by sysfs path instead of ofono dbus path
Patch Set 4: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/6858 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ibc45a196abadded2706dc9d57b6a3a796b43a201 Gerrit-PatchSet: 4 Gerrit-Project: osmo-gsm-tester Gerrit-Branch: master Gerrit-Owner: Pau Espin Pedrol Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Pau Espin Pedrol Gerrit-HasComments: No
[PATCH] osmo-gsm-tester[master]: modem: Identify modems by sysfs path instead of ofono dbus path
Hello Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/6858 to look at the new patch set (#4). modem: Identify modems by sysfs path instead of ofono dbus path ofono dbus paths are non-deterministic and can change over time for a given modem. For instance when ofono is restartd or if a modem crashes and the object is destroyed and re-announced by udev. Requires at least ofono 1df92289d4e09a1e2db0b189b5153a4c238f98f1, which implemented the feature to export the sysfs path to modem properties. Related: OS#2509 Change-Id: Ibc45a196abadded2706dc9d57b6a3a796b43a201 --- M example/resources.conf M src/osmo_gsm_tester/modem.py 2 files changed, 19 insertions(+), 9 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-gsm-tester refs/changes/58/6858/4 diff --git a/example/resources.conf b/example/resources.conf index ce370a6..fb2ac9f 100644 --- a/example/resources.conf +++ b/example/resources.conf @@ -67,16 +67,16 @@ band: GSM-1900 modem: -- label: sierra_1 - path: '/sierra_1' +- label: sierra_1st + path: '/sys/devices/pci:00/:00:12.2/usb1/1-1/1-1.2' imsi: '90170009031' ki: '80A37E6FDEA931EAC92FFA5F671EFEAD' auth_algo: 'comp128v1' ciphers: [a5_0, a5_1] features: ['sms', 'voice', 'ussd', 'gprs'] -- label: sierra_2 - path: '/sierra_2' +- label: sierra_2nd + path: '/sys/devices/pci:00/:00:12.2/usb1/1-1/1-1.3' imsi: '90170009029' ki: '00969E283349D354A8239E877F2E0866' auth_algo: 'comp128v1' @@ -84,7 +84,7 @@ features: ['sms', 'voice', 'ussd', 'gprs'] - label: ec20 - path: '/gobi_0' + path: '/sys/devices/pci:00/:00:12.2/usb1/1-1/1-1.6' imsi: '90170009030' ki: 'BB70807226393CDBAC8DD3439FF54252' auth_algo: 'comp128v1' @@ -92,7 +92,7 @@ features: ['sms', 'ussd', 'gprs'] - label: gobi2k - path: '/gobi_3' + path: '/sys/devices/pci:00/:00:12.2/usb1/1-1/1-1.5' imsi: '90170009032' ki: '2F70DCA43C45ACB97E947FDD0C7CA30A' auth_algo: 'comp128v1' diff --git a/src/osmo_gsm_tester/modem.py b/src/osmo_gsm_tester/modem.py index 5afd2d1..96b65d8 100644 --- a/src/osmo_gsm_tester/modem.py +++ b/src/osmo_gsm_tester/modem.py @@ -92,6 +92,14 @@ root = systembus_get('/') return sorted(root.GetModems()) +def get_dbuspath_from_syspath(syspath): +modems = list_modems() +for dbuspath, props in modems: +if props.get('SystemPath', '') == syspath: +return dbuspath +raise ValueError('could not find %s in modem list: %s' % (syspath, modems)) + + def _async_result_handler(obj, result, user_data): '''Generic callback dispatcher called from glib loop when an async method call has returned. This callback is set up by method dbus_async_call.''' @@ -341,10 +349,12 @@ def __init__(self, conf): self.conf = conf -self.path = conf.get('path') -super().__init__(log.C_TST, self.path) +self.syspath = conf.get('path') +self.dbuspath = get_dbuspath_from_syspath(self.syspath) +super().__init__(log.C_TST, self.dbuspath) +self.dbg('creating from syspath %s', self.syspath) self.sms_received_list = [] -self.dbus = ModemDbusInteraction(self.path) +self.dbus = ModemDbusInteraction(self.dbuspath) self.register_attempts = 0 self.call_list = [] # one Cancellable can handle several concurrent methods. -- To view, visit https://gerrit.osmocom.org/6858 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: Ibc45a196abadded2706dc9d57b6a3a796b43a201 Gerrit-PatchSet: 4 Gerrit-Project: osmo-gsm-tester Gerrit-Branch: master Gerrit-Owner: Pau Espin Pedrol Gerrit-Reviewer: Jenkins Builder
[PATCH] osmo-gsm-tester[master]: modem: Identify modems by sysfs path instead of ofono dbus path
Hello Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/6858 to look at the new patch set (#3). modem: Identify modems by sysfs path instead of ofono dbus path ofono dbus paths are non-deterministic and can change over time for a given modem. For instance when ofono is restartd or if a modem crashes and the object is destroyed and re-announced by udev. Requires at least ofono 1df92289d4e09a1e2db0b189b5153a4c238f98f1, which implemented the feature to export the sysfs path to modem properties. Related: OS#2509 Change-Id: Ibc45a196abadded2706dc9d57b6a3a796b43a201 --- M example/resources.conf M src/osmo_gsm_tester/modem.py 2 files changed, 20 insertions(+), 9 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-gsm-tester refs/changes/58/6858/3 diff --git a/example/resources.conf b/example/resources.conf index ce370a6..fb2ac9f 100644 --- a/example/resources.conf +++ b/example/resources.conf @@ -67,16 +67,16 @@ band: GSM-1900 modem: -- label: sierra_1 - path: '/sierra_1' +- label: sierra_1st + path: '/sys/devices/pci:00/:00:12.2/usb1/1-1/1-1.2' imsi: '90170009031' ki: '80A37E6FDEA931EAC92FFA5F671EFEAD' auth_algo: 'comp128v1' ciphers: [a5_0, a5_1] features: ['sms', 'voice', 'ussd', 'gprs'] -- label: sierra_2 - path: '/sierra_2' +- label: sierra_2nd + path: '/sys/devices/pci:00/:00:12.2/usb1/1-1/1-1.3' imsi: '90170009029' ki: '00969E283349D354A8239E877F2E0866' auth_algo: 'comp128v1' @@ -84,7 +84,7 @@ features: ['sms', 'voice', 'ussd', 'gprs'] - label: ec20 - path: '/gobi_0' + path: '/sys/devices/pci:00/:00:12.2/usb1/1-1/1-1.6' imsi: '90170009030' ki: 'BB70807226393CDBAC8DD3439FF54252' auth_algo: 'comp128v1' @@ -92,7 +92,7 @@ features: ['sms', 'ussd', 'gprs'] - label: gobi2k - path: '/gobi_3' + path: '/sys/devices/pci:00/:00:12.2/usb1/1-1/1-1.5' imsi: '90170009032' ki: '2F70DCA43C45ACB97E947FDD0C7CA30A' auth_algo: 'comp128v1' diff --git a/src/osmo_gsm_tester/modem.py b/src/osmo_gsm_tester/modem.py index 5afd2d1..7c6a57d 100644 --- a/src/osmo_gsm_tester/modem.py +++ b/src/osmo_gsm_tester/modem.py @@ -92,6 +92,15 @@ root = systembus_get('/') return sorted(root.GetModems()) +def get_modem_by_syspath(syspath): +root = systembus_get('/') +modems = root.GetModems() +for modem in modems: +if modem.get('SystemPath', '') == syspath: +return modem +raise ValueError('could not find %s in modem list: %s' % (syspath, modems)) + + def _async_result_handler(obj, result, user_data): '''Generic callback dispatcher called from glib loop when an async method call has returned. This callback is set up by method dbus_async_call.''' @@ -341,10 +350,12 @@ def __init__(self, conf): self.conf = conf -self.path = conf.get('path') -super().__init__(log.C_TST, self.path) +self.syspath = conf.get('path') +self.dbuspath = get_modem_by_syspath(self.syspath) +super().__init__(log.C_TST, self.dbuspath) +self.dbg('creating from syspath %s', self.syspath) self.sms_received_list = [] -self.dbus = ModemDbusInteraction(self.path) +self.dbus = ModemDbusInteraction(self.dbuspath) self.register_attempts = 0 self.call_list = [] # one Cancellable can handle several concurrent methods. -- To view, visit https://gerrit.osmocom.org/6858 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: Ibc45a196abadded2706dc9d57b6a3a796b43a201 Gerrit-PatchSet: 3 Gerrit-Project: osmo-gsm-tester Gerrit-Branch: master Gerrit-Owner: Pau Espin Pedrol Gerrit-Reviewer: Jenkins Builder
[PATCH] osmo-gsm-tester[master]: modem: Identify modems by sysfs path instead of ofono dbus path
Hello Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/6858 to look at the new patch set (#2). modem: Identify modems by sysfs path instead of ofono dbus path ofono dbus paths are non-deterministic and can change over time for a given modem. For instance when ofono is restartd or if a modem crashes and the object is destroyed and re-announced by udev. Requires at least ofono 1df92289d4e09a1e2db0b189b5153a4c238f98f1, which implemented the feature to export the sysfs path to modem properties. Related: OS#2509 Change-Id: Ibc45a196abadded2706dc9d57b6a3a796b43a201 --- M example/resources.conf M src/osmo_gsm_tester/modem.py 2 files changed, 19 insertions(+), 9 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-gsm-tester refs/changes/58/6858/2 diff --git a/example/resources.conf b/example/resources.conf index ce370a6..fb2ac9f 100644 --- a/example/resources.conf +++ b/example/resources.conf @@ -67,16 +67,16 @@ band: GSM-1900 modem: -- label: sierra_1 - path: '/sierra_1' +- label: sierra_1st + path: '/sys/devices/pci:00/:00:12.2/usb1/1-1/1-1.2' imsi: '90170009031' ki: '80A37E6FDEA931EAC92FFA5F671EFEAD' auth_algo: 'comp128v1' ciphers: [a5_0, a5_1] features: ['sms', 'voice', 'ussd', 'gprs'] -- label: sierra_2 - path: '/sierra_2' +- label: sierra_2nd + path: '/sys/devices/pci:00/:00:12.2/usb1/1-1/1-1.3' imsi: '90170009029' ki: '00969E283349D354A8239E877F2E0866' auth_algo: 'comp128v1' @@ -84,7 +84,7 @@ features: ['sms', 'voice', 'ussd', 'gprs'] - label: ec20 - path: '/gobi_0' + path: '/sys/devices/pci:00/:00:12.2/usb1/1-1/1-1.6' imsi: '90170009030' ki: 'BB70807226393CDBAC8DD3439FF54252' auth_algo: 'comp128v1' @@ -92,7 +92,7 @@ features: ['sms', 'ussd', 'gprs'] - label: gobi2k - path: '/gobi_3' + path: '/sys/devices/pci:00/:00:12.2/usb1/1-1/1-1.5' imsi: '90170009032' ki: '2F70DCA43C45ACB97E947FDD0C7CA30A' auth_algo: 'comp128v1' diff --git a/src/osmo_gsm_tester/modem.py b/src/osmo_gsm_tester/modem.py index 5afd2d1..301fc29 100644 --- a/src/osmo_gsm_tester/modem.py +++ b/src/osmo_gsm_tester/modem.py @@ -92,6 +92,14 @@ root = systembus_get('/') return sorted(root.GetModems()) +def get_modem_by_syspath(syspath): +modems = list_modems() +for modem in modems: +if modem.get('SystemPath', '') == syspath: +return modem +raise ValueError('could not find %s in modem list: %s' % (syspath, modems)) + + def _async_result_handler(obj, result, user_data): '''Generic callback dispatcher called from glib loop when an async method call has returned. This callback is set up by method dbus_async_call.''' @@ -341,10 +349,12 @@ def __init__(self, conf): self.conf = conf -self.path = conf.get('path') -super().__init__(log.C_TST, self.path) +self.syspath = conf.get('path') +self.dbuspath = get_modem_by_syspath(self.syspath) +super().__init__(log.C_TST, self.dbuspath) +self.dbg('creating from syspath %s', self.syspath) self.sms_received_list = [] -self.dbus = ModemDbusInteraction(self.path) +self.dbus = ModemDbusInteraction(self.dbuspath) self.register_attempts = 0 self.call_list = [] # one Cancellable can handle several concurrent methods. -- To view, visit https://gerrit.osmocom.org/6858 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: Ibc45a196abadded2706dc9d57b6a3a796b43a201 Gerrit-PatchSet: 2 Gerrit-Project: osmo-gsm-tester Gerrit-Branch: master Gerrit-Owner: Pau Espin Pedrol Gerrit-Reviewer: Jenkins Builder
[PATCH] osmo-gsm-tester[master]: modem: Identify modems by sysfs path instead of ofono dbus path
Review at https://gerrit.osmocom.org/6858 modem: Identify modems by sysfs path instead of ofono dbus path ofono dbus paths are non-deterministic and can change over time for a given modem. For instance when ofono is restartd or if a modem crashes and the object is destroyed and re-announced by udev. Requires at least ofono 1df92289d4e09a1e2db0b189b5153a4c238f98f1, which implemented the feature to export the sysfs path to modem properties. Related: OS#2509 Change-Id: Ibc45a196abadded2706dc9d57b6a3a796b43a201 --- M example/resources.conf M src/osmo_gsm_tester/modem.py 2 files changed, 19 insertions(+), 9 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-gsm-tester refs/changes/58/6858/1 diff --git a/example/resources.conf b/example/resources.conf index ce370a6..fb2ac9f 100644 --- a/example/resources.conf +++ b/example/resources.conf @@ -67,16 +67,16 @@ band: GSM-1900 modem: -- label: sierra_1 - path: '/sierra_1' +- label: sierra_1st + path: '/sys/devices/pci:00/:00:12.2/usb1/1-1/1-1.2' imsi: '90170009031' ki: '80A37E6FDEA931EAC92FFA5F671EFEAD' auth_algo: 'comp128v1' ciphers: [a5_0, a5_1] features: ['sms', 'voice', 'ussd', 'gprs'] -- label: sierra_2 - path: '/sierra_2' +- label: sierra_2nd + path: '/sys/devices/pci:00/:00:12.2/usb1/1-1/1-1.3' imsi: '90170009029' ki: '00969E283349D354A8239E877F2E0866' auth_algo: 'comp128v1' @@ -84,7 +84,7 @@ features: ['sms', 'voice', 'ussd', 'gprs'] - label: ec20 - path: '/gobi_0' + path: '/sys/devices/pci:00/:00:12.2/usb1/1-1/1-1.6' imsi: '90170009030' ki: 'BB70807226393CDBAC8DD3439FF54252' auth_algo: 'comp128v1' @@ -92,7 +92,7 @@ features: ['sms', 'ussd', 'gprs'] - label: gobi2k - path: '/gobi_3' + path: '/sys/devices/pci:00/:00:12.2/usb1/1-1/1-1.5' imsi: '90170009032' ki: '2F70DCA43C45ACB97E947FDD0C7CA30A' auth_algo: 'comp128v1' diff --git a/src/osmo_gsm_tester/modem.py b/src/osmo_gsm_tester/modem.py index 5afd2d1..d37a358 100644 --- a/src/osmo_gsm_tester/modem.py +++ b/src/osmo_gsm_tester/modem.py @@ -92,6 +92,14 @@ root = systembus_get('/') return sorted(root.GetModems()) +def get_modem_by_syspath(syspath): +modems = list_modems() +for modem in modems: +if modem.get('SystemPath', '') == syspath: +return modem +raise ValueError('could not find %s in modem list: %s' % (syspath, modems)) + + def _async_result_handler(obj, result, user_data): '''Generic callback dispatcher called from glib loop when an async method call has returned. This callback is set up by method dbus_async_call.''' @@ -341,10 +349,12 @@ def __init__(self, conf): self.conf = conf -self.path = conf.get('path') -super().__init__(log.C_TST, self.path) +self.syspath = conf.get('path') +self.dbuspath = get_modem_by_syspath(syspath) +super().__init__(log.C_TST, self.dbuspath) +self.dbg('creating from syspath %s', self.syspath) self.sms_received_list = [] -self.dbus = ModemDbusInteraction(self.path) +self.dbus = ModemDbusInteraction(self.dbuspath) self.register_attempts = 0 self.call_list = [] # one Cancellable can handle several concurrent methods. -- To view, visit https://gerrit.osmocom.org/6858 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ibc45a196abadded2706dc9d57b6a3a796b43a201 Gerrit-PatchSet: 1 Gerrit-Project: osmo-gsm-tester Gerrit-Branch: master Gerrit-Owner: Pau Espin Pedrol