Skip to contentSkip to conversation

udev rules update

PATCH In review Philippe Nunes 2 participants 7 messages Aug 31, 2011 – Oct 26, 2011

lore
Share & tools
lore
#0 lore raw

v3 cover udev rules update

The modification I did in udevng.c to prevent overiding of the OFONO_LABEL based assignment, could break the default assignment. I fixed this with this new patch.

Philippe Nunes (5):
udev: Add rules to support ZTE MF668 dongle
udev: Add rules to support ZTE MF190 dongle
udevng.c: tty assignment according OFONO_LABEL should take precedence
udev: Add rules to support Speedup 7300 dongle
udev: Add rules to support SpeedUp 9800 dongle

 plugins/ofono.rules |   20 ++++++++++++++++
 plugins/udevng.c    |   61 +++++++++++++++++++++++++++++++-------------------
 2 files changed, 58 insertions(+), 23 deletions(-)
#1 lore raw

PATCH v3 1/5 udev: Add rules to support ZTE MF668 dongle

---
 plugins/ofono.rules |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)
plugins/ofono.rules +9 -0
index 30a1b7e..c7fac57 100644
@@ -15,6 +15,15 @@ KERNEL=="shrm0", ENV{OFONO_DRIVER}="u8500"
 
 LABEL="ofono_isi_end"
 
+SUBSYSTEM!="tty", GOTO="ofono_tty_end"
+KERNEL!="ttyUSB[0-9]*", GOTO="ofono_tty_end"
+
+# ZTE
+ATTRS{idVendor}=="19d2", ATTRS{idProduct}=="0017", ENV{ID_USB_INTERFACE_NUM}=="02", ENV{OFONO_LABEL}="modem"
+ATTRS{idVendor}=="19d2", ATTRS{idProduct}=="0017", ENV{ID_USB_INTERFACE_NUM}=="01", ENV{OFONO_LABEL}="aux"
+
+LABEL="ofono_tty_end"
+
 SUBSYSTEM!="usb", GOTO="ofono_end"
 ENV{DEVTYPE}!="usb_device", GOTO="ofono_end"
 
Signature · 1 line
1.7.1
#2 lore raw

PATCH v3 2/5 udev: Add rules to support ZTE MF190 dongle

In reply to Philippe Nunes
---
 plugins/ofono.rules |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
plugins/ofono.rules +3 -0
index c7fac57..079db07 100644
@@ -22,6 +22,9 @@ KERNEL!="ttyUSB[0-9]*", GOTO="ofono_tty_end"
 ATTRS{idVendor}=="19d2", ATTRS{idProduct}=="0017", ENV{ID_USB_INTERFACE_NUM}=="02", ENV{OFONO_LABEL}="modem"
 ATTRS{idVendor}=="19d2", ATTRS{idProduct}=="0017", ENV{ID_USB_INTERFACE_NUM}=="01", ENV{OFONO_LABEL}="aux"
 
+ATTRS{idVendor}=="19d2", ATTRS{idProduct}=="0124", ENV{ID_USB_INTERFACE_NUM}=="04", ENV{OFONO_LABEL}="modem"
+ATTRS{idVendor}=="19d2", ATTRS{idProduct}=="0124", ENV{ID_USB_INTERFACE_NUM}=="01", ENV{OFONO_LABEL}="aux"
+
 LABEL="ofono_tty_end"
 
 SUBSYSTEM!="usb", GOTO="ofono_end"
Signature · 1 line
1.7.1
#3 lore raw

PATCH v3 3/5 udevng.c: tty assignment according OFONO_LABEL should take precedence

In reply to Philippe Nunes
---
 plugins/udevng.c |   61 +++++++++++++++++++++++++++++++++--------------------
 1 files changed, 38 insertions(+), 23 deletions(-)
plugins/udevng.c +38 -23
index 1365bd1..e2a5059 100644
@@ -235,6 +235,7 @@ static gboolean setup_sierra(struct modem_info *modem)
 static gboolean setup_huawei(struct modem_info *modem)
 {
 	const char *mdm = NULL, *pcui = NULL, *diag = NULL;
+	const char *default_pcui = NULL;
 	GSList *list;
 
 	DBG("%s", modem->syspath);
@@ -264,19 +265,24 @@ static gboolean setup_huawei(struct modem_info *modem)
 			if (mdm != NULL && pcui != NULL)
 				break;
 		} else if (g_strcmp0(info->interface, "255/255/255") == 0) {
-			if (g_strcmp0(info->number, "00") == 0)
+			if (mdm == NULL && g_strcmp0(info->number, "00") == 0)
 				mdm = info->devnode;
-			else if (g_strcmp0(info->number, "01") == 0)
-				pcui = info->devnode;
-			else if (g_strcmp0(info->number, "02") == 0)
-				pcui = info->devnode;
-			else if (g_strcmp0(info->number, "03") == 0)
-				pcui = info->devnode;
-			else if (g_strcmp0(info->number, "04") == 0)
-				pcui = info->devnode;
+			else if (pcui == NULL) {
+				if (g_strcmp0(info->number, "01") == 0)
+					default_pcui = info->devnode;
+				else if (g_strcmp0(info->number, "02") == 0)
+					default_pcui = info->devnode;
+				else if (g_strcmp0(info->number, "03") == 0)
+					default_pcui = info->devnode;
+				else if (g_strcmp0(info->number, "04") == 0)
+					default_pcui = info->devnode;
+			}
 		}
 	}
 
+	if (pcui == NULL && default_pcui != NULL)
+		pcui = default_pcui;
+
 	if (mdm == NULL || pcui == NULL)
 		return FALSE;
 
@@ -291,7 +297,7 @@ static gboolean setup_huawei(struct modem_info *modem)
 
 static gboolean setup_speedup(struct modem_info *modem)
 {
-	const char *aux = NULL, *mdm = NULL;
+	const char *aux = NULL, *mdm = NULL, *default_mdm = NULL;
 	GSList *list;
 
 	DBG("%s", modem->syspath);
@@ -311,15 +317,20 @@ static gboolean setup_speedup(struct modem_info *modem)
 			if (aux != NULL)
 				break;
 		} else if (g_strcmp0(info->interface, "255/255/255") == 0) {
-			if (g_strcmp0(info->number, "01") == 0)
+			if (aux == NULL && g_strcmp0(info->number, "01") == 0)
 				aux = info->devnode;
-			else if (g_strcmp0(info->number, "02") == 0)
-				mdm = info->devnode;
-			else if (g_strcmp0(info->number, "03") == 0)
-				mdm = info->devnode;
+			else if (mdm == NULL) {
+				if (g_strcmp0(info->number, "02") == 0)
+					default_mdm = info->devnode;
+				else if (g_strcmp0(info->number, "03") == 0)
+					default_mdm = info->devnode;
+			}
 		}
 	}
 
+	if (mdm == NULL && default_mdm != NULL)
+		mdm = default_mdm;
+
 	if (aux == NULL || mdm == NULL)
 		return FALSE;
 
@@ -385,9 +396,10 @@ static gboolean setup_alcatel(struct modem_info *modem)
 			if (aux != NULL)
 				break;
 		} else if (g_strcmp0(info->interface, "255/255/255") == 0) {
-			if (g_strcmp0(info->number, "03") == 0)
+			if (aux == NULL && g_strcmp0(info->number, "03") == 0)
 				aux = info->devnode;
-			else if (g_strcmp0(info->number, "05") == 0)
+			else if (mdm == NULL &&
+					g_strcmp0(info->number, "05") == 0)
 				mdm = info->devnode;
 		}
 	}
@@ -425,9 +437,10 @@ static gboolean setup_novatel(struct modem_info *modem)
 			if (aux != NULL)
 				break;
 		} else if (g_strcmp0(info->interface, "255/255/255") == 0) {
-			if (g_strcmp0(info->number, "00") == 0)
+			if (aux == NULL && g_strcmp0(info->number, "00") == 0)
 				aux = info->devnode;
-			else if (g_strcmp0(info->number, "01") == 0)
+			else if (mdm == NULL &&
+					g_strcmp0(info->number, "01") == 0)
 				mdm = info->devnode;
 		}
 	}
@@ -465,9 +478,10 @@ static gboolean setup_nokia(struct modem_info *modem)
 			if (aux != NULL)
 				break;
 		} else if (g_strcmp0(info->interface, "10/0/0") == 0) {
-			if (g_strcmp0(info->number, "02") == 0)
+			if (mdm == NULL && g_strcmp0(info->number, "02") == 0)
 				mdm = info->devnode;
-			else if (g_strcmp0(info->number, "04") == 0)
+			else if (aux == NULL &&
+					g_strcmp0(info->number, "04") == 0)
 				aux = info->devnode;
 		}
 	}
@@ -505,13 +519,14 @@ static gboolean setup_telit(struct modem_info *modem)
 			if (aux != NULL)
 				break;
 		} else if (g_strcmp0(info->interface, "255/255/255") == 0) {
-			if (g_strcmp0(info->number, "00") == 0)
+			if (mdm == NULL && g_strcmp0(info->number, "00") == 0)
 				mdm = info->devnode;
 			else if (g_strcmp0(info->number, "01") == 0)
 				diag = info->devnode;
 			else if (g_strcmp0(info->number, "02") == 0)
 				gps = info->devnode;
-			else if (g_strcmp0(info->number, "03") == 0)
+			else if (aux == NULL
+					&& g_strcmp0(info->number, "03") == 0)
 				aux = info->devnode;
 		}
 	}
Signature · 1 line
1.7.1
#4 lore raw

PATCH v3 4/5 udev: Add rules to support Speedup 7300 dongle

In reply to Philippe Nunes
---
 plugins/ofono.rules |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
plugins/ofono.rules +4 -0
index 079db07..7f284d4 100644
@@ -25,6 +25,10 @@ ATTRS{idVendor}=="19d2", ATTRS{idProduct}=="0017", ENV{ID_USB_INTERFACE_NUM}=="0
 ATTRS{idVendor}=="19d2", ATTRS{idProduct}=="0124", ENV{ID_USB_INTERFACE_NUM}=="04", ENV{OFONO_LABEL}="modem"
 ATTRS{idVendor}=="19d2", ATTRS{idProduct}=="0124", ENV{ID_USB_INTERFACE_NUM}=="01", ENV{OFONO_LABEL}="aux"
 
+# SpeedUp 7300
+ATTRS{idVendor}=="1c9e", ATTRS{idProduct}=="9e00", ENV{ID_USB_INTERFACE_NUM}=="00", ENV{OFONO_LABEL}="modem"
+ATTRS{idVendor}=="1c9e", ATTRS{idProduct}=="9e00", ENV{ID_USB_INTERFACE_NUM}=="03", ENV{OFONO_LABEL}="aux"
+
 LABEL="ofono_tty_end"
 
 SUBSYSTEM!="usb", GOTO="ofono_end"
Signature · 1 line
1.7.1
#5 lore raw

PATCH v3 5/5 udev: Add rules to support SpeedUp 9800 dongle

In reply to Philippe Nunes
---
 plugins/ofono.rules |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
plugins/ofono.rules +4 -0
index 7f284d4..9e7a651 100644
@@ -29,6 +29,10 @@ ATTRS{idVendor}=="19d2", ATTRS{idProduct}=="0124", ENV{ID_USB_INTERFACE_NUM}=="0
 ATTRS{idVendor}=="1c9e", ATTRS{idProduct}=="9e00", ENV{ID_USB_INTERFACE_NUM}=="00", ENV{OFONO_LABEL}="modem"
 ATTRS{idVendor}=="1c9e", ATTRS{idProduct}=="9e00", ENV{ID_USB_INTERFACE_NUM}=="03", ENV{OFONO_LABEL}="aux"
 
+# SpeedUp 9800
+ATTRS{idVendor}=="1c9e", ATTRS{idProduct}=="9800", ENV{ID_USB_INTERFACE_NUM}=="01", ENV{OFONO_LABEL}="modem"
+ATTRS{idVendor}=="1c9e", ATTRS{idProduct}=="9800", ENV{ID_USB_INTERFACE_NUM}=="02", ENV{OFONO_LABEL}="aux"
+
 LABEL="ofono_tty_end"
 
 SUBSYSTEM!="usb", GOTO="ofono_end"
Signature · 1 line
1.7.1
#6 lore raw
In reply to Philippe Nunes

Hi Denis and Marcel,

Quoted 10 lines · Philippe Nunes

The modification I did in udevng.c to prevent overiding of the OFONO_LABEL based assignment, could break the default assignment. I fixed this with this new patch.

Philippe Nunes (5):
udev: Add rules to support ZTE MF668 dongle
udev: Add rules to support ZTE MF190 dongle
udevng.c: tty assignment according OFONO_LABEL should take precedence
udev: Add rules to support Speedup 7300 dongle
udev: Add rules to support SpeedUp 9800 dongle

Quoted 9 lines
  plugins/ofono.rules |   20 ++++++++++++++++
  plugins/udevng.c    |   61 +++++++++++++++++++++++++++++++-------------------
  2 files changed, 58 insertions(+), 23 deletions(-)

_______________________________________________
ofono mailing list
ofono(a)ofono.org
http://lists.ofono.org/listinfo/ofono

As we would need this update to make some CDMA dongles working to test UIM implementation, do you plan to apply those patches?
Do you have another solution?
Thanks.

Kind regards,
Guillaume