shill: device: Add a special pseudo device to allow for VM testing of cellular
Recognize devices pseduomodem* as cellular devices so that we can use
a python modem manager to test the modem code using autotest in a VM.
BUG=none
TEST=unit tests and in progress fake-modem.py
Change-Id: I6c2895ce32df6d11fff891115559a9a3175320e0
Reviewed-on: https://gerrit.chromium.org/gerrit/20766
Commit-Ready: Jason Glasgow <jglasgow@chromium.org>
Reviewed-by: Jason Glasgow <jglasgow@chromium.org>
Tested-by: Jason Glasgow <jglasgow@chromium.org>
diff --git a/modem_1.cc b/modem_1.cc
index 15091d5..889c906 100644
--- a/modem_1.cc
+++ b/modem_1.cc
@@ -9,6 +9,7 @@
#include <mm/ModemManager-names.h>
#include "shill/cellular.h"
+#include "shill/device_info.h"
using std::string;
@@ -39,9 +40,15 @@
if (!DBusProperties::GetString(modem_props,
MM_MODEM_PROPERTY_DEVICE,
&device_prop)) {
+ LOG(ERROR) << "Device missing property: " << MM_MODEM_PROPERTY_DEVICE;
return false;
}
+ if (device_prop.find(DeviceInfo::kModemPseudoDeviceNamePrefix) == 0) {
+ *name = device_prop;
+ return true;
+ }
+
// |device_prop| will be a sysfs path such as:
// /sys/devices/pci0000:00/0000:00:1d.7/usb1/1-2
FilePath device_path(device_prop);
@@ -68,6 +75,7 @@
return true;
}
}
+ LOG(ERROR) << "No link name found for: " << device_prop;
return false;
}