the-modem-distro / pinephone_modem_sdk

Pinephone Modem SDK: Tools to build your own bootloader, kernel and rootfs
GNU General Public License v3.0
595 stars 64 forks source link

make get_recordings simpler #172

Closed bgkillas closed 1 year ago

bgkillas commented 1 year ago

the A*.wav is to get rid of wave.wav which apears in /tmp sometimes i think from call me

also this seems incredibly prone to overwritting files because the file names are not in actual time they are in time since the modems boot at least for me but i wont publish a fix for that rn

Biktorgj commented 1 year ago

Watch out for the "manual" call recordings! This change won't download the calls you tell it to manually record via "record this call" or "record next call". Those are called MANUAL-DATE-NUMBER

Regarding the date, the modem attempts to sync the time for 5 minutes at boot after entering the PIN. If it doesn't succeed, the date will be stuck in 2022-01-01. If your carrier doesn't send a date (or an incorrect one, like Mint), you can use a script on the PinePhone to force-set the date to the modem when it boots. Check this for a sample script

bgkillas commented 1 year ago

mmmm well hopefully it does not effect me otherwise that my carrier does not set time nicely because im too lazy to manually set it ill probably just change the names of the recordings

bgkillas commented 1 year ago

would you have any idea how to do this without adb i would like to implement this in sxmo but adding android-tools as a dependency sounds a bit silly to me

Biktorgj commented 1 year ago

would you have any idea how to do this without adb i would like to implement this in sxmo but adding android-tools as a dependency sounds a bit silly to me

It's possible to add a CDC ethernet gadget into USB but... then you confuse the hell out of ModemManager, and things start to break after suspend (and you'd need to start worrying about passwords, ssh etc.). That's why ADB is still there and I haven't switched to anything else

Merging this, thanks a lot for the help!

RoganDawes commented 1 year ago

For what it is worth, you could possibly tunnel ssh over a serial port/uart and access the files using scp.

About the only thing that is needed is a tool like SSLH, that listens to the serial port on the modem side, and invokes either sshd if it sees an ssh banner/handshake, or else getty/sh/whatever if it sees anything else. Then set up sshd with a frequent keep-alive so that it exits as soon after the client disconnects as possible (given that there are no actual socket closed events to tell you that). This would allow you to access the modem from the phone side using something like "ssh -o 'ProxyCmd socat - /dev/ttyUSB0' root@modem", but also using your preferred serial port tool, like picocom, minicom or whatever.

Biktorgj commented 1 year ago

That would be a total mess :) On one side, ModemManager keeps all the ports open all the time and sometimes sends arbitrary commands through the AT interface (so you'd have to stop it), and on the other, the modem spits out stuff to the serial ports whenever it wants. For example, whenever a SMS/MMS arrives, the modem will send out a URC indicating there's a new message through all the serial ports (even the GPS!) and won't care if there's something else moving through it.

I could cut communication from the baseband to the GPS port on request, and let something else be piped through it, but that won't stop ModemManager from messing with the port, and things would break if something enables location and is expecting something in that port. The rest of the emulated serial ports from the modem aren't available in the userspace at all, they are handled by the kernel and they bind to the baseband

RoganDawes commented 1 year ago

That's unfortunate 😬 I'd really like to see someone build that program 😂

Wonder if there is a different kind of usb gadget we could use that would not have the same problems. Eg lp0 would not be identified by ModemManager, but has similar characteristics to a serial port. It's a bit of a hack, unfortunately.

You can obviously configure ModemManager to ignore a port from the host side. But it sounds like the problem is more on the modem side, if it insists on spamming all ports.