summaryrefslogtreecommitdiff
path: root/input
diff options
context:
space:
mode:
authorClaudio Takahasi <claudio.takahasi@openbossa.org>2007-03-22 13:34:37 +0000
committerClaudio Takahasi <claudio.takahasi@openbossa.org>2007-03-22 13:34:37 +0000
commit07701210404d9bc7153af287cb58e7ea329fd8a8 (patch)
tree64aa2113808e2e4b8c49ac1bd32ce55175be4e6c /input
parent986c7768de2527e80d988357663ce7843f7e8308 (diff)
downloadbluez-07701210404d9bc7153af287cb58e7ea329fd8a8.tar.gz
input: minor code standard fixes
Diffstat (limited to 'input')
-rw-r--r--input/device.c58
-rw-r--r--input/device.h2
-rw-r--r--input/manager.c50
3 files changed, 55 insertions, 55 deletions
diff --git a/input/device.c b/input/device.c
index 45c7fa4ad..3283e657f 100644
--- a/input/device.c
+++ b/input/device.c
@@ -61,12 +61,12 @@
#define UPDOWN_ENABLED 1
-static struct input_device *input_device_new(bdaddr_t *src, bdaddr_t *dst)
+static struct device *device_new(bdaddr_t *src, bdaddr_t *dst)
{
- struct input_device *idev;
+ struct device *idev;
uint32_t cls;
- idev = g_new0(struct input_device, 1);
+ idev = g_new0(struct device, 1);
bacpy(&idev->src, src);
bacpy(&idev->dst, dst);
@@ -94,7 +94,7 @@ static void pending_connect_free(struct pending_connect *pc)
g_free(pc);
}
-static void input_device_free(struct input_device *idev)
+static void device_free(struct device *idev)
{
if (!idev)
return;
@@ -344,8 +344,8 @@ failed:
return FALSE;
}
-static gboolean rfcomm_connect_cb(GIOChannel *chan, GIOCondition cond,
- struct input_device *idev)
+static gboolean rfcomm_connect_cb(GIOChannel *chan,
+ GIOCondition cond, struct device *idev)
{
struct fake_input *fake;
DBusMessage *reply;
@@ -414,7 +414,7 @@ failed:
return FALSE;
}
-static int rfcomm_connect(struct input_device *idev)
+static int rfcomm_connect(struct device *idev)
{
struct sockaddr_rc addr;
GIOChannel *io;
@@ -487,7 +487,7 @@ failed:
return -err;
}
-static int l2cap_connect(struct input_device *idev,
+static int l2cap_connect(struct device *idev,
unsigned short psm, GIOFunc cb)
{
GIOChannel *io;
@@ -544,8 +544,8 @@ failed:
return -1;
}
-static gboolean interrupt_connect_cb(GIOChannel *chan, GIOCondition cond,
- struct input_device *idev)
+static gboolean interrupt_connect_cb(GIOChannel *chan,
+ GIOCondition cond, struct device *idev)
{
int ctl, isk, ret, err;
socklen_t len;
@@ -630,8 +630,8 @@ cleanup:
return FALSE;
}
-static gboolean control_connect_cb(GIOChannel *chan, GIOCondition cond,
- struct input_device *idev)
+static gboolean control_connect_cb(GIOChannel *chan,
+ GIOCondition cond, struct device *idev)
{
int ret, csk, err;
socklen_t len;
@@ -693,7 +693,7 @@ failed:
return FALSE;
}
-static int disconnect(struct input_device *idev, uint32_t flags)
+static int disconnect(struct device *idev, uint32_t flags)
{
struct fake_input *fake = idev->fake;
struct hidp_conndel_req req;
@@ -755,7 +755,7 @@ fail:
return -err;
}
-static int is_connected(struct input_device *idev)
+static int is_connected(struct device *idev)
{
struct fake_input *fake = idev->fake;
struct hidp_conninfo ci;
@@ -793,9 +793,9 @@ static int is_connected(struct input_device *idev)
* Input Device methods
*/
static DBusHandlerResult device_connect(DBusConnection *conn,
- DBusMessage *msg, void *data)
+ DBusMessage *msg, void *data)
{
- struct input_device *idev = data;
+ struct device *idev = data;
if (idev->pending_connect)
return err_connection_failed(conn, msg, "Connection in progress");
@@ -839,7 +839,7 @@ static DBusHandlerResult device_connect(DBusConnection *conn,
static DBusHandlerResult device_disconnect(DBusConnection *conn,
DBusMessage *msg, void *data)
{
- struct input_device *idev = data;
+ struct device *idev = data;
if (disconnect(idev, 0) < 0)
return err_failed(conn, msg, strerror(errno));
@@ -851,7 +851,7 @@ static DBusHandlerResult device_disconnect(DBusConnection *conn,
static DBusHandlerResult device_is_connected(DBusConnection *conn,
DBusMessage *msg, void *data)
{
- struct input_device *idev = data;
+ struct device *idev = data;
DBusMessage *reply;
dbus_bool_t connected;
@@ -870,7 +870,7 @@ static DBusHandlerResult device_is_connected(DBusConnection *conn,
static DBusHandlerResult device_get_address(DBusConnection *conn,
DBusMessage *msg, void *data)
{
- struct input_device *idev = data;
+ struct device *idev = data;
DBusMessage *reply;
char addr[18];
const char *paddr = addr;
@@ -891,7 +891,7 @@ static DBusHandlerResult device_get_address(DBusConnection *conn,
static DBusHandlerResult device_get_name(DBusConnection *conn,
DBusMessage *msg, void *data)
{
- struct input_device *idev = data;
+ struct device *idev = data;
DBusMessage *reply;
const char *pname = idev->hidp.name;
@@ -909,7 +909,7 @@ static DBusHandlerResult device_get_name(DBusConnection *conn,
static DBusHandlerResult device_get_product_id(DBusConnection *conn,
DBusMessage *msg, void *data)
{
- struct input_device *idev = data;
+ struct device *idev = data;
DBusMessage *reply;
reply = dbus_message_new_method_return(msg);
@@ -926,7 +926,7 @@ static DBusHandlerResult device_get_product_id(DBusConnection *conn,
static DBusHandlerResult device_get_vendor_id(DBusConnection *conn,
DBusMessage *msg, void *data)
{
- struct input_device *idev = data;
+ struct device *idev = data;
DBusMessage *reply;
reply = dbus_message_new_method_return(msg);
@@ -987,11 +987,11 @@ static DBusHandlerResult device_message(DBusConnection *conn,
static void device_unregister(DBusConnection *conn, void *data)
{
- struct input_device *idev = data;
+ struct device *idev = data;
/* Disconnect if applied */
disconnect(idev, (1 << HIDP_VIRTUAL_CABLE_UNPLUG));
- input_device_free(idev);
+ device_free(idev);
}
/* Virtual table to handle device object path hierarchy */
@@ -1003,7 +1003,7 @@ static const DBusObjectPathVTable device_table = {
/*
* Input registration functions
*/
-static int register_path(DBusConnection *conn, const char *path, struct input_device *idev)
+static int register_path(DBusConnection *conn, const char *path, struct device *idev)
{
DBusMessage *msg;
if (!dbus_connection_register_object_path(conn, path,
@@ -1031,10 +1031,10 @@ static int register_path(DBusConnection *conn, const char *path, struct input_de
int input_device_register(DBusConnection *conn, bdaddr_t *src, bdaddr_t *dst,
struct hidp_connadd_req *hid, const char **ppath)
{
- struct input_device *idev;
+ struct device *idev;
const char *path;
- idev = input_device_new(src, dst);
+ idev = device_new(src, dst);
path = create_input_path(idev->major, idev->minor);
/* rd_data must not be deallocated since the memory address is copied */
@@ -1052,10 +1052,10 @@ int input_device_register(DBusConnection *conn, bdaddr_t *src, bdaddr_t *dst,
int fake_input_register(DBusConnection *conn, bdaddr_t *src,
bdaddr_t *dst, uint8_t ch, const char **ppath)
{
- struct input_device *idev;
+ struct device *idev;
const char *path;
- idev = input_device_new(src, dst);
+ idev = device_new(src, dst);
path = create_input_path(idev->major, idev->minor);
idev->fake = g_new0(struct fake_input, 1);
diff --git a/input/device.h b/input/device.h
index fa5cec124..398e3751d 100644
--- a/input/device.h
+++ b/input/device.h
@@ -33,7 +33,7 @@ struct pending_connect {
DBusMessage *msg;
};
-struct input_device {
+struct device {
bdaddr_t src;
bdaddr_t dst;
char *name;
diff --git a/input/manager.c b/input/manager.c
index 4a973023d..2faef35dd 100644
--- a/input/manager.c
+++ b/input/manager.c
@@ -61,7 +61,7 @@ struct pending_req {
sdp_record_t *hid_rec;
};
-struct input_manager {
+struct manager {
bdaddr_t src; /* Local adapter BT address */
GSList *paths; /* Input registered paths */
};
@@ -111,7 +111,7 @@ static void pending_req_free(struct pending_req *pr)
static int path_bdaddr_cmp(const char *path, const bdaddr_t *bdaddr)
{
- struct input_device *idev;
+ struct device *idev;
if (!dbus_connection_get_object_path_data(connection, path,
(void *) &idev))
@@ -256,7 +256,7 @@ static void hid_record_reply(DBusPendingCall *call, void *data)
{
DBusMessage *reply = dbus_pending_call_steal_reply(call);
DBusMessage *pr_reply;
- struct input_manager *mgr;
+ struct manager *mgr;
struct pending_req *pr = data;
struct hidp_connadd_req hidp;
DBusError derr;
@@ -482,7 +482,7 @@ static void headset_record_reply(DBusPendingCall *call, void *data)
DBusMessage *reply = dbus_pending_call_steal_reply(call);
DBusMessage *pr_reply;
DBusError derr;
- struct input_manager *mgr;
+ struct manager *mgr;
struct pending_req *pr = data;
uint8_t *rec_bin;
sdp_record_t *rec;
@@ -610,10 +610,10 @@ done:
dbus_pending_call_unref(call);
}
-static DBusHandlerResult manager_create_device(DBusConnection *conn,
- DBusMessage *msg, void *data)
+static DBusHandlerResult create_device(DBusConnection *conn,
+ DBusMessage *msg, void *data)
{
- struct input_manager *mgr = data;
+ struct manager *mgr = data;
struct pending_req *pr;
DBusError derr;
const char *addr;
@@ -668,11 +668,11 @@ static DBusHandlerResult manager_create_device(DBusConnection *conn,
return DBUS_HANDLER_RESULT_HANDLED;
}
-static DBusHandlerResult manager_remove_device(DBusConnection *conn,
- DBusMessage *msg, void *data)
+static DBusHandlerResult remove_device(DBusConnection *conn,
+ DBusMessage *msg, void *data)
{
- struct input_manager *mgr = data;
- struct input_device *idev;
+ struct manager *mgr = data;
+ struct device *idev;
DBusMessage *reply;
DBusError derr;
GSList *l;
@@ -711,10 +711,10 @@ static DBusHandlerResult manager_remove_device(DBusConnection *conn,
return send_message_and_unref(conn, reply);
}
-static DBusHandlerResult manager_list_devices(DBusConnection *conn,
- DBusMessage *msg, void *data)
+static DBusHandlerResult list_devices(DBusConnection *conn,
+ DBusMessage *msg, void *data)
{
- struct input_manager *mgr = data;
+ struct manager *mgr = data;
DBusMessageIter iter, iter_array;
DBusMessage *reply;
GSList *paths;
@@ -755,18 +755,18 @@ static DBusHandlerResult manager_message(DBusConnection *conn,
return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
if (strcmp(member, "ListDevices") == 0)
- return manager_list_devices(conn, msg, data);
+ return list_devices(conn, msg, data);
if (strcmp(member, "CreateDevice") == 0)
- return manager_create_device(conn, msg, data);
+ return create_device(conn, msg, data);
if (strcmp(member, "RemoveDevice") == 0)
- return manager_remove_device(conn, msg, data);
+ return remove_device(conn, msg, data);
return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
}
-static void input_manager_free(struct input_manager *mgr)
+static void manager_free(struct manager *mgr)
{
if (!mgr)
return;
@@ -781,11 +781,11 @@ static void input_manager_free(struct input_manager *mgr)
static void manager_unregister(DBusConnection *conn, void *data)
{
- struct input_manager *mgr = data;
+ struct manager *mgr = data;
info("Unregistered manager path");
- input_manager_free(mgr);
+ manager_free(mgr);
}
/* Virtual table to handle manager object path hierarchy */
@@ -800,7 +800,7 @@ static const DBusObjectPathVTable manager_table = {
static void stored_input(char *key, char *value, void *data)
{
- struct input_manager *mgr = data;
+ struct manager *mgr = data;
const char *path;
struct hidp_connadd_req hidp;
bdaddr_t dst;
@@ -818,7 +818,7 @@ static void stored_input(char *key, char *value, void *data)
mgr->paths = g_slist_append(mgr->paths, g_strdup(path));
}
-static int register_stored_inputs(struct input_manager *mgr)
+static int register_stored_inputs(struct manager *mgr)
{
char filename[PATH_MAX + 1];
char addr[18];
@@ -832,7 +832,7 @@ static int register_stored_inputs(struct input_manager *mgr)
int input_init(void)
{
- struct input_manager *mgr;
+ struct manager *mgr;
bdaddr_t src;
int dev_id;
@@ -842,7 +842,7 @@ int input_init(void)
dbus_connection_set_exit_on_disconnect(connection, TRUE);
- mgr = g_new0(struct input_manager, 1);
+ mgr = g_new0(struct manager, 1);
/* Fallback to catch invalid device path */
if (!dbus_connection_register_fallback(connection, INPUT_PATH,
@@ -873,7 +873,7 @@ int input_init(void)
return 0;
fail:
- input_manager_free(mgr);
+ manager_free(mgr);
return -1;
}