aboutsummaryrefslogtreecommitdiffstats
path: root/include/samsung-ipc.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/samsung-ipc.h')
-rw-r--r--include/samsung-ipc.h86
1 files changed, 42 insertions, 44 deletions
diff --git a/include/samsung-ipc.h b/include/samsung-ipc.h
index 13370c8..669d4d8 100644
--- a/include/samsung-ipc.h
+++ b/include/samsung-ipc.h
@@ -3,6 +3,7 @@
*
* Copyright (C) 2010-2011 Joerie de Gram <j.de.gram@gmail.com>
* Copyright (C) 2012 Simon Busch <morphis@gravedo.de>
+ * Copyright (C) 2014 Paul Kocialkowski <contact@paulk.fr>
*
* libsamsung-ipc is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -40,67 +41,58 @@ struct ipc_handlers;
struct ipc_fmt_header;
struct ipc_rfs_header;
-struct ipc_message_info {
+struct ipc_message {
unsigned char mseq;
unsigned char aseq;
- unsigned char group;
- unsigned char index;
- unsigned short cmd;
+ unsigned short command;
unsigned char type;
- unsigned int length;
- unsigned char *data;
+ void *data;
+ size_t size;
};
struct ipc_client_gprs_capabilities {
- int port_list;
- int cid_max;
+ int cid_count;
};
/*
* Helpers
*/
-struct ipc_client *ipc_client_create(int client_type);
-int ipc_client_destroy(struct ipc_client *client);
+int ipc_device_detect(void);
-void ipc_client_log(struct ipc_client *client, const char *message, ...);
-int ipc_client_set_log_callback(struct ipc_client *client,
- void (*log_callback)(void *log_data, const char *message), void *log_data);
+struct ipc_client *ipc_client_create(int type);
+int ipc_client_destroy(struct ipc_client *client);
-int ipc_client_set_transport_handlers(struct ipc_client *client,
+int ipc_client_transport_handlers_register(struct ipc_client *client,
int (*open)(void *transport_data, int type),
int (*close)(void *transport_data),
- int (*read)(void *transport_data, void *buffer, unsigned int length),
- int (*write)(void *transport_data, void *buffer, unsigned int length),
+ int (*read)(void *transport_data, void *data, size_t size),
+ int (*write)(void *transport_data, const void *data, size_t size),
int (*poll)(void *transport_data, struct timeval *timeout),
void *transport_data);
-int ipc_client_set_power_handlers(struct ipc_client *client,
- int (*power_on)(void *power_data),
- int (*power_off)(void *power_data),
+int ipc_client_power_handlers_register(struct ipc_client *client,
+ int (*power_on)(void *power_data), int (*power_off)(void *power_data),
void *power_data);
-int ipc_client_set_gprs_handlers(struct ipc_client *client,
+int ipc_client_gprs_handlers_register(struct ipc_client *client,
int (*gprs_activate)(void *gprs_data, int cid),
- int (*gprs_deactivate)(void *gprs_data, int cid),
- void *gprs_data);
+ int (*gprs_deactivate)(void *gprs_data, int cid), void *gprs_data);
+
+void ipc_client_log(struct ipc_client *client, const char *message, ...);
+int ipc_client_log_callback_register(struct ipc_client *client,
+ void (*log_callback)(void *log_data, const char *message), void *log_data);
-int ipc_client_bootstrap(struct ipc_client *client);
-int ipc_client_send(struct ipc_client *client, const unsigned short command,
- const char type, unsigned char *data, const int length, unsigned char mseq);
-int ipc_client_recv(struct ipc_client *client,
- struct ipc_message_info *response);
-void ipc_client_response_free(struct ipc_client *client,
- struct ipc_message_info *response);
+int ipc_client_boot(struct ipc_client *client);
+int ipc_client_send(struct ipc_client *client, unsigned char mseq,
+ unsigned short command, unsigned char type, const void *data, size_t size);
+int ipc_client_recv(struct ipc_client *client, struct ipc_message *message);
int ipc_client_open(struct ipc_client *client);
int ipc_client_close(struct ipc_client *client);
int ipc_client_poll(struct ipc_client *client, struct timeval *timeout);
-
int ipc_client_power_on(struct ipc_client *client);
int ipc_client_power_off(struct ipc_client *client);
-
int ipc_client_gprs_activate(struct ipc_client *client, int cid);
int ipc_client_gprs_deactivate(struct ipc_client *client, int cid);
-
int ipc_client_data_create(struct ipc_client *client);
int ipc_client_data_destroy(struct ipc_client *client);
@@ -116,18 +108,24 @@ char *ipc_client_nv_data_secret(struct ipc_client *client);
size_t ipc_client_nv_data_size(struct ipc_client *client);
size_t ipc_client_nv_data_chunk_size(struct ipc_client *client);
-const char *ipc_response_type_to_str(int type);
-const char *ipc_request_type_to_str(int type);
-const char *ipc_command_to_str(int command);
-void ipc_client_hex_dump(struct ipc_client *client, void *data, int size);
-void ipc_client_log_recv(struct ipc_client *client,
- struct ipc_message_info *response, const char *prefix);
-void ipc_client_log_send(struct ipc_client *client,
- struct ipc_message_info *request, const char *prefix);
-void ipc_fmt_header_fill(struct ipc_fmt_header *header, struct ipc_message_info *message);
-void ipc_fmt_message_fill(struct ipc_fmt_header *header, struct ipc_message_info *message);
-void ipc_rfs_header_fill(struct ipc_rfs_header *header, struct ipc_message_info *message);
-void ipc_rfs_message_fill(struct ipc_rfs_header *header, struct ipc_message_info *message);
+const char *ipc_request_type_string(unsigned char type);
+const char *ipc_response_type_string(unsigned char type);
+const char *ipc_command_string(unsigned short command);
+
+void ipc_hex_dump(struct ipc_client *client, const void *data, size_t size);
+void ipc_client_log_recv(struct ipc_client *client, struct ipc_message *message,
+ const char *prefix);
+void ipc_client_log_send(struct ipc_client *client, struct ipc_message *message,
+ const char *prefix);
+
+int ipc_fmt_header_setup(struct ipc_fmt_header *header,
+ const struct ipc_message *message);
+int ipc_fmt_message_setup(const struct ipc_fmt_header *header,
+ struct ipc_message *message);
+int ipc_rfs_header_setup(struct ipc_rfs_header *header,
+ const struct ipc_message *message);
+int ipc_rfs_message_setup(const struct ipc_rfs_header *header,
+ struct ipc_message *message);
/*
* Samsung-IPC protocol