diff options
author | PaulK <contact@paulk.fr> | 2011-12-30 22:10:54 +0100 |
---|---|---|
committer | PaulK <contact@paulk.fr> | 2011-12-30 22:10:54 +0100 |
commit | 418317e0bf6020456824f0a6d3c3f4bce3e4b5f3 (patch) | |
tree | df2ca32bf4fba500750b203d68b96808ef2d4306 | |
parent | b7d574960edbc33854d59cab7d3be5f4486a47bf (diff) | |
download | external_libsamsung-ipc-418317e0bf6020456824f0a6d3c3f4bce3e4b5f3.zip external_libsamsung-ipc-418317e0bf6020456824f0a6d3c3f4bce3e4b5f3.tar.gz external_libsamsung-ipc-418317e0bf6020456824f0a6d3c3f4bce3e4b5f3.tar.bz2 |
Set negative rc for errors, plus cosmetics
-rw-r--r-- | samsung-ipc/device/crespo/crespo_ipc.c | 35 | ||||
-rw-r--r-- | samsung-ipc/ipc.c | 1 | ||||
-rw-r--r-- | tools/modemctrl.c | 4 |
3 files changed, 17 insertions, 23 deletions
diff --git a/samsung-ipc/device/crespo/crespo_ipc.c b/samsung-ipc/device/crespo/crespo_ipc.c index 0ccc651..5c890c1 100644 --- a/samsung-ipc/device/crespo/crespo_ipc.c +++ b/samsung-ipc/device/crespo/crespo_ipc.c @@ -69,19 +69,19 @@ int wake_unlock(char *lock_name, int len) int crespo_modem_bootstrap(struct ipc_client *client) { - int s3c2410_serial3_fd= -1; - int modem_ctl_fd= -1; + int s3c2410_serial3_fd = -1; + int modem_ctl_fd = -1; /* Control variables. */ - int boot_tries_count=0; - int rc=0; + int boot_tries_count = 0; + int rc = 0; /* Boot variables */ - uint8_t *radio_img_p=NULL; - uint8_t bootcore_version=0; - uint8_t info_size=0; - uint8_t crc_byte=0; - int block_size=0; + uint8_t *radio_img_p = NULL; + uint8_t bootcore_version = 0; + uint8_t info_size = 0; + uint8_t crc_byte = 0; + int block_size = 0; /* s3c2410 serial setup variables. */ struct termios termios; @@ -142,13 +142,6 @@ boot_loop_start: cfsetospeed(&termios, B115200); tcsetattr(s3c2410_serial3_fd, TCSANOW, &termios); -/* - ioctl(s3c2410_serial3_fd, TIOCMGET, &serial); //FIXME - ioctl(s3c2410_serial3_fd, TIOCMSET, &serial); //FIXME - - tcgetattr(s3c2410_serial3_fd, &termios); //FIXME - tcsetattr(s3c2410_serial3_fd, TCSANOW, &termios); //FIXME -*/ /* Send 'AT' in ASCII. */ ipc_client_log(client, "crespo_ipc_bootstrap: sending AT in ASCII"); @@ -312,7 +305,7 @@ error_loop: error: ipc_client_log(client, "%s: something went wrong", __func__); - rc = 1; + rc = -1; exit: ipc_client_log(client, "crespo_ipc_bootstrap: exit"); return rc; @@ -413,13 +406,13 @@ int crespo_ipc_fmt_client_recv(struct ipc_client *client, struct ipc_message_inf if (bread < 0) { ipc_client_log(client, "crespo_ipc_fmt_client_recv: can't receive enough bytes from modem to process incoming response!"); - return 1; + return -1; } if(modem_data.size <= 0 || modem_data.size >= MAX_MODEM_DATA_SIZE || modem_data.data == NULL) { ipc_client_log(client, "crespo_ipc_fmt_client_recv: we retrieve less (or fairly too much) bytes from the modem than we exepected!"); - return 1; + return -1; } resphdr = (struct ipc_header *) modem_data.data; @@ -473,13 +466,13 @@ int crespo_ipc_rfs_client_recv(struct ipc_client *client, struct ipc_message_inf if (bread < 0) { ipc_client_log(client, "crespo_ipc_rfs_client_recv: can't receive enough bytes from modem to process incoming response!"); - return 1; + return -1; } if(modem_data.size <= 0 || modem_data.size >= MAX_MODEM_DATA_SIZE || modem_data.data == NULL) { ipc_client_log(client, "crespo_ipc_rfs_client_recv: we retrieve less (or fairly too much) bytes from the modem than we exepected!"); - return 1; + return -1; } response->mseq = 0; diff --git a/samsung-ipc/ipc.c b/samsung-ipc/ipc.c index 77e5d97..15e2645 100644 --- a/samsung-ipc/ipc.c +++ b/samsung-ipc/ipc.c @@ -82,6 +82,7 @@ int ipc_client_free(struct ipc_client *client) free(client->handlers); free(client); client = NULL; + return 0; } diff --git a/tools/modemctrl.c b/tools/modemctrl.c index 168c95e..dc7eaaa 100644 --- a/tools/modemctrl.c +++ b/tools/modemctrl.c @@ -396,7 +396,7 @@ int modem_read_loop(struct ipc_client *client) { rc = ipc_client_recv(client, &resp); - if(rc > 0) { + if(rc < 0) { printf("[E] Can't RECV from modem: please run this again\n"); break; } @@ -533,7 +533,7 @@ int main(int argc, char *argv[]) } else if(strncmp(argv[optind], "start", 5) == 0) { printf("[0] Starting modem on FMT client\n"); rc = modem_start(client_fmt); - if(rc > 0) { + if(rc < 0) { printf("[E] Something went wrong\n"); modem_stop(client_fmt); return 1; |