From 743ede5407a6e8b8baeb9c5b10cfc80d428ae847 Mon Sep 17 00:00:00 2001 From: Simon Busch Date: Sun, 9 Oct 2011 18:43:28 +0200 Subject: Rework API of this library to integrate better with other environments than Android * send/recv is now done outside this library; the user has to provide callbacks for send and recv * it's now possible to create more than one ipc client as every ipc API method needs an object of type ipc_client (which is the context it operates in) * there are now two different client types for the crespo machine: RFS and FMT * disabled h1 client for now * removed power on/off functionality; should be done by another userland component with handling the correct sysfs nodes rather than dealing with ioctls for this. * updated vala interface description file to reflect API changes * various source code cleanups Signed-off-by: Simon Busch --- tools/modemctrl.c | 53 ++++++++++++++++++++++------------------------------- 1 file changed, 22 insertions(+), 31 deletions(-) (limited to 'tools') diff --git a/tools/modemctrl.c b/tools/modemctrl.c index e7758a7..14237eb 100644 --- a/tools/modemctrl.c +++ b/tools/modemctrl.c @@ -21,43 +21,34 @@ #include #include #include - #include void print_help() { - printf("usage: modemctrl \n"); - printf("commands:\n"); - printf("\tbootstrap bootstrap modem to be ready for processing\n"); - printf("\tpower-on power on the modem\n"); - printf("\tpower-off power off the modem\n"); + printf("usage: modemctrl \n"); + printf("commands:\n"); + printf("\tbootstrap bootstrap modem to be ready for processing\n"); + printf("\tpower-on power on the modem\n"); + printf("\tpower-off power off the modem\n"); } int main(int argc, char *argv[]) { - struct ipc_response response; - int error; - - if (argc != 2) { - print_help(); - exit(1); - } - - ipc_init(IPC_CLIENT_TYPE_CRESPO); - - if (!strncmp(argv[1], "bootstrap", 9)) { - ipc_bootstrap(); - } - else if (!strncmp(argv[1], "power-on", 8)) { - ipc_open(); - ipc_power_on(); - ipc_close(); - } - else if (!strncmp(argv[1], "power-off", 9)) { - ipc_open(); - ipc_power_off(); - ipc_close(); - } - - return 0; + struct ipc_client *client; + int error; + + if (argc != 2) { + print_help(); + exit(1); + } + + client = ipc_client_new(IPC_CLIENT_TYPE_CRESPO_FMT); + + if (!strncmp(argv[1], "bootstrap", 9)) { + ipc_client_bootstrap_modem(client); + } + + ipc_client_free(client); + + return 0; } -- cgit v1.1