xnux.eu - site map - news

Modem on A711

Enabling and disabling power to the modem

Modem power is handled by a kernel driver.

It can be controlled using this program:

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <fcntl.h>
#include <unistd.h>
#include <sys/ioctl.h>

#define A711_IOCTL_RESET _IO('A', 0)
#define A711_IOCTL_POWERUP _IO('A', 1)
#define A711_IOCTL_POWERDN _IO('A', 2)
#define A711_IOCTL_STATUS _IOR('A', 3, int)

int main(int ac, char* av[])
{
        int ret;

        if (ac <= 1) {
                printf("Usage: %s [1|0]", av[0]);
                return 1;
        }

        int fd = open("/dev/pwr-modem", O_RDWR);
        if (fd < 0) {
                perror("power control open failed\n");
                exit(1);
        }
        
        ret = ioctl(fd, av[1][0] == '1' ? A711_IOCTL_POWERUP : A711_IOCTL_POWERDN, 0);
        if (ret < 0) {
                perror("power up failed\n");
                exit(1);
        }

        return 0;       
}
        

Or via sysfs (since 5.6):

# request powerup
echo 1 > /sys/devices/platform/modem/powered
# request powerdown
echo 0 > /sys/devices/platform/modem/powered
# read power status (changes only after power state transition is complete)
cat /sys/devices/platform/modem/powered

Connecting to the modem

You can connect to the modem once it's powered up via:

screen /dev/ttyUSB1 115200

Disconnect by CTRL+a k.

Setting up the modem for voice calling

The modem doesn't support voice calls, according to the datasheet. Well, the datasheet is lying. I reverse engineered Android zte ril implementation and it simply uses:

AT+ZVCF=1

which presumably means Zte Voice Call Function enable. :) And afterwards you can redirect output to a speaker via AT+SPEAKER=1 and perform voice calls.

AT+ZVCF=1 can only be found in once comment on some chinese forum and only if you search specifically for this command. Apparently the manufacturer doesn't advertise this undocumented option very much.

Afterwards you can answer a call with ATA, or make a call ATDsomenumber;, or hangup with ATH.

That's it. ;)

Voice call audio routing

Modem audio is routed from MIC1 and EAR1 differential i/o on the modem to the LINE IN and LINE OUT on AC100 codec.

It's still possible to implement the flexible audio routing for calls with independent recording/cap­ture for local/remote audio inputs/outputs without interference. Though it's slightly more challenging and has some small limitations.

See the larger image here