diff options
author | Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org> | 2020-02-20 18:27:28 +0100 |
---|---|---|
committer | Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org> | 2020-02-21 00:53:50 +0100 |
commit | e03710c1f462f74ac6bea5f03047feae9a81a866 (patch) | |
tree | 77d0e06d600ffaa269922edd289e45c528987e62 | |
parent | 9b755d1be592d17be3e84f73fc444441d6cd4082 (diff) | |
download | hardware_replicant_libsamsung-ipc-e03710c1f462f74ac6bea5f03047feae9a81a866.tar.gz hardware_replicant_libsamsung-ipc-e03710c1f462f74ac6bea5f03047feae9a81a866.tar.bz2 hardware_replicant_libsamsung-ipc-e03710c1f462f74ac6bea5f03047feae9a81a866.zip |
device boot handlers: pass it the ipc_client struct
This enables to use logging inside the handlers:
ipc_client_log needs access to the ipc_client struct to
work.
At this point the ipc_client struct is already available,
so it is safe to do that.
Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
-rw-r--r-- | configure.ac | 2 | ||||
-rw-r--r-- | include/samsung-ipc.h | 3 | ||||
-rw-r--r-- | samsung-ipc/devices/aries/aries.c | 10 | ||||
-rw-r--r-- | samsung-ipc/devices/crespo/crespo.c | 6 | ||||
-rw-r--r-- | samsung-ipc/devices/galaxys2/galaxys2.c | 6 | ||||
-rw-r--r-- | samsung-ipc/devices/i9300/i9300.c | 6 | ||||
-rw-r--r-- | samsung-ipc/devices/maguro/maguro.c | 6 | ||||
-rw-r--r-- | samsung-ipc/devices/n5100/n5100.c | 6 | ||||
-rw-r--r-- | samsung-ipc/devices/n7100/n7100.c | 6 | ||||
-rw-r--r-- | samsung-ipc/devices/piranha/piranha.c | 6 | ||||
-rw-r--r-- | samsung-ipc/ipc.c | 7 | ||||
-rw-r--r-- | samsung-ipc/ipc.h | 4 |
12 files changed, 43 insertions, 25 deletions
diff --git a/configure.ac b/configure.ac index d65907a..8c01dab 100644 --- a/configure.ac +++ b/configure.ac @@ -1,4 +1,4 @@ -AC_INIT([libsamsung-ipc], [0.3.1], [contact@replicant.us], [libsamsung-ipc]) +AC_INIT([libsamsung-ipc], [0.4.0], [contact@replicant.us], [libsamsung-ipc]) AC_CONFIG_SRCDIR([Makefile.am]) AC_CONFIG_HEADERS(config.h) AM_INIT_AUTOMAKE([dist-bzip2 subdir-objects]) diff --git a/include/samsung-ipc.h b/include/samsung-ipc.h index 1202da3..f78cc74 100644 --- a/include/samsung-ipc.h +++ b/include/samsung-ipc.h @@ -77,7 +77,8 @@ int ipc_client_transport_handlers_register(struct ipc_client *client, int (*poll)(void *transport_data, struct ipc_poll_fds *fds, struct timeval *timeout), void *transport_data); int ipc_client_power_handlers_register(struct ipc_client *client, - int (*power_on)(void *power_data), int (*power_off)(void *power_data), + int (*power_on)(struct ipc_client *client, void *power_data), + int (*power_off)(struct ipc_client *client, void *power_data), void *power_data); int ipc_client_gprs_handlers_register(struct ipc_client *client, int (*gprs_activate)(void *gprs_data, unsigned int cid), diff --git a/samsung-ipc/devices/aries/aries.c b/samsung-ipc/devices/aries/aries.c index f0fe41b..2b356bb 100644 --- a/samsung-ipc/devices/aries/aries.c +++ b/samsung-ipc/devices/aries/aries.c @@ -86,7 +86,7 @@ int aries_boot(struct ipc_client *client) } ipc_client_log(client, "Turned modem network iface down"); - rc = client->handlers->power_on(client->handlers->power_data); + rc = client->handlers->power_on(client, client->handlers->power_data); if (rc < 0) { ipc_client_log(client, "Powering the modem off failed"); goto error; @@ -95,7 +95,7 @@ int aries_boot(struct ipc_client *client) usleep(1000); - rc = client->handlers->power_off(client->handlers->power_data); + rc = client->handlers->power_off(client, client->handlers->power_data); if (rc < 0) { ipc_client_log(client, "Powering the modem on failed"); goto error; @@ -703,7 +703,8 @@ int aries_poll(void *data, struct ipc_poll_fds *fds, struct timeval *timeout) return rc; } -int aries_power_on(__attribute__((unused)) void *data) +int aries_power_on(__attribute__((unused)) struct ipc_client *client, + __attribute__((unused)) void *data) { char buffer[] = "on\n"; int value; @@ -725,7 +726,8 @@ int aries_power_on(__attribute__((unused)) void *data) return 0; } -int aries_power_off(__attribute__((unused)) void *data) +int aries_power_off(__attribute__((unused)) struct ipc_client *client, + __attribute__((unused)) void *data) { char buffer[] = "off\n"; int value; diff --git a/samsung-ipc/devices/crespo/crespo.c b/samsung-ipc/devices/crespo/crespo.c index 206f43b..b89f3cf 100644 --- a/samsung-ipc/devices/crespo/crespo.c +++ b/samsung-ipc/devices/crespo/crespo.c @@ -460,7 +460,8 @@ int crespo_poll(void *data, struct ipc_poll_fds *fds, struct timeval *timeout) return rc; } -int crespo_power_on(__attribute__((unused)) void *data) +int crespo_power_on(__attribute__((unused)) struct ipc_client *client, + __attribute__((unused)) void *data) { int fd; int rc; @@ -479,7 +480,8 @@ int crespo_power_on(__attribute__((unused)) void *data) return 0; } -int crespo_power_off(__attribute__((unused)) void *data) +int crespo_power_off(__attribute__((unused)) struct ipc_client *client, + __attribute__((unused)) void *data) { int fd; int rc; diff --git a/samsung-ipc/devices/galaxys2/galaxys2.c b/samsung-ipc/devices/galaxys2/galaxys2.c index 2b0ad0d..d91c1a0 100644 --- a/samsung-ipc/devices/galaxys2/galaxys2.c +++ b/samsung-ipc/devices/galaxys2/galaxys2.c @@ -311,12 +311,14 @@ int galaxys2_poll(void *data, struct ipc_poll_fds *fds, struct timeval *timeout) return rc; } -int galaxys2_power_on(__attribute__((unused)) void *data) +int galaxys2_power_on(__attribute__((unused)) struct ipc_client *client, + __attribute__((unused)) void *data) { return 0; } -int galaxys2_power_off(__attribute__((unused)) void *data) +int galaxys2_power_off(__attribute__((unused)) struct ipc_client *client, + __attribute__((unused)) void *data) { int fd; int rc; diff --git a/samsung-ipc/devices/i9300/i9300.c b/samsung-ipc/devices/i9300/i9300.c index dba03e1..1b894d6 100644 --- a/samsung-ipc/devices/i9300/i9300.c +++ b/samsung-ipc/devices/i9300/i9300.c @@ -305,12 +305,14 @@ int i9300_poll(void *data, struct ipc_poll_fds *fds, struct timeval *timeout) return rc; } -int i9300_power_on(__attribute__((unused)) void *data) +int i9300_power_on(__attribute__((unused)) struct ipc_client *client, + __attribute__((unused)) void *data) { return 0; } -int i9300_power_off(__attribute__((unused)) void *data) +int i9300_power_off(__attribute__((unused)) struct ipc_client *client, + __attribute__((unused)) void *data) { int fd; int rc; diff --git a/samsung-ipc/devices/maguro/maguro.c b/samsung-ipc/devices/maguro/maguro.c index d781232..eee0c0a 100644 --- a/samsung-ipc/devices/maguro/maguro.c +++ b/samsung-ipc/devices/maguro/maguro.c @@ -289,12 +289,14 @@ int maguro_poll(void *data, struct ipc_poll_fds *fds, struct timeval *timeout) return rc; } -int maguro_power_on(__attribute__((unused)) void *data) +int maguro_power_on(__attribute__((unused)) struct ipc_client *client, + __attribute__((unused)) void *data) { return 0; } -int maguro_power_off(__attribute__((unused)) void *data) +int maguro_power_off(__attribute__((unused)) struct ipc_client *client, + __attribute__((unused)) void *data) { int fd; int rc; diff --git a/samsung-ipc/devices/n5100/n5100.c b/samsung-ipc/devices/n5100/n5100.c index 044ead8..bff8cf4 100644 --- a/samsung-ipc/devices/n5100/n5100.c +++ b/samsung-ipc/devices/n5100/n5100.c @@ -306,12 +306,14 @@ int n5100_poll(void *data, struct ipc_poll_fds *fds, struct timeval *timeout) return rc; } -int n5100_power_on(__attribute__((unused)) void *data) +int n5100_power_on(__attribute__((unused)) struct ipc_client *client, + __attribute__((unused)) void *data) { return 0; } -int n5100_power_off(__attribute__((unused)) void *data) +int n5100_power_off(__attribute__((unused)) struct ipc_client *client, + __attribute__((unused)) void *data) { int fd; int rc; diff --git a/samsung-ipc/devices/n7100/n7100.c b/samsung-ipc/devices/n7100/n7100.c index 70dae5d..08f1652 100644 --- a/samsung-ipc/devices/n7100/n7100.c +++ b/samsung-ipc/devices/n7100/n7100.c @@ -305,12 +305,14 @@ int n7100_poll(void *data, struct ipc_poll_fds *fds, struct timeval *timeout) return rc; } -int n7100_power_on(__attribute__((unused)) void *data) +int n7100_power_on(__attribute__((unused)) struct ipc_client *client, + __attribute__((unused)) void *data) { return 0; } -int n7100_power_off(__attribute__((unused)) void *data) +int n7100_power_off(__attribute__((unused)) struct ipc_client *client, + __attribute__((unused)) void *data) { int fd; int rc; diff --git a/samsung-ipc/devices/piranha/piranha.c b/samsung-ipc/devices/piranha/piranha.c index 5a6fcda..6360be2 100644 --- a/samsung-ipc/devices/piranha/piranha.c +++ b/samsung-ipc/devices/piranha/piranha.c @@ -254,12 +254,14 @@ int piranha_poll(void *data, struct ipc_poll_fds *fds, struct timeval *timeout) return rc; } -int piranha_power_on(__attribute__((unused)) void *data) +int piranha_power_on(__attribute__((unused)) struct ipc_client *client, + __attribute__((unused)) void *data) { return 0; } -int piranha_power_off(__attribute__((unused)) void *data) +int piranha_power_off(__attribute__((unused)) struct ipc_client *client, + __attribute__((unused)) void *data) { int fd; int rc; diff --git a/samsung-ipc/ipc.c b/samsung-ipc/ipc.c index 2aaaff6..49573eb 100644 --- a/samsung-ipc/ipc.c +++ b/samsung-ipc/ipc.c @@ -283,7 +283,8 @@ int ipc_client_transport_handlers_register(struct ipc_client *client, } int ipc_client_power_handlers_register(struct ipc_client *client, - int (*power_on)(void *power_data), int (*power_off)(void *power_data), + int (*power_on)(struct ipc_client *client, void *power_data), + int (*power_off)(struct ipc_client *client, void *power_data), void *power_data) { if (client == NULL || client->handlers == NULL) @@ -430,7 +431,7 @@ int ipc_client_power_on(struct ipc_client *client) return -1; } - return client->handlers->power_on(client->handlers->power_data); + return client->handlers->power_on(client, client->handlers->power_data); } int ipc_client_power_off(struct ipc_client *client) @@ -440,7 +441,7 @@ int ipc_client_power_off(struct ipc_client *client) return -1; } - return client->handlers->power_off(client->handlers->power_data); + return client->handlers->power_off(client, client->handlers->power_data); } int ipc_client_gprs_activate(struct ipc_client *client, unsigned int cid) diff --git a/samsung-ipc/ipc.h b/samsung-ipc/ipc.h index fc765fc..b52707b 100644 --- a/samsung-ipc/ipc.h +++ b/samsung-ipc/ipc.h @@ -49,8 +49,8 @@ struct ipc_client_handlers { void *transport_data; /* Power handlers */ - int (*power_on)(void *power_data); - int (*power_off)(void *power_data); + int (*power_on)(struct ipc_client *client, void *power_data); + int (*power_off)(struct ipc_client *client, void *power_data); void *power_data; |