WIP Droid 4 voice calls, GNSS & PM with a TS 27.010 serdev driver
Hi all,
So the little elves have been slowly working to get voice calls working on droid 4 with the mainline kernel. And just in time for the upcoming holidays, it might be possible to call friends and relatives.
I've pushed out an experimental branch containing serdev ts 27.010 UART multiplexing support. That contains a serdev core driver for the mdm6600 modem (that also now idles the modem for PM), support for Alsa ASoC voice codec and mixer, and a GNSS driver for the GPS.
Where it does not make sense to do a kernel serdev driver, I've exposed the rest of the available 27.010 channels as ten /dev/motmdm* character devices. There's /dev/motmdm1 for AT commands to dial voice calls, /dev/motmdm3 for SMS eventually, and I think there's also a SIM card reader at /dev/motmdm10. Then /dev/motmdm7 seems to be just an echo channel. The other channels are still a bit of a mystery.
I'll be cleaning up these patches and submitting them for review when ready. If anybody feels like helping, I've added some REVISIT comments to the patches. The patches are in a git branch at [0][1] below based on a few Alsa ASoC patches for v4.21 from Linux next.
Thanks everybody for helping with comments and code to get the various pieces working, below are some brief instructions too :)
Cheers,
Tony
[0] https://git.kernel.org/pub/scm/linux/kernel/git/tmlind/linux-omap.git/log/?h=droid4-pending-mdm-v4.20
[1] git://git.kernel.org/pub/scm/linux/kernel/git/tmlind/linux-omap droid4-pending-mdm-v4.20
8< ----------------------
Serdev voice call and GNSS instructions for droid 4
1. Configure alsamixer
Speaker Right -> Voice
Call Noise Cancellation -> Unmute
Call Output -> Handset
Call -> 100
Mic2 -> 40
Left -> Mic 2
Voice -> 55
Voice call should get automatically enabled for the duration of voice calls
2. Test a voice call
$ minicom -D /dev/motmdm1 # Then Ctrl-a-e to enable local echo AT # Case sensitive AT commands.. :OK # Response uses : as separator.. AT+CFUN=1 # Enable radio +CFUN:OK ~+RSSI=1,9,108,99,0,0,0 ... ATD1234567890 # Dial some phone number D:OK ... ATH # Hang up H:OK
3. Test GNSS
$ cat /dev/gnss0 $GPGSV,3,1,11,03,,,,05,14,313,,07,66,322,,08,32,106,*43 ...
4. Known pending issues
There's an issue with gpsd not parsing $GNGNS packets, see
https://lists.gnu.org/archive/html/gpsd-dev/2016-05/msg00298.html
Sending SMS should be doable by writing to /dev/motmdm3 but I have not quite figured out the message format
I have not tested with built-in modules.. There may be some deferred probe issues remaining.
Hi!
Quoted 8 lines
So the little elves have been slowly working to get voice calls working on droid 4 with the mainline kernel. And just in time for the upcoming holidays, it might be possible to call friends and relatives.
I've pushed out an experimental branch containing serdev ts 27.010 UART multiplexing support. That contains a serdev core driver for the mdm6600 modem (that also now idles the modem for PM), support for Alsa ASoC voice codec and mixer, and a GNSS driver for the GPS.
Thanks for doing the work.
I'm quite busy these days, but...
# commit 64cf2bf6b7614da35028a11974acb5a445dcc535 (patch)
# n_gsm: Use const unsigned char * and size_t
# We can use const unsigned char * and size_t. This makes things
# a bit easier for adding serdev support. # # Note that gsm_control_modem() gsm_control_rls() read the data # for tty control characters and then call gsm_control_reply() # that allocates a new reply and copies the data. # # REVISIT: Check size_t usage vs int # # Signed-off-by: Tony Lindgren <[email protected]>
Dunno, I see that you might want const there, but u8 -> unsigned char seems like a step in wrong direction.
# commit cd16272060d8100ef0388349cf88f42a1dc667fc (patch)
# tty: n_gsm: Add support for serdev
Is it worth putting those in separate file? n_gsm_serdev.c?
# commit 0c1bc81ba976bcd480d6e3c3009a28589f8427c0 (patch)
# mfd: motmdm: Add Motorola TS 27.010 serdev driver for devices like droid4
Oh, that is a lot of fun. Especially state machine for parsing modem responses. I wonder how well it is going to work when modem is accessed over USB...
motmdm_read_state(... size_t len)
I applied it over my tree (I still need patches for display, right?). I'm getting
/data/fast/l/k/drivers/mfd/motorola-mdm.c:1132:3: error: initializer element is not constant /data/fast/l/k/drivers/mfd/motorola-mdm.c:1132:3: error: (near initialization for 'motmdm_driver.driver.name') /data/fast/l/k/scripts/Makefile.build:291: recipe for target 'drivers/mfd/motorola-mdm.o' failed
Oh and that mdelay(3000) is going to hurt... especially because console is initialized very late or d4.
I did a quick test in my config... and it did not break my old setup -- voice calls still work when set up over USB and with manual mixer setup. That was good surprise.
Thanks,
Pavel
drivers/mfd/motorola-mdm.c +1 -1
@@ -1129,7 +1129,7 @@ static void motmdm_remove(struct serdev_device *serdev)static struct serdev_device_driver motmdm_driver = { .driver = { - .name = motmdm_driver_name, + .name ="motmdm" , .of_match_table =of_match_ptr (motmdm_id_table), .pm = &motmdm_pm_ops, },
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Hi,
Quoted 2 lines · Pavel Machek
Dunno, I see that you might want const there, but u8 -> unsigned char seems like a step in wrong direction.
Well I was just trying to follow what the serdev core is doing nowadays.. I'll see if I can just constify.
Quoted 4 lines
# commit
cd16272060d8100ef0388349cf88f42a1dc667fc(patch)
# tty:n_gsm: Add support for serdevIs it worth putting those in separate file?
n_gsm_serdev.c?
Yes that's the plan but that needs some refactoring to be done and I did not want to get into that until I had things working to prevent regressions.
Quoted 8 lines
# commit
0c1bc81ba976bcd480d6e3c3009a28589f8427c0(patch)
# mfd: motmdm: Add Motorola TS 27.010 serdev driver for devices like droid4Oh, that is a lot of fun. Especially state machine for parsing modem responses. I wonder how well it is going to work when modem is accessed over USB...
motmdm_read_state(...
size_tlen)
That's a bit of a layering violation yeah :) But we still need to do that somewhere for notifiers. And the notifications are separate from the commands and start with a ~ character so from that point of view it should not be too bad.
In general, motorola-mdm should just deal with the custom packet numbering layer and pass data to channel specific serdev drivers or to the channel specific /dev/motmdm* char devices.
Quoted 9 lines
I applied it over my tree (I still need patches for display, right?). I'm getting
/data/fast/l/k/drivers/mfd/motorola-mdm.c:1132:3: error: initializer element is not constant /data/fast/l/k/drivers/mfd/motorola-mdm.c:1132:3: error: (near initialization for 'motmdm_driver.driver.name') /data/fast/l/k/scripts/Makefile.build:291: recipe for target '
drivers/mfd/motorola-mdm.o' failed
Hmm OK thanks for letting me know. Yes Sebastian has updated branches for the LCD.
Quoted 2 lines
Oh and that mdelay(3000) is going to hurt... especially because console is initialized very late or d4.
It's msleep() not mdelay(). Sorry I have not figured out a better way so far to get the n_gsm initialized other than spamming the device with retries for a while on start-up.
Quoted 3 lines
I did a quick test in my config... and it did not break my old setup -- voice calls still work when set up over USB and with manual mixer setup. That was good surprise.
OK good to hear. Using the n_gsm port instead of USB during idle has a major PM advantage as the SoC can hit retention during idle while still connected to the modem and getting notifications.
So looks like during idle we can keep USB in autosuspend mode with something like the below shell script function.
Regards,
Tony
8< -----------------------
# It's OK to keep to keep ohci device on auto and qmi_wwan and cdc_wd loaded. # Probably musb and ehci modules need to be currently unloaded for SoC idle.
suspend_usb() {
ohci=$(find /sys/bus/platform/devices -name \*.ohci)
if [ "${ohci}" = "" ]; then
return
fi
devices=$(find "${ohci}/" -type f -name control)
for device in ${devices}; do
echo -n "${device}: "
cat ${device}
done
for device in ${devices}; do
echo -n "auto" > ${device}
done
for device in ${devices}; do
echo -n "${device}: "
cat ${device}
done
}Hi!
Quoted 7 lines
Quoted 7 lines
# commit
0c1bc81ba976bcd480d6e3c3009a28589f8427c0(patch)
# mfd: motmdm: Add Motorola TS 27.010 serdev driver for devices like droid4Oh, that is a lot of fun. Especially state machine for parsing modem responses. I wonder how well it is going to work when modem is accessed over USB...
Quoted 6 lines
Quoted 1 line
motmdm_read_state(...
size_tlen)That's a bit of a layering violation yeah :) But we still need to do that somewhere for notifiers. And the notifications are separate from the commands and start with a ~ character so from that point of view it should not be too bad.
Plus, you seem to assume that data will always come in suitably sized chunks. Aha, and as it is not plain serial but packet protocol over serial... I guess that is going to work?
Quoted 10 lines
Quoted 3 lines
I did a quick test in my config... and it did not break my old setup -- voice calls still work when set up over USB and with manual mixer setup. That was good surprise.
OK good to hear. Using the
n_gsmport instead of USB during idle has a major PM advantage as the SoC can hit retention during idle while still connected to the modem and getting notifications.So looks like during idle we can keep USB in autosuspend mode with something like the below shell script function.
Yes, I should really start using serials instead of USB. But... I have working ofono there, and was using that phone and am little short on time at the moment.
Thanks,
Pavel
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Quoted 11 lines · Pavel Machek
Hi!
Quoted 9 lines
Quoted 8 lines
# commit
0c1bc81ba976bcd480d6e3c3009a28589f8427c0(patch)
# mfd: motmdm: Add Motorola TS 27.010 serdev driver for devices like droid4Oh, that is a lot of fun. Especially state machine for parsing modem responses. I wonder how well it is going to work when modem is accessed over USB...
motmdm_read_state(...
size_tlen)
Quoted 8 lines
Quoted 4 lines
That's a bit of a layering violation yeah :) But we still need to do that somewhere for notifiers. And the notifications are separate from the commands and start with a ~ character so from that point of view it should not be too bad.
Plus, you seem to assume that data will always come in suitably sized chunks. Aha, and as it is not plain serial but packet protocol over serial... I guess that is going to work?
Yeah it's just packet data out of the n_gsm.
Quoted 8 lines
Quoted 8 lines
Quoted 3 lines
I did a quick test in my config... and it did not break my old setup -- voice calls still work when set up over USB and with manual mixer setup. That was good surprise.
OK good to hear. Using the
n_gsmport instead of USB during idle has a major PM advantage as the SoC can hit retention during idle while still connected to the modem and getting notifications.
Quoted 6 lines
Quoted 2 lines
So looks like during idle we can keep USB in autosuspend mode with something like the below shell script function.
Yes, I should really start using serials instead of USB. But... I have working ofono there, and was using that phone and am little short on time at the moment.
Hopefully adding support to ofono and modemmanager to use use /dev/motmdm1 for calls should be quite trivial now.
Regards,
Tony
Hi!
Quoted 11 lines
Quoted 11 lines
Quoted 10 lines
Quoted 3 lines
I did a quick test in my config... and it did not break my old setup -- voice calls still work when set up over USB and with manual mixer setup. That was good surprise.
OK good to hear. Using the
n_gsmport instead of USB during idle has a major PM advantage as the SoC can hit retention during idle while still connected to the modem and getting notifications.So looks like during idle we can keep USB in autosuspend mode with something like the below shell script function.
Quoted 6 lines
Quoted 3 lines
Yes, I should really start using serials instead of USB. But... I have working ofono there, and was using that phone and am little short on time at the moment.
Hopefully adding support to ofono and modemmanager to use use
/dev/motmdm1for calls should be quite trivial now.
[email protected]:pavelmachek/ofono.git
"quite trivial" does not mix with ofono. I did parts and it is still not finished. At the moment, I do not have enough working SIM cards to test everything. Feel free to help :-).
Pavel
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Quoted 3 lines · Pavel Machek
"quite trivial" does not mix with ofono. I did parts and it is still not finished. At the moment, I do not have enough working SIM cards to test everything. Feel free to help :-).
I gave it a try but could only see "ofonod[14012]: motmdm init" on start up. Running test/list-modems shows only /stktest and no motmdm..
Do I need to configure something in /etc/ofono?
Regards,
Tony
Hi!
Quoted 9 lines
Quoted 3 lines
"quite trivial" does not mix with ofono. I did parts and it is still not finished. At the moment, I do not have enough working SIM cards to test everything. Feel free to help :-).
I gave it a try but could only see "ofonod[14012]: motmdm init" on start up. Running test/list-modems shows only /stktest and no motmdm..
Do I need to configure something in
/etc/ofono?
No, that should not be needed. But you need this:
user@devuan:~$ cat /etc/udev/rules.d/55-modem.rules
KERNEL=="ttyUSB4", ENV{OFONO_DRIVER}="g1"KERNEL=="motmdm1", ENV{OFONO_DRIVER}="motmdm"
(different devices for different branches of ofono), and it is useful to run ofono like this:
sudo OFONO_AT_DEBUG=1 src/ofonod -d -n -p motmdm,udevng,atmodem,motorolamodem
...to get right kind of debugging.
You then want to run enable-modem . online-modem is NOP, afaict.
Best regards,
Pavel
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Hi, little elves!
Quoted 9 lines
So the little elves have been slowly working to get voice calls working on droid 4 with the mainline kernel. And just in time for the upcoming holidays, it might be possible to call friends and relatives.
I've pushed out an experimental branch containing serdev ts 27.010 UART multiplexing support. That contains a serdev core driver for the mdm6600 modem (that also now idles the modem for PM), support for Alsa ASoC voice codec and mixer, and a GNSS driver for the GPS.
Quoted 6 lines
Where it does not make sense to do a kernel serdev driver, I've exposed the rest of the available 27.010 channels as ten
/dev/motmdm*character devices. There's/dev/motmdm1for AT commands to dial voice calls,/dev/motmdm3for SMS eventually, and I think there's also a SIM card reader at/dev/motmdm10. Then/dev/motmdm7seems to be just an echo channel. The other channels are still a bit of a mystery.
I tried to get access at motmdm, but no:
root@devuan:/home/user# minicom -D /dev/motmdm1 minicom: cannot open /dev/motmdm1: No such file or directory root@devuan:/home/user# ls -al /dev/motmdm1 ls: cannot access '/dev/motmdm1': No such file or directory root@devuan:/home/user# dmesg | grep motmd root@devuan:/home/user# zcat /proc/config.gz | grep MDM CONFIG_MFD_MOTMDM=y CONFIG_SND_SOC_MOTMDM=y CONFIG_PHY_MAPPHONE_MDM6600=y root@devuan:/home/user# uname -a Linux devuan 4.20.0-rc7-00304-gde109fe #19 SMP Sat Dec 22 20:16:19 CET 2018 armv7l GNU/Linux root@devuan:/home/user#
Let me try to enable CONFIG_GNSS_MOTMDM. N_GSM also seems enabled.
Is there anything else I need to enable in .config?
Scary Solstice!
Pavel
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Hi!
Quoted 9 lines
So the little elves have been slowly working to get voice calls working on droid 4 with the mainline kernel. And just in time for the upcoming holidays, it might be possible to call friends and relatives.
I've pushed out an experimental branch containing serdev ts 27.010 UART multiplexing support. That contains a serdev core driver for the mdm6600 modem (that also now idles the modem for PM), support for Alsa ASoC voice codec and mixer, and a GNSS driver for the GPS.
Quoted 6 lines
Where it does not make sense to do a kernel serdev driver, I've exposed the rest of the available 27.010 channels as ten
/dev/motmdm*character devices. There's/dev/motmdm1for AT commands to dial voice calls,/dev/motmdm3for SMS eventually, and I think there's also a SIM card reader at/dev/motmdm10. Then/dev/motmdm7seems to be just an echo channel. The other channels are still a bit of a mystery.
I suspected it does not work in non-modular case, so I tried with modules:
root@devuan:/my/ko# insmod gnss.ko root@devuan:/my/ko# insmod gnss-motmdm.ko insmod: ERROR: could not insert module gnss-motmdm.ko: Unknown symbol in module root@devuan:/my/ko# insmod n_gsm.ko root@devuan:/my/ko# insmod snd-soc-motmdm.ko insmod: ERROR: could not insert module snd-soc-motmdm.ko: Unknown symbol in module root@devuan:/my/ko# insmod motorola-mdm.ko root@devuan:/my/ko# insmod snd-soc-motmdm.ko root@devuan:/my/ko# insmod gnss-motmdm.ko root@devuan:/my/ko#
But...
root@devuan:/my/ko# ls -al /dev/motmdm* ls: cannot access '/dev/motmdm*': No such file or directory root@devuan:/my/ko# ls -al /dev/gnss* ls: cannot access '/dev/gnss*': No such file or directory root@devuan:/my/ko# [ 116.244445] gnss: GNSS driver registered with major 242 [ 119.892547] gnss_motmdm: Unknown symbol motmdm_register_dlci (err -2) [ 119.899444] gnss_motmdm: Unknown symbol motmdm_unregister_dlci (err -2) [ 129.145935] snd_soc_motmdm: Unknown symbol motmdm_register_dlci (err -2) [ 129.153106] snd_soc_motmdm: Unknown symbol motmdm_unregister_dlci (err -2) [ 131.120361] cpcap-usb-phy cpcap-usb-phy.0: connected to USB host [ 161.190216] cpcap-usb-phy cpcap-usb-phy.0: connected to USB host [ 191.270263] cpcap-usb-phy cpcap-usb-phy.0: connected to USB host [ 221.360107] cpcap-usb-phy cpcap-usb-phy.0: connected to USB host [ 251.429962] cpcap-usb-phy cpcap-usb-phy.0: connected to USB host [ 281.509643] cpcap-usb-phy cpcap-usb-phy.0: connected to USB host [ 292.816436] g_ether gadget: packet filter 0e [ 292.825256] g_ether gadget: ecm req21.43 v000e i0000 l0
...do I need to make devices manually or some udev rules?
user@devuan:~$ cat /proc/devices | grep motmdm user@devuan:~$ cat /proc/devices | grep gnss 242 gnss user@devuan:~$
Hmm, I suspect the driver just did not recognize the hw.
Pavel
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Hi!
Quoted 31 lines
Quoted 9 lines
So the little elves have been slowly working to get voice calls working on droid 4 with the mainline kernel. And just in time for the upcoming holidays, it might be possible to call friends and relatives.
I've pushed out an experimental branch containing serdev ts 27.010 UART multiplexing support. That contains a serdev core driver for the mdm6600 modem (that also now idles the modem for PM), support for Alsa ASoC voice codec and mixer, and a GNSS driver for the GPS.
Quoted 6 lines
Where it does not make sense to do a kernel serdev driver, I've exposed the rest of the available 27.010 channels as ten
/dev/motmdm*character devices. There's/dev/motmdm1for AT commands to dial voice calls,/dev/motmdm3for SMS eventually, and I think there's also a SIM card reader at/dev/motmdm10. Then/dev/motmdm7seems to be just an echo channel. The other channels are still a bit of a mystery.I suspected it does not work in non-modular case, so I tried with modules:
root@devuan:/my/ko# insmod gnss.ko root@devuan:/my/ko# insmod gnss-motmdm.ko insmod: ERROR: could not insert module gnss-motmdm.ko: Unknown symbol in module root@devuan:/my/ko# insmod n_gsm.ko root@devuan:/my/ko# insmod snd-soc-motmdm.ko insmod: ERROR: could not insert module snd-soc-motmdm.ko: Unknown symbol in module root@devuan:/my/ko# insmod motorola-mdm.ko root@devuan:/my/ko# insmod snd-soc-motmdm.ko root@devuan:/my/ko# insmod gnss-motmdm.ko root@devuan:/my/ko#
...
Quoted 8 lines
...do I need to make devices manually or some udev rules?
user@devuan:~$ cat /proc/devices | grep motmdm user@devuan:~$ cat /proc/devices | grep gnss 242 gnss user@devuan:~$Hmm, I suspect the driver just did not recognize the hw.
I added some printks to motmdm_probe, and they don't appear to be called. I wonder if I'm missing something else in the config? I do have serial
root@devuan:/my/ko# ls -al /dev/ttyS0 crw-rw---- 1 root dialout 4, 64 Dec 23 11:52 /dev/ttyS0
but not gsm multiplex:
root@devuan:/my/ko# ls -al /dev/gsm* ls: cannot access '/dev/gsm*': No such file or directory
Best regards,
Pavel
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Quoted 11 lines · Pavel Machek
I added some printks to
motmdm_probe, and they don't appear to be called. I wonder if I'm missing something else in the config? I do have serialroot@devuan:/my/ko# ls -al /dev/ttyS0 crw-rw---- 1 root dialout 4, 64 Dec 23 11:52 /dev/ttyS0but not gsm multiplex:
root@devuan:/my/ko# ls -al /dev/gsm* ls: cannot access '/dev/gsm*': No such file or directory
Hmm with serdev you should not get /dev/ttyS0, so maybe you're missing:
CONFIG_SERIAL_DEV_BUS=yCONFIG_SERIAL_DEV_CTRL_TTYPORT=y
Probably the Kconfig dependency should be for SERIAL_DEV_CTRL_TTYPORT instead of SERIAL_DEV_BUS in these patches if that helps.
Or else you're missing the serdev related dts changes?
Regards,
Tony
Quoted 10 lines · Tony Lindgren
Quoted 9 lines · Pavel Machek
I added some printks to
motmdm_probe, and they don't appear to be called. I wonder if I'm missing something else in the config? I do have serialroot@devuan:/my/ko# ls -al /dev/ttyS0 crw-rw---- 1 root dialout 4, 64 Dec 23 11:52 /dev/ttyS0but not gsm multiplex:
Quoted 7 lines
Quoted 2 lines
root@devuan:/my/ko# ls -al /dev/gsm* ls: cannot access '/dev/gsm*': No such file or directoryHmm with serdev you should not get
/dev/ttyS0, so maybe you're missing:
CONFIG_SERIAL_DEV_BUS=yCONFIG_SERIAL_DEV_CTRL_TTYPORT=y
I had those enabled.
I also have
CONFIG_SERIAL_OMAP=yCONFIG_SERIAL_OMAP_CONSOLE=y
Quoted 4 lines
Probably the
Kconfigdependency should be forSERIAL_DEV_CTRL_TTYPORTinstead ofSERIAL_DEV_BUSin these patches if that helps.Or else you're missing the serdev related dts changes?
Thanks for the hints, but dts looks ok, too.
We still have
uart1: serial@0 {
compatible = "ti,omap4-uart";
in omap4-l4.dtsi, right? ...
I see that CONFIG_SERIAL_OMAP=y and 8250_omap handles same hardware. Let me try disabling CONFIG_SERIAL_OMAP=y.
Best regards,
Pavel
Oh and you may want to apply this:
drivers/mfd/motorola-mdm.c +1 -1
@@ -1141,5 +1152,5 @@ module_serdev_device_driver(motmdm_driver);MODULE_ALIAS ("platform:motorola-mdm" );MODULE_DESCRIPTION ("Motorola Modem TS 27.010 serdev driver" ); -MODULE_AUTHOR ("Tony Lindgren <[email protected]" ); +MODULE_AUTHOR ("Tony Lindgren <[email protected]>" );MODULE_LICENSE ("GPL v2" );
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Hi!
Quoted 10 lines
Quoted 7 lines
root@devuan:/my/ko# ls -al /dev/ttyS0 crw-rw---- 1 root dialout 4, 64 Dec 23 11:52 /dev/ttyS0but not gsm multiplex:
root@devuan:/my/ko# ls -al /dev/gsm* ls: cannot access '/dev/gsm*': No such file or directoryHmm with serdev you should not get
/dev/ttyS0, so maybe you're missing:
Quoted 7 lines
CONFIG_SERIAL_DEV_BUS=yCONFIG_SERIAL_DEV_CTRL_TTYPORT=yProbably the
Kconfigdependency should be forSERIAL_DEV_CTRL_TTYPORTinstead ofSERIAL_DEV_BUSin these patches if that helps.Or else you're missing the serdev related dts changes?
Seems like I was missing the dts changes. I was using kexec (did not want to replace a working kernel) and that seems to use the old dtb.
gnss0 now seems to work, and I do get some kind of replies from the AT modem. Thanks!
I'll reply to the original email with bad news and more details...
Pavel
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Hi!
Quoted 4 lines
So the little elves have been slowly working to get voice calls working on droid 4 with the mainline kernel. And just in time for the upcoming holidays, it might be possible to call friends and relatives.
Thanks a lot for the Christmas present :-).
Quoted 14 lines
2. Test a voice call
$ minicom -D /dev/motmdm1 # Then Ctrl-a-e to enable local echo AT # Case sensitive AT commands.. :OK # Response uses : as separator.. AT+CFUN=1 # Enable radio +CFUN:OK ~+RSSI=1,9,108,99,0,0,0 ... ATD1234567890 # Dial some phone number D:OK ... ATH # Hang up H:OK
Ok, I really need SMS messages, too.
Fortunately, they are on /dev/motmdm9, in PDU format. Quite logical. And you probably need to acknowledge them, using PDU, too... (because otherwise you'll just get the same SMS over and over and over). Which is also logical, but hard to do from shell/python.
Proper solution involves special support for ofonod...
Fortunately ttyUSB4 still works, so I can still use my old code... and I started logging motmdm1 and 9 to a file as a backup... that should be better than my existing solution. (But I don't get power benefits etc.)
Best regards,
Pavel
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Hi,
Quoted 6 lines · Pavel Machek
Ok, I really need SMS messages, too.
Fortunately, they are on
/dev/motmdm9, in PDU format. Quite logical. And you probably need to acknowledge them, using PDU, too... (because otherwise you'll just get the same SMS over and over and over). Which is also logical, but hard to do from shell/python.
Yeah so I found that Ruby pdu_tools module allows decoding PDUs properly while I did not have much luck with other tools.
So I wrote a hasty script to read SMS, copy it to a Maildir and then ack it:
https://github.com/tmlind/droid4-sms-tools
Quoted 1 line
Proper solution involves special support for ofonod...
Yeah at least we're dealing with standard PDU format now for incoming SMS.
Also looks like there is no status on the modem for these incoming messages as checked with mmcli. I guess the idea with raw PDU access is that the message is delivered directly to the client and then acked instead of being queued in the modem?
Quoted 4 lines
Fortunately ttyUSB4 still works, so I can still use my old code... and I started logging motmdm1 and 9 to a file as a backup... that should be better than my existing solution. (But I don't get power benefits etc.)
So what are you using to ack the received SMS over ttyUSB4?
My logs show that Android uses two different commands for ack. Either AT+GCNMA=1 or AT+CNMA=0,0 gets used depending on something that I have no idea of.. Maybe the network connected?
Sending SMS via /dev/motmdm3 needs move investigation, but at least ModemManager mmcli can be used to create and send SMS.
Hmm or what are you using to send SMS over ttyUSB4? I think you already replied with some of that info earlier but I can't find it..
Oh one more thing, I noticed that on /dev/motmdm1, typing AT+SCRN=0 supresses notifications except for WAKEUP, and then 1 is used to enable them again. That allows the UART to idle instead of getting network status messages every few seconds :)
Regards,
Tony
Hi!
Quoted 7 lines
Yeah so I found that Ruby
pdu_toolsmodule allows decoding PDUs properly while I did not have much luck with other tools.So I wrote a hasty script to read SMS, copy it to a Maildir and then ack it:
Aha, that was quick :-). Interesting, let me take a look.
Quoted 9 lines
Quoted 1 line
Proper solution involves special support for ofonod...
Yeah at least we're dealing with standard PDU format now for incoming SMS.
Also looks like there is no status on the modem for these incoming messages as checked with mmcli. I guess the idea with raw PDU access is that the message is delivered directly to the client and then acked instead of being queued in the modem?
I'm not sure what "directly" and "client" is here, but yes, it seems that motmdm9 just delivers messages, and if you don't ack them, network will just keep retransmitting the message.
Quoted 6 lines
Quoted 4 lines
Fortunately ttyUSB4 still works, so I can still use my old code... and I started logging motmdm1 and 9 to a file as a backup... that should be better than my existing solution. (But I don't get power benefits etc.)
So what are you using to ack the received SMS over ttyUSB4?
I have ofone with direct AT access --
https://github.com/pavelmachek/unicsy_demo/blob/master/ofone/at.py .
And then better solution using ofone + ofonod.
https://github.com/maemo-leste/bugtracker/issues/150
Now, ttyUSB4 provides quite a rich interface, and you can actually select what if you want messages in text and PDU format, and if you want modem to auto-acknowledge messages for you.
(But I don't think all options work).
It may be even possible to select if you want the messages to be queued or delivered directly.
Quoted 3 lines
My logs show that Android uses two different commands for ack. Either AT+GCNMA=1 or AT+CNMA=0,0 gets used depending on something that I have no idea of.. Maybe the network connected?
Not sure what goes on there.
Quoted 6 lines
Sending SMS via
/dev/motmdm3needs move investigation, but at least ModemManager mmcli can be used to create and send SMS.Hmm or what are you using to send SMS over ttyUSB4? I think you already replied with some of that info earlier but I can't find it..
Same as above -- in text mode sending messages is very easy (can be done by hand in minicom, or at.py can do it), and ofonod can already do PDU encoding etc.
Quoted 4 lines
Oh one more thing, I noticed that on
/dev/motmdm1, typing AT+SCRN=0 supresses notifications except for WAKEUP, and then 1 is used to enable them again. That allows the UART to idle instead of getting network status messages every few seconds :)
What kind of battery life do you get with all the optimalizations? IIRC I was getting 7h with ttyUSB4 in use...
Best regards,
Pavel
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Hi,
Quoted 2 lines · Pavel Machek
I have ofone with direct AT access --
https://github.com/pavelmachek/unicsy_demo/blob/master/ofone/at.py .
OK thanks, that shows some of the commands I was wondering about.
Quoted 3 lines
Now, ttyUSB4 provides quite a rich interface, and you can actually select what if you want messages in text and PDU format, and if you want modem to auto-acknowledge messages for you.
So which AT command configures auto-ack of SMS? I don't need it, just wondering what all these commands do.
Quoted 2 lines
What kind of battery life do you get with all the optimalizations? IIRC I was getting 7h with ttyUSB4 in use...
With droid4-pending-mdm-v4.20 branch in the following state:
- UARTs idled
- LCD blanked (well no drivers yet droid4-sms-read.rb)
- MUSB and EHCI USB modules unloaded
- OHCI loaded with all the children in autosuspend via sysfs
- WLAN connected
- busybox acpid stopped (yup, it keeps polling something???)
- MDM6600 online with AT+CFUN=1 on /dev/motmdm1
- MDM6600 notifications disabled with AT+SCRN=0 on /motmdm1
- droid4-sms-read.rb running
I'm seeing droid 4 idle at 119mW according to my power supply. So I guess theoretical battery life would currently be (1785mWh * 3.8V) / 119mW = 57h. But in practise things are not completely idle and monitoring sysfs POWER_SUPPLY_POWER_AVG every 10 seconds I'm seeing something along these 10 samples:
POWER_SUPPLY_POWER_AVG=138938
POWER_SUPPLY_POWER_AVG=134571
POWER_SUPPLY_POWER_AVG=505802
POWER_SUPPLY_POWER_AVG=240412
POWER_SUPPLY_POWER_AVG=134252
POWER_SUPPLY_POWER_AVG=132694
POWER_SUPPLY_POWER_AVG=571569
POWER_SUPPLY_POWER_AVG=132694
POWER_SUPPLY_POWER_AVG=190456
POWER_SUPPLY_POWER_AVG=518288
So the average based on that sampling is about 270mW and the idle time should be about 1785 * 3.8 / 270 = 25h, which is quite usable already :)
Regards,
Tony
Hi!
Quoted 5 lines · Pavel Machek
Quoted 2 lines
I have ofone with direct AT access --
https://github.com/pavelmachek/unicsy_demo/blob/master/ofone/at.py .OK thanks, that shows some of the commands I was wondering about.
I had some luck just googling AT commands. They are somehow standartized.
Quoted 6 lines
Quoted 3 lines
Now, ttyUSB4 provides quite a rich interface, and you can actually select what if you want messages in text and PDU format, and if you want modem to auto-acknowledge messages for you.
So which AT command configures auto-ack of SMS? I don't need it, just wondering what all these commands do.
So this would be "text mode": AT+CMGF=1. And I'd actually expect auto-ack to be the default on ttyUSB4, but in any case this is the command that controls it is: AT+CNMI=1,2,2,1,0.
Quoted 33 lines
Quoted 3 lines
What kind of battery life do you get with all the optimalizations? IIRC I was getting 7h with ttyUSB4 in use...
With droid4-pending-mdm-v4.20 branch in the following state:
- UARTs idled
- LCD blanked (well no drivers yet droid4-sms-read.rb)
- MUSB and EHCI USB modules unloaded
- OHCI loaded with all the children in autosuspend via sysfs
- WLAN connected
- busybox acpid stopped (yup, it keeps polling something???)
- MDM6600 online with AT+CFUN=1 on/dev/motmdm1
- MDM6600 notifications disabled with AT+SCRN=0 on /motmdm1
- droid4-sms-read.rb runningI'm seeing droid 4 idle at 119mW according to my power supply. So I guess theoretical battery life would currently be (1785mWh * 3.8V) / 119mW = 57h. But in practise things are not completely idle and monitoring sysfs
POWER_SUPPLY_POWER_AVGevery 10 seconds I'm seeing something along these 10 samples:POWER_SUPPLY_POWER_AVG=138938
POWER_SUPPLY_POWER_AVG=134571
POWER_SUPPLY_POWER_AVG=505802
POWER_SUPPLY_POWER_AVG=240412
POWER_SUPPLY_POWER_AVG=134252
POWER_SUPPLY_POWER_AVG=132694
POWER_SUPPLY_POWER_AVG=571569
POWER_SUPPLY_POWER_AVG=132694
POWER_SUPPLY_POWER_AVG=190456
POWER_SUPPLY_POWER_AVG=518288
Quoted 3 lines
So the average based on that sampling is about 270mW and the idle time should be about 1785 * 3.8 / 270 = 25h, which is quite usable already :)
So... 57h would be very nice, and even 25h is cool. IIRC original motorola firmware does something like 100hours, and cyanogenmod is closer to 24h...
Note that there's something in the sysfs that allows "precise" measurements. Aha, it is "charge_counter" on droid4.
(I even have some software to do the monitoring and display the graphs. unicsy_demo/monitor/batmond).
Best regards,
Pavel
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Quoted 3 lines · Pavel Machek
So this would be "text mode": AT+CMGF=1. And I'd actually expect auto-ack to be the default on ttyUSB4, but in any case this is the command that controls it is: AT+CNMI=1,2,2,1,0.
OK thanks. These are not available for /dev/motmdm* files AFAIK.
Quoted 3 lines
So... 57h would be very nice, and even 25h is cool. IIRC original motorola firmware does something like 100hours, and cyanogenmod is closer to 24h...
Well I got things down to about 55mW during idle but that still needs more work. So that would be in theory idle battery life of:
(1735mWh * 3.8V) / 55mW = 119.87h (4.99d)
Quoted 5 lines
Note that there's something in the sysfs that allows "precise" measurements. Aha, it is "
charge_counter" on droid4.(I even have some software to do the monitoring and display the graphs. unicsy_demo/monitor/batmond).
Oh nice, I'll give that a try.
Regards,
Tony
Hi,
Quoted 11 lines · Tony Lindgren
With droid4-pending-mdm-v4.20 branch in the following state:
- UARTs idled
- LCD blanked (well no drivers yet droid4-sms-read.rb)
- MUSB and EHCI USB modules unloaded
- OHCI loaded with all the children in autosuspend via sysfs
- WLAN connected
- busybox acpid stopped (yup, it keeps polling something???)
- MDM6600 online with AT+CFUN=1 on/dev/motmdm1
- MDM6600 notifications disabled with AT+SCRN=0 on /motmdm1
- droid4-sms-read.rb running
So I tracked down what I thought is a busybox acpid issue, I was wrong. There's nothing wrong with busybox acpid, sorry for blaming a wrong culprit.
We have acpid keep the device open for /dev/input/by-path/platform-48072000.i2c-event open, which seems to keep atmel_mxt_ts and i2c busy.
Things idle fine after I rmmod atmel_mxt_ts after blanking the screen.
Regards,
Tony
Hi!
Quoted 8 lines · Pavel Machek
Quoted 6 lines
Ok, I really need SMS messages, too.
Fortunately, they are on
/dev/motmdm9, in PDU format. Quite logical. And you probably need to acknowledge them, using PDU, too... (because otherwise you'll just get the same SMS over and over and over). Which is also logical, but hard to do from shell/python.
Quoted 7 lines
Yeah so I found that Ruby
pdu_toolsmodule allows decoding PDUs properly while I did not have much luck with other tools.So I wrote a hasty script to read SMS, copy it to a Maildir and then ack it:
I could not get that one to work.
/var/lib/gems/2.3.0/gems/phone-1.2.3/lib/support.rb:47:in `class_eval': /var/lib/gems/2.3.0/gems/phone-1.2.3/lib/support.rb:47:
`@@{' is not allowed as a class variable name (SyntaxError) /var/lib/gems/2.3.0/gems/phone-1.2.3/lib/support.rb:47: syntax error, unexpected end-of-input
unless defined? @@{:default=>true}
^from /var/lib/gems/2.3.0/gems/phone-1.2.3/lib/support.rb:47:in `block in cattr_accessor'
And I wanted to ask -- did you figure out how to acknowledge the SMSs? +CGNNA does not seem to do the job:
07912470338016...
AT+CGNMA=1
+CGNMA:ERROR=9
Quoted 10 lines
Quoted 4 lines
Fortunately ttyUSB4 still works, so I can still use my old code... and I started logging motmdm1 and 9 to a file as a backup... that should be better than my existing solution. (But I don't get power benefits etc.)
So what are you using to ack the received SMS over ttyUSB4?
My logs show that Android uses two different commands for ack. Either AT+GCNMA=1 or AT+CNMA=0,0 gets used depending on something that I have no idea of.. Maybe the network connected?
I believe I tried both... but for some reason I think you need to paste back "acknowledge PDU"...?
Best regards,
Pavel
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Quoted 20 lines · Pavel Machek
Hi!
Quoted 8 lines · Pavel Machek
Quoted 6 lines
Ok, I really need SMS messages, too.
Fortunately, they are on
/dev/motmdm9, in PDU format. Quite logical. And you probably need to acknowledge them, using PDU, too... (because otherwise you'll just get the same SMS over and over and over). Which is also logical, but hard to do from shell/python.Quoted 7 lines
Yeah so I found that Ruby
pdu_toolsmodule allows decoding PDUs properly while I did not have much luck with other tools.So I wrote a hasty script to read SMS, copy it to a Maildir and then ack it:
I could not get that one to work.
Quoted 8 lines
/var/lib/gems/2.3.0/gems/phone-1.2.3/lib/support.rb:47:in `class_eval':
/var/lib/gems/2.3.0/gems/phone-1.2.3/lib/support.rb:47:
`@@{' is not allowed as a class variable name (SyntaxError)/var/lib/gems/2.3.0/gems/phone-1.2.3/lib/support.rb:47: syntax error, unexpected end-of-inputunless defined? @@{:default=>true} ^from /var/lib/gems/2.3.0/gems/phone-1.2.3/lib/support.rb:47:in `block in
cattr_accessor'
Hmm yeah looking at my notes I also had some issues and did something like this to install git version of phone gem:
$ git clone git://github.com/carr/phone $ cd phone $ sed -i 's/beta//' lib/phone/version.rb $ cd phone $ sed -i 's/1.3.0.beta1/1.2.9/' lib/phone/version.rb $ gem build phone.gemspec $ sudo gem uninstall phone $ sudo gem uninstall bigdecimal -v 1.4.2 # 1.3.4 works $ sudo gem install phone-1.2.9.gem
Quoted 6 lines
And I wanted to ask -- did you figure out how to acknowledge the SMSs? +CGNNA does not seem to do the job:
07912470338016...
AT+CGNMA=1
+CGNMA:ERROR=9
Yeah the scripts in droid4-sms-tools git repo work for me for sending and receiving. They do not work with cdma currently as the format is different.
Maybe you've managed to change the mode of the modem to queue the messages with the at commands to the usb port?
You are reading and writing to /dev/motmdm9 for incoming sms right?
Quoted 3 lines
Quoted 3 lines
My logs show that Android uses two different commands for ack. Either AT+GCNMA=1 or AT+CNMA=0,0 gets used depending on something that I have no idea of.. Maybe the network connected?
I think AT+GCNMA=1 works 3g and AT+CNMA=0,0 with cdma. Or it could be that one of them is just a delayed ack, I don't know.
Regards,
Tony
Quoted 8 lines · Tony Lindgren
Quoted 6 lines · Pavel Machek
And I wanted to ask -- did you figure out how to acknowledge the SMSs? +CGNNA does not seem to do the job:
07912470338016...
AT+CGNMA=1
+CGNMA:ERROR=9
Quoted 8 lines
Yeah the scripts in droid4-sms-tools git repo work for me for sending and receiving. They do not work with cdma currently as the format is different.
Maybe you've managed to change the mode of the modem to queue the messages with the at commands to the usb port?
You are reading and writing to
/dev/motmdm9for incoming sms right?
To debug, you can modprobe n_gsm debug=0xff and you'll see all the packet data in dmesg, maybe email me the dmesg output of your ack command packet data?
Or compare against what Android is doing, you can echo 0x7fffffff to the ts27010 sysfs debug file somewhere to see similar packet data with logcat -b radio.
Regards,
Tony
Hi!
Quoted 6 lines
Yeah the scripts in droid4-sms-tools git repo work for me for sending and receiving. They do not work with cdma currently as the format is different.
Maybe you've managed to change the mode of the modem to queue the messages with the at commands to the usb port?
I did not have ttyUSB open during that boot. I hope this kind of settings does not survive across reboots.
Quoted 1 line
You are reading and writing to
/dev/motmdm9for incoming sms right?
Yes, I think so. Same one where hex-coded PDU comes.
Quoted 6 lines
Quoted 3 lines
Quoted 3 lines
My logs show that Android uses two different commands for ack. Either AT+GCNMA=1 or AT+CNMA=0,0 gets used depending on something that I have no idea of.. Maybe the network connected?
I think AT+GCNMA=1 works 3g and AT+CNMA=0,0 with cdma. Or it could be that one of them is just a delayed ack, I don't know.
Strange. It does not seem to be recognized at all.
Best regards,
Pavel
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html