diff options
author | Paul Kocialkowski <contact@paulk.fr> | 2012-11-11 12:32:40 +0100 |
---|---|---|
committer | Paul Kocialkowski <contact@paulk.fr> | 2012-11-11 12:32:40 +0100 |
commit | d9622e4a4bcee8132ff3dfe89beed5399f3bdeb8 (patch) | |
tree | 60054b6342eb04620283cf7a9fcb56963dc5dd2e /samsung-ipc | |
parent | f722771a3837793c397d1db5075b8e8bd2906fed (diff) | |
download | external_libsamsung-ipc-d9622e4a4bcee8132ff3dfe89beed5399f3bdeb8.zip external_libsamsung-ipc-d9622e4a4bcee8132ff3dfe89beed5399f3bdeb8.tar.gz external_libsamsung-ipc-d9622e4a4bcee8132ff3dfe89beed5399f3bdeb8.tar.bz2 |
GPRS: Pass CID to activate/deactivate functions
Aries: Use CID to activate/deactivate the corresponding iface
Change-Id: Ifd153eda59404921bc6ea12d27f94d5aee7b06ff
Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
Diffstat (limited to 'samsung-ipc')
-rw-r--r-- | samsung-ipc/device/aries/aries_ipc.c | 23 | ||||
-rw-r--r-- | samsung-ipc/ipc.c | 8 | ||||
-rw-r--r-- | samsung-ipc/ipc_private.h | 4 |
3 files changed, 23 insertions, 12 deletions
diff --git a/samsung-ipc/device/aries/aries_ipc.c b/samsung-ipc/device/aries/aries_ipc.c index fa9a5fb..9e095d6 100644 --- a/samsung-ipc/device/aries/aries_ipc.c +++ b/samsung-ipc/device/aries/aries_ipc.c @@ -38,6 +38,7 @@ #include <asm/types.h> #include <mtd/mtd-abi.h> #include <assert.h> +#include <string.h> #include <radio.h> @@ -796,17 +797,22 @@ int aries_ipc_power_off(void *data) //TODO: there are also suspend/resume nodes -int aries_ipc_gprs_activate(void *data) +int aries_ipc_gprs_activate(void *data, int cid) { int fd = open("/sys/class/net/svnet0/pdp/activate", O_RDWR); - char activate_data[] = "1\n"; + char *activate_data = NULL; int rc; if(fd < 0) return -1; - rc = write(fd, activate_data, sizeof(activate_data) - 1); + asprintf(&activate_data, "%d\n", cid); + if(activate_data == NULL) + return -1; + + rc = write(fd, activate_data, strlen(activate_data)); + free(activate_data); close(fd); if(rc < 0) @@ -816,17 +822,22 @@ int aries_ipc_gprs_activate(void *data) } -int aries_ipc_gprs_deactivate(void *data) +int aries_ipc_gprs_deactivate(void *data, int cid) { int fd = open("/sys/class/net/svnet0/pdp/deactivate", O_RDWR); - char deactivate_data[] = "1\n"; + char *deactivate_data = NULL; int rc; if(fd < 0) return -1; - rc = write(fd, deactivate_data, sizeof(deactivate_data) - 1); + asprintf(&deactivate_data, "%d\n", cid); + if(deactivate_data == NULL) + return -1; + + rc = write(fd, deactivate_data, strlen(deactivate_data)); + free(deactivate_data); close(fd); if(rc < 0) diff --git a/samsung-ipc/ipc.c b/samsung-ipc/ipc.c index 14d52c3..e8afd94 100644 --- a/samsung-ipc/ipc.c +++ b/samsung-ipc/ipc.c @@ -404,24 +404,24 @@ int ipc_client_gprs_handlers_available(struct ipc_client *client) return 0; } -int ipc_client_gprs_activate(struct ipc_client *client) +int ipc_client_gprs_activate(struct ipc_client *client, int cid) { if (client == NULL || client->handlers == NULL || client->handlers->gprs_activate == NULL) return -1; - return client->handlers->gprs_activate(client->handlers->gprs_activate_data); + return client->handlers->gprs_activate(client->handlers->gprs_activate_data, cid); } -int ipc_client_gprs_deactivate(struct ipc_client *client) +int ipc_client_gprs_deactivate(struct ipc_client *client, int cid) { if (client == NULL || client->handlers == NULL || client->handlers->gprs_deactivate == NULL) return -1; - return client->handlers->gprs_deactivate(client->handlers->gprs_deactivate_data); + return client->handlers->gprs_deactivate(client->handlers->gprs_deactivate_data, cid); } char *ipc_client_gprs_get_iface(struct ipc_client *client, int cid) diff --git a/samsung-ipc/ipc_private.h b/samsung-ipc/ipc_private.h index 90a0f7c..406bf9d 100644 --- a/samsung-ipc/ipc_private.h +++ b/samsung-ipc/ipc_private.h @@ -48,9 +48,9 @@ struct ipc_handlers { void *power_off_data; /* GPRS handlers */ - ipc_handler_cb gprs_activate; + int (*gprs_activate)(void *io_data, int cid); void *gprs_activate_data; - ipc_handler_cb gprs_deactivate; + int (*gprs_deactivate)(void *io_data, int cid); void *gprs_deactivate_data; /* Handlers common data*/ |