lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20180330153406.GA20218@amd>
Date:   Fri, 30 Mar 2018 17:34:06 +0200
From:   Pavel Machek <pavel@....cz>
To:     Tony Lindgren <tony@...mide.com>
Cc:     Merlijn Wajer <merlijn@...zup.org>,
        Sebastian Reichel <sebastian.reichel@...labora.co.uk>,
        Mark Brown <broonie@...nel.org>,
        Liam Girdwood <lgirdwood@...il.com>,
        Rob Herring <robh+dt@...nel.org>,
        Lee Jones <lee.jones@...aro.org>,
        Jaroslav Kysela <perex@...ex.cz>,
        Takashi Iwai <tiwai@...e.com>, alsa-devel@...a-project.org,
        linux-omap@...r.kernel.org, devicetree@...r.kernel.org,
        linux-kernel@...r.kernel.org, kernel@...labora.com,
        Dan Williams <dcbw@...hat.com>
Subject: Re: omap4-droid4: voice call support was Re: [PATCHv5,5/5] ARM: dts:
 omap4-droid4: add soundcard

Hi!

> > >> Great, good to hear that :)
> > > 
> > > I also got ofonod to work, with rather crazy hacks. But I now have
> > > incoming/outgoing calls with GUI :-).
> > 
> > Would you mind sharing those hacks - I would like to play around with
> > ofonod as well. Maybe I can help with a way forward.
> 
> Yeah that would be fun to play with :)

Ok, I thought I should clean them up first, but hey...

sudo emacs /etc/udev/rules.d/55-modem.rules
KERNEL=="ttyUSB4", ENV{OFONO_DRIVER}="g1"

sudo udevadm trigger

And now, the crazy hack follows. Note I'm using AT interface -- which
is probably not good idea.

Anyway, network/signal strength is detected, and calls seem to work.

diff --git a/drivers/atmodem/sms.c b/drivers/atmodem/sms.c
index 68b89862..3a9f4bc0 100644
--- a/drivers/atmodem/sms.c
+++ b/drivers/atmodem/sms.c
@@ -440,6 +440,8 @@ static void at_cmt_notify(GAtResult *result, gpointer user_data)
 	if (data->vendor != OFONO_VENDOR_SIMCOM)
 		at_ack_delivery(sms);
 
+	return;
+
 err:
 	ofono_error("Unable to parse CMT notification");
 }
diff --git a/plugins/g1.c b/plugins/g1.c
index d915a565..dd4e735d 100644
--- a/plugins/g1.c
+++ b/plugins/g1.c
@@ -60,7 +60,8 @@ static void g1_debug(const char *str, void *user_data)
 /* Detect hardware, and initialize if found */
 static int g1_probe(struct ofono_modem *modem)
 {
-	DBG("");
+	DBG("probing G1");
+	DBG("probing G1 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
 
 	return 0;
 }
@@ -97,14 +98,21 @@ static int g1_enable(struct ofono_modem *modem)
 
 	DBG("");
 
+	DBG("enabling G1 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
+	
 	device = ofono_modem_get_string(modem, "Device");
-	if (device == NULL)
-		return -EINVAL;
+	//	if (device == NULL)
+	//	return -EINVAL;
+	device = "/dev/ttyUSB4";
+
+	DBG("");
 
 	channel = g_at_tty_open(device, NULL);
 	if (channel == NULL)
 		return -EIO;
 
+	DBG("");	
+
 	syntax = g_at_syntax_new_gsm_permissive();
 	chat = g_at_chat_new(channel, syntax);
 	g_io_channel_unref(channel);
@@ -116,11 +124,14 @@ static int g1_enable(struct ofono_modem *modem)
 	if (getenv("OFONO_AT_DEBUG"))
 		g_at_chat_set_debug(chat, g1_debug, "");
 
+		DBG("");
 	ofono_modem_set_data(modem, chat);
 
+	DBG("");	
 	/* ensure modem is in a known state; verbose on, echo/quiet off */
 	g_at_chat_send(chat, "ATE0Q0V1", NULL, NULL, NULL, NULL);
 
+		DBG("");
 	/* power up modem */
 	g_at_chat_send(chat, "AT+CFUN=1", NULL, cfun_set_on_cb, modem, NULL);
 
@@ -191,18 +202,56 @@ static void g1_post_sim(struct ofono_modem *modem)
 		ofono_message_waiting_register(mw);
 }
 
+static void g1_post_online(struct ofono_modem *modem)
+{
+  DBG();
+}
+
+static void set_online_cb(gboolean ok, GAtResult *result, gpointer user_data)
+{
+	struct ofono_modem *modem = user_data;
+	GAtChat *chat = ofono_modem_get_data(modem);
+
+	DBG("");
+
+	g_at_chat_unref(chat);
+	ofono_modem_set_data(modem, NULL);
+	
+	//	if (ok)
+	//	ofono_modem_set_online(modem, TRUE);
+}
+
+static void g1_set_online(struct ofono_modem *modem, ofono_bool_t online,
+				ofono_modem_online_cb_t cb, void *user_data)
+{
+  	GAtChat *chat = ofono_modem_get_data(modem);
+	char const *command = online ? "AT+CFUN=1" : "AT+CFUN=4";
+
+	DBG("modem %p %s", modem, online ? "online" : "offline");
+
+	if (g_at_chat_send(chat, command, NULL,
+					set_online_cb, modem, NULL) > 0)
+		return;
+
+	//CALLBACK_WITH_FAILURE(cb, cbd->data);
+
+}
+
 static struct ofono_modem_driver g1_driver = {
 	.name		= "g1",
 	.probe		= g1_probe,
 	.remove		= g1_remove,
 	.enable		= g1_enable,
 	.disable	= g1_disable,
+	//	.set_online     = g1_set_online,
 	.pre_sim	= g1_pre_sim,
 	.post_sim	= g1_post_sim,
+	.post_online	= g1_post_online,
 };
 
 static int g1_init(void)
 {
+  DBG("g1_init!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n");
 	return ofono_modem_driver_register(&g1_driver);
 }
 
diff --git a/plugins/udevng.c b/plugins/udevng.c
index ff5d41af..3e0cdf81 100644
--- a/plugins/udevng.c
+++ b/plugins/udevng.c
@@ -1250,6 +1250,7 @@ static struct {
 	{ "cinterion",	setup_serial_modem	},
 	{ "nokiacdma",	setup_serial_modem	},
 	{ "sim900",	setup_serial_modem	},
+	{ "g1",		setup_serial_modem	},
 	{ "wavecom",	setup_wavecom		},
 	{ "tc65",	setup_tc65		},
 	{ "ehs6",	setup_ehs6		},
@@ -1407,7 +1408,7 @@ static void add_serial_device(struct udev_device *dev)
 
 	mdev = get_serial_modem_device(dev);
 	if (!mdev) {
-		DBG("Device is missing required OFONO_DRIVER property");
+	  //DBG("Device %s %s is missing required OFONO_DRIVER property", udev_device_get_devpath(mdev), udev_device_get_syspath(mdev));
 		return;
 	}
 
@@ -1419,6 +1420,9 @@ static void add_serial_device(struct udev_device *dev)
 
 	devnode = udev_device_get_devnode(dev);
 
+       	DBG("Got OFONO_DRIVER!!!! driver %s path %s\n", driver, devpath);
+
+
 	if (!syspath || !devpath)
 		return;
 
@@ -1578,8 +1582,6 @@ static struct {
 	{ "mbm",	"cdc_ether",	"0930"		},
 	{ "mbm",	"cdc_ncm",	"0930"		},
 	{ "hso",	"hso"				},
-	{ "gobi",	"qmi_wwan"			},
-	{ "gobi",	"qcserial"			},
 	{ "sierra",	"qmi_wwan",	"1199"		},
 	{ "sierra",	"qcserial",	"1199"		},
 	{ "sierra",	"sierra"			},
@@ -1602,6 +1604,8 @@ static struct {
 	{ "telit",	"cdc_acm",	"1bc7", "0021"	},
 	{ "telitqmi",	"qmi_wwan",	"1bc7", "1201"	},
 	{ "telitqmi",	"option",	"1bc7", "1201"	},
+	{ "telitqmi",	"qmi_wwan",	"22b8", "2a70"	},
+	{ "telitqmi",	"option",	"22b8", "2a70"	},
 	{ "nokia",	"option",	"0421", "060e"	},
 	{ "nokia",	"option",	"0421", "0623"	},
 	{ "samsung",	"option",	"04e8", "6889"	},
@@ -1717,10 +1721,12 @@ static void check_device(struct udev_device *device)
 			return;
 	}
 
+#if 0
 	if ((g_str_equal(bus, "usb") == TRUE) ||
 			(g_str_equal(bus, "usbmisc") == TRUE))
 		check_usb_device(device);
 	else
+#endif
 		add_serial_device(device);
 
 }
@@ -1746,17 +1752,20 @@ static gboolean create_modem(gpointer key, gpointer value, gpointer user_data)
 		return TRUE;
 
 	for (i = 0; driver_list[i].name; i++) {
+	  DBG("comparing %s %s", driver_list[i].name, modem->driver);
 		if (g_str_equal(driver_list[i].name, modem->driver) == FALSE)
 			continue;
 
-		if (driver_list[i].setup(modem) == TRUE) {
+		/* if (driver_list[i].setup(modem) == TRUE) */ {
 			ofono_modem_set_string(modem->modem, "SystemPath",
 								syspath);
 			ofono_modem_register(modem->modem);
+			DBG("create modem is okay?");
 			return FALSE;
 		}
 	}
 
+	DBG("create modem is maybe not okay?");
 	return TRUE;
 }
 
@@ -1796,6 +1805,7 @@ static void enumerate_devices(struct udev *context)
 	udev_enumerate_unref(enumerate);
 
 	g_hash_table_foreach_remove(modem_list, create_modem, NULL);
+	DBG("Enumerate devices ok?");
 }
 
 static struct udev *udev_ctx;
@@ -1811,6 +1821,8 @@ static gboolean check_modem_list(gpointer user_data)
 
 	g_hash_table_foreach_remove(modem_list, create_modem, NULL);
 
+	DBG("Check modem list ok?");	
+
 	return FALSE;
 }
 
@@ -1820,6 +1832,8 @@ static gboolean udev_event(GIOChannel *channel, GIOCondition cond,
 	struct udev_device *device;
 	const char *action;
 
+	DBG("udev event");
+
 	if (cond & (G_IO_ERR | G_IO_HUP | G_IO_NVAL)) {
 		ofono_warn("Error with udev monitor channel");
 		udev_watch = 0;
@@ -1838,11 +1852,14 @@ static gboolean udev_event(GIOChannel *channel, GIOCondition cond,
 		if (udev_delay > 0)
 			g_source_remove(udev_delay);
 
+		DBG("udev event add -> check");		
 		check_device(device);
 
 		udev_delay = g_timeout_add_seconds(1, check_modem_list, NULL);
-	} else if (g_str_equal(action, "remove") == TRUE)
+	} else if (g_str_equal(action, "remove") == TRUE) {
+	  DBG("udev event remove -> remove");
 		remove_device(device);
+	}
 
 	udev_device_unref(device);
 
@@ -1892,8 +1909,10 @@ static int detect_init(void)
 		return -EIO;
 	}
 
+	ofono_warn("detect_init...");
 	modem_list = g_hash_table_new_full(g_str_hash, g_str_equal,
 						NULL, destroy_modem);
+	ofono_warn("detect_init 2...");	
 
 	udev_monitor_filter_add_match_subsystem_devtype(udev_mon, "tty", NULL);
 	udev_monitor_filter_add_match_subsystem_devtype(udev_mon, "usb", NULL);
diff --git a/src/modem.c b/src/modem.c
index 0cee861f..d8dde772 100644
--- a/src/modem.c
+++ b/src/modem.c
@@ -603,12 +603,14 @@ static gboolean modem_has_sim(struct ofono_modem *modem)
 
 static gboolean modem_is_always_online(struct ofono_modem *modem)
 {
+  DBG();
 	if (modem->driver->set_online == NULL)
 		return TRUE;
 
 	if (ofono_modem_get_boolean(modem, "AlwaysOnline") == TRUE)
 		return TRUE;
 
+	DBG("not always");
 	return FALSE;
 }
 
@@ -720,8 +722,10 @@ static void sim_state_watch(enum ofono_sim_state new_state, void *user)
 		modem_change_state(modem, MODEM_STATE_OFFLINE);
 
 		/* Modem is always online, proceed to online state. */
-		if (modem_is_always_online(modem) == TRUE)
+		if (modem_is_always_online(modem) == TRUE) {
 			set_online(modem, TRUE);
+			modem->online = TRUE;
+		}
 
 		if (modem->online == TRUE)
 			modem_change_state(modem, MODEM_STATE_ONLINE);
@@ -1882,13 +1886,17 @@ struct ofono_modem *ofono_modem_create(const char *name, const char *type)
 	else
 		snprintf(path, sizeof(path), "/%s", name);
 
-	if (!dbus_validate_path(path, NULL))
+	if (!dbus_validate_path(path, NULL)) {
+	  DBG("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!bad dbus path");
 		return NULL;
+	}
 
 	modem = g_try_new0(struct ofono_modem, 1);
 
-	if (modem == NULL)
+	if (modem == NULL) {
+	  DBG("!!!out of memory?!");
 		return modem;
+	}
 
 	modem->path = g_strdup(path);
 	modem->driver_type = g_strdup(type);
@@ -1900,6 +1908,7 @@ struct ofono_modem *ofono_modem_create(const char *name, const char *type)
 	if (name == NULL)
 		next_modem_id += 1;
 
+	DBG("Created new modem, path %s", path);
 	return modem;
 }
 
diff --git a/src/network.c b/src/network.c
index ae3175d4..700183c0 100644
--- a/src/network.c
+++ b/src/network.c
@@ -980,6 +980,7 @@ static DBusMessage *network_scan(DBusConnection *conn,
 {
 	struct ofono_netreg *netreg = data;
 
+	DBG();
 	if (netreg->mode == NETWORK_REGISTRATION_MODE_AUTO_ONLY)
 		return __ofono_error_access_denied(msg);
 
@@ -991,6 +992,7 @@ static DBusMessage *network_scan(DBusConnection *conn,
 
 	netreg->pending = dbus_message_ref(msg);
 
+	DBG();
 	netreg->driver->list_operators(netreg, operator_list_callback, netreg);
 
 	return NULL;
diff --git a/src/voicecall.c b/src/voicecall.c
index e4f6a4c0..2c637e58 100644
--- a/src/voicecall.c
+++ b/src/voicecall.c
@@ -1492,6 +1492,7 @@ static int voicecall_dial(struct ofono_voicecall *vc, const char *number,
 	struct ofono_modem *modem = __ofono_atom_get_modem(vc->atom);
 	struct ofono_phone_number ph;
 
+	DBG("");
 	if (g_slist_length(vc->call_list) >= MAX_VOICE_CALLS)
 		return -EPERM;
 





-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

Download attachment "signature.asc" of type "application/pgp-signature" (182 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ