udev: Use fully automatic detection for Samsung LTE devices

This commit is contained in:
Marcel Holtmann 2011-08-07 16:35:43 +02:00
parent bc63209b90
commit 996d720b88
3 changed files with 33 additions and 40 deletions

View File

@ -136,9 +136,6 @@ ATTRS{idVendor}=="0930", ATTRS{idProduct}=="130b", ENV{OFONO_DRIVER}="mbm"
ATTRS{idVendor}=="0930", ATTRS{idProduct}=="130c", ENV{OFONO_DRIVER}="mbm"
ATTRS{idVendor}=="0930", ATTRS{idProduct}=="1311", ENV{OFONO_DRIVER}="mbm"
# Samsung GT-B3740 (LTE)
ATTRS{idVendor}=="04e8", ATTRS{idProduct}=="6889", ENV{OFONO_DRIVER}="samsung"
# Nokia Internet Stick CS-10
ATTRS{idVendor}=="0421", ATTRS{idProduct}=="060e", ENV{OFONO_DRIVER}="nokia"

View File

@ -421,41 +421,6 @@ static void add_speedup(struct ofono_modem *modem,
ofono_modem_register(modem);
}
static void add_samsung(struct ofono_modem *modem,
struct udev_device *udev_device)
{
const char *subsystem;
DBG("modem %p", modem);
subsystem = udev_device_get_subsystem(udev_device);
if (subsystem == NULL)
return;
if (g_str_equal(subsystem, "net") == TRUE) {
const char *interface;
interface = get_property(udev_device, "INTERFACE");
if (interface == NULL)
return;
DBG("network %s", interface);
ofono_modem_set_string(modem, "Network", interface);
} else if (g_str_equal(subsystem, "tty") == TRUE) {
const char *devnode;
devnode = udev_device_get_devnode(udev_device);
if (devnode == NULL)
return;
DBG("device %s", devnode);
ofono_modem_set_string(modem, "Device", devnode);
ofono_modem_register(modem);
}
}
static void add_modem(struct udev_device *udev_device)
{
struct ofono_modem *modem;
@ -548,8 +513,6 @@ done:
add_speedup(modem, udev_device);
else if (g_strcmp0(driver, "speedupcdma") == 0)
add_speedup(modem, udev_device);
else if (g_strcmp0(driver, "samsung") == 0)
add_samsung(modem, udev_device);
}
static gboolean devpath_remove(gpointer key, gpointer value, gpointer user_data)

View File

@ -280,6 +280,36 @@ static gboolean setup_zte(struct modem_info *modem)
return TRUE;
}
static gboolean setup_samsung(struct modem_info *modem)
{
const char *control = NULL, *network = NULL;
GSList *list;
DBG("%s", modem->syspath);
for (list = modem->devices; list; list = list->next) {
struct device_info *info = list->data;
DBG("%s %s %s %s", info->devnode, info->interface,
info->number, info->label);
if (g_strcmp0(info->interface, "10/0/0") == 0)
control = info->devnode;
else if (g_strcmp0(info->interface, "255/0/0") == 0)
network = info->devnode;
}
if (control == NULL && network == NULL)
return FALSE;
DBG("control=%s network=%s", control, network);
ofono_modem_set_string(modem->modem, "ControlPort", control);
ofono_modem_set_string(modem->modem, "NetworkInterface", network);
return TRUE;
}
static struct {
const char *name;
gboolean (*setup)(struct modem_info *modem);
@ -292,6 +322,7 @@ static struct {
{ "huaweicdma", setup_huawei },
{ "novatel", setup_novatel },
{ "zte", setup_zte },
{ "samsung", setup_samsung },
{ }
};
@ -462,6 +493,8 @@ static struct {
{ "huaweicdma", "option", "201e" },
{ "novatel", "option", "1410" },
{ "zte", "option", "19d2" },
{ "samsung", "option", "04e8", "6889" },
{ "samsung", "kalmia" },
{ }
};