mirror of
https://github.com/sailfishos/ofono
synced 2025-12-18 16:11:04 +08:00
udev: refactor add_isi
Gather OFONO_ISI_ADDRESS from same udev device node as OFONO_DRIVER.
This commit is contained in:
@@ -423,19 +423,29 @@ static void add_nokia(struct ofono_modem *modem,
|
|||||||
static void add_isi(struct ofono_modem *modem,
|
static void add_isi(struct ofono_modem *modem,
|
||||||
struct udev_device *udev_device)
|
struct udev_device *udev_device)
|
||||||
{
|
{
|
||||||
const char *ifname, *addr;
|
const char *ifname, *type, *addr;
|
||||||
|
|
||||||
DBG("modem %p", modem);
|
DBG("modem %p", modem);
|
||||||
|
|
||||||
|
if (ofono_modem_get_string(modem, "Interface"))
|
||||||
|
return;
|
||||||
|
|
||||||
|
addr = get_property(udev_device, "OFONO_ISI_ADDRESS");
|
||||||
|
if (addr != NULL)
|
||||||
|
ofono_modem_set_integer(modem, "Address", atoi(addr));
|
||||||
|
|
||||||
|
if (g_strcmp0(udev_device_get_subsystem(udev_device), "net") != 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
type = udev_device_get_sysattr_value(udev_device, "type");
|
||||||
|
if (g_strcmp0(type, "820") != 0)
|
||||||
|
return;
|
||||||
|
|
||||||
ifname = udev_device_get_sysname(udev_device);
|
ifname = udev_device_get_sysname(udev_device);
|
||||||
ofono_modem_set_string(modem, "Interface", ifname);
|
ofono_modem_set_string(modem, "Interface", ifname);
|
||||||
|
|
||||||
DBG("interface %s", ifname);
|
DBG("interface %s", ifname);
|
||||||
|
|
||||||
addr = get_property(udev_device, "OFONO_ISI_ADDRESS");
|
|
||||||
if (addr != NULL)
|
|
||||||
ofono_modem_set_integer(modem, "Address", atoi(addr));
|
|
||||||
|
|
||||||
ofono_modem_register(modem);
|
ofono_modem_register(modem);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user