Add udev detection support for ZTE modems

This commit is contained in:
Marcel Holtmann 2010-08-16 14:49:04 +02:00
parent 3e93fbca03
commit 0a18997416
2 changed files with 72 additions and 5 deletions

View File

@ -2,11 +2,14 @@
ACTION!="add|change", GOTO="ofono_end"
SUBSYSTEM!="tty", GOTO="ofono_huawei_end"
KERNEL!="ttyUSB[0-9]*", GOTO="ofono_huawei_end"
SUBSYSTEM!="tty", GOTO="ofono_tty_end"
KERNEL!="ttyUSB[0-9]*", GOTO="ofono_tty_end"
SUBSYSTEMS=="usb", ATTRS{bInterfaceNumber}=="?*", ATTRS{bInterfaceClass}=="ff", ENV{OFONO_IFACE_NUM}="$attr{bInterfaceNumber}"
ATTRS{idVendor}=="19d2", ATTRS{idProduct}=="0063", ENV{OFONO_IFACE_NUM}=="03", ENV{OFONO_ZTE_TYPE}="modem"
ATTRS{idVendor}=="19d2", ATTRS{idProduct}=="0063", ENV{OFONO_IFACE_NUM}=="01", ENV{OFONO_ZTE_TYPE}="aux"
# Generic 0x1001
ATTRS{idVendor}=="12d1", ATTRS{idProduct}=="1001", ENV{OFONO_IFACE_NUM}=="00", ENV{OFONO_HUAWEI_TYPE}="Modem"
ATTRS{idVendor}=="12d1", ATTRS{idProduct}=="1001", ENV{OFONO_IFACE_NUM}=="02", ENV{OFONO_HUAWEI_TYPE}="Pcui"
@ -328,16 +331,20 @@ ATTRS{idVendor}=="12d1", ATTRS{idProduct}=="1485", ENV{OFONO_IFACE_NUM}=="02", E
ATTRS{idVendor}=="12d1", ATTRS{idProduct}=="1486", ENV{OFONO_IFACE_NUM}=="00", ENV{OFONO_HUAWEI_TYPE}="Modem"
ATTRS{idVendor}=="12d1", ATTRS{idProduct}=="1486", ENV{OFONO_IFACE_NUM}=="02", ENV{OFONO_HUAWEI_TYPE}="Pcui"
LABEL="ofono_huawei_end"
LABEL="ofono_tty_end"
SUBSYSTEM!="usb", GOTO="ofono_end"
ENV{DEVTYPE}!="usb_device", GOTO="ofono_end"
# Novatel Wireless
ATTRS{idVendor}=="1410", ENV{OFONO_DRIVER}="novatel"
# HUAWEI Technology
ATTRS{idVendor}=="12d1", ENV{OFONO_DRIVER}="huawei"
# Novatel Wireless
ATTRS{idVendor}=="1410", ENV{OFONO_DRIVER}="novatel"
# ZTE Incorporated
ATTRS{idVendor}=="19d2", ENV{OFONO_DRIVER}="zte"
# Option Globetrotter
ATTRS{idVendor}=="0af0", ATTRS{idProduct}=="6911", ENV{OFONO_DRIVER}="hso"

View File

@ -163,6 +163,8 @@ static void add_hso(struct ofono_modem *modem,
const char *app, *control, *network;
int registered;
DBG("modem %p", modem);
subsystem = udev_device_get_subsystem(udev_device);
if (subsystem == NULL)
return;
@ -198,6 +200,58 @@ static void add_hso(struct ofono_modem *modem,
}
}
static void add_zte(struct ofono_modem *modem,
struct udev_device *udev_device)
{
struct udev_list_entry *entry;
const char *devnode, *type;
int ppp, aux;
DBG("modem %p", modem);
ppp = ofono_modem_get_integer(modem, "ModemRegistered");
aux = ofono_modem_get_integer(modem, "AuxRegistered");
if (ppp && aux)
return;
entry = udev_device_get_properties_list_entry(udev_device);
while (entry) {
const char *name = udev_list_entry_get_name(entry);
type = udev_list_entry_get_value(entry);
if (g_str_equal(name, "OFONO_ZTE_TYPE") != TRUE) {
entry = udev_list_entry_get_next(entry);
continue;
}
if (g_str_equal(type, "modem") == TRUE) {
if (ppp != 0)
return;
devnode = udev_device_get_devnode(udev_device);
ofono_modem_set_string(modem, "Modem", devnode);
ppp = 1;
ofono_modem_set_integer(modem, "ModemRegistered", ppp);
} else if (g_str_equal(type, "aux") == TRUE) {
if (aux != 0)
return;
devnode = udev_device_get_devnode(udev_device);
ofono_modem_set_string(modem, "Aux", devnode);
aux = 1;
ofono_modem_set_integer(modem, "AuxRegistered", aux);
}
break;
}
if (ppp && aux)
ofono_modem_register(modem);
}
static void add_huawei(struct ofono_modem *modem,
struct udev_device *udev_device)
{
@ -205,6 +259,8 @@ static void add_huawei(struct ofono_modem *modem,
const char *devnode, *type;
int ppp, pcui;
DBG("modem %p", modem);
/*
* Huawei dongles tend to break up their ports into:
* - Modem - Used for PPP
@ -273,6 +329,8 @@ static void add_novatel(struct ofono_modem *modem,
struct udev_device *parent;
int registered;
DBG("modem %p", modem);
registered = ofono_modem_get_integer(modem, "Registered");
if (registered != 0)
return;
@ -345,6 +403,8 @@ static void add_modem(struct udev_device *udev_device)
add_mbm(modem, udev_device);
else if (g_strcmp0(driver, "hso") == 0)
add_hso(modem, udev_device);
else if (g_strcmp0(driver, "zte") == 0)
add_zte(modem, udev_device);
else if (g_strcmp0(driver, "huawei") == 0)
add_huawei(modem, udev_device);
else if (g_strcmp0(driver, "novatel") == 0)