* [PATCH BlueZ 1/2] input: Remove unneeded Bluetooth Address arguments
@ 2012-03-12 20:05 Claudio Takahasi
2012-03-12 20:05 ` [PATCH BlueZ 2/2] input: Remove unneeded alias Claudio Takahasi
2012-03-16 15:21 ` [PATCH BlueZ 1/2] input: Remove unneeded Bluetooth Address arguments Johan Hedberg
0 siblings, 2 replies; 3+ messages in thread
From: Claudio Takahasi @ 2012-03-12 20:05 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Claudio Takahasi
---
input/device.c | 26 ++++++++++++--------------
input/device.h | 8 +++-----
input/manager.c | 17 +++--------------
3 files changed, 18 insertions(+), 33 deletions(-)
diff --git a/input/device.c b/input/device.c
index 0ab63c0..e4e0b21 100644
--- a/input/device.c
+++ b/input/device.c
@@ -1032,23 +1032,23 @@ static GDBusSignalTable device_signals[] = {
};
static struct input_device *input_device_new(DBusConnection *conn,
- struct btd_device *device, const char *path,
- const bdaddr_t *src, const bdaddr_t *dst,
- const uint32_t handle)
+ struct btd_device *device, const char *path,
+ const uint32_t handle)
{
+ struct btd_adapter *adapter = device_get_adapter(device);
struct input_device *idev;
char name[249], src_addr[18], dst_addr[18];
idev = g_new0(struct input_device, 1);
- bacpy(&idev->src, src);
- bacpy(&idev->dst, dst);
+ adapter_get_address(adapter, &idev->src);
+ device_get_address(device, &idev->dst, NULL);
idev->device = btd_device_ref(device);
idev->path = g_strdup(path);
idev->conn = dbus_connection_ref(conn);
idev->handle = handle;
- ba2str(src, src_addr);
- ba2str(dst, dst_addr);
+ ba2str(&idev->src, src_addr);
+ ba2str(&idev->dst, dst_addr);
if (read_device_name(src_addr, dst_addr, name) == 0)
idev->name = g_strdup(name);
@@ -1083,16 +1083,15 @@ static struct input_conn *input_conn_new(struct input_device *idev,
}
int input_device_register(DBusConnection *conn, struct btd_device *device,
- const char *path, const bdaddr_t *src,
- const bdaddr_t *dst, const char *uuid,
- uint32_t handle, int timeout)
+ const char *path, const char *uuid,
+ uint32_t handle, int timeout)
{
struct input_device *idev;
struct input_conn *iconn;
idev = find_device_by_path(devices, path);
if (!idev) {
- idev = input_device_new(conn, device, path, src, dst, handle);
+ idev = input_device_new(conn, device, path, handle);
if (!idev)
return -EINVAL;
devices = g_slist_append(devices, idev);
@@ -1108,15 +1107,14 @@ int input_device_register(DBusConnection *conn, struct btd_device *device,
}
int fake_input_register(DBusConnection *conn, struct btd_device *device,
- const char *path, bdaddr_t *src, bdaddr_t *dst,
- const char *uuid, uint8_t channel)
+ const char *path, const char *uuid, uint8_t channel)
{
struct input_device *idev;
struct input_conn *iconn;
idev = find_device_by_path(devices, path);
if (!idev) {
- idev = input_device_new(conn, device, path, src, dst, 0);
+ idev = input_device_new(conn, device, path, 0);
if (!idev)
return -EINVAL;
devices = g_slist_append(devices, idev);
diff --git a/input/device.h b/input/device.h
index 14c0f97..356d9ed 100644
--- a/input/device.h
+++ b/input/device.h
@@ -43,12 +43,10 @@ struct fake_input {
};
int fake_input_register(DBusConnection *conn, struct btd_device *device,
- const char *path, bdaddr_t *src, bdaddr_t *dst,
- const char *uuid, uint8_t channel);
+ const char *path, const char *uuid, uint8_t channel);
int input_device_register(DBusConnection *conn, struct btd_device *device,
- const char *path, const bdaddr_t *src,
- const bdaddr_t *dst, const char *uuid,
- uint32_t handle, int timeout);
+ const char *path, const char *uuid,
+ uint32_t handle, int timeout);
int input_device_unregister(const char *path, const char *uuid);
int input_device_set_channel(const bdaddr_t *src, const bdaddr_t *dst, int psm,
diff --git a/input/manager.c b/input/manager.c
index ede06be..9bcab10 100644
--- a/input/manager.c
+++ b/input/manager.c
@@ -58,21 +58,16 @@ static void input_remove(struct btd_device *device, const char *uuid)
static int hid_device_probe(struct btd_device *device, GSList *uuids)
{
- struct btd_adapter *adapter = device_get_adapter(device);
const gchar *path = device_get_path(device);
const sdp_record_t *rec = btd_device_get_record(device, uuids->data);
- bdaddr_t src, dst;
DBG("path %s", path);
if (!rec)
return -1;
- adapter_get_address(adapter, &src);
- device_get_address(device, &dst, NULL);
-
- return input_device_register(connection, device, path, &src, &dst,
- HID_UUID, rec->handle, idle_timeout * 60);
+ return input_device_register(connection, device, path, HID_UUID,
+ rec->handle, idle_timeout * 60);
}
static void hid_device_remove(struct btd_device *device)
@@ -82,12 +77,10 @@ static void hid_device_remove(struct btd_device *device)
static int headset_probe(struct btd_device *device, GSList *uuids)
{
- struct btd_adapter *adapter = device_get_adapter(device);
const gchar *path = device_get_path(device);
const sdp_record_t *record;
sdp_list_t *protos;
int ch;
- bdaddr_t src, dst;
DBG("path %s", path);
@@ -111,11 +104,7 @@ static int headset_probe(struct btd_device *device, GSList *uuids)
return -EINVAL;
}
- adapter_get_address(adapter, &src);
- device_get_address(device, &dst, NULL);
-
- return fake_input_register(connection, device, path, &src, &dst,
- HSP_HS_UUID, ch);
+ return fake_input_register(connection, device, path, HSP_HS_UUID, ch);
}
static void headset_remove(struct btd_device *device)
--
1.7.8.5
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH BlueZ 2/2] input: Remove unneeded alias
2012-03-12 20:05 [PATCH BlueZ 1/2] input: Remove unneeded Bluetooth Address arguments Claudio Takahasi
@ 2012-03-12 20:05 ` Claudio Takahasi
2012-03-16 15:21 ` [PATCH BlueZ 1/2] input: Remove unneeded Bluetooth Address arguments Johan Hedberg
1 sibling, 0 replies; 3+ messages in thread
From: Claudio Takahasi @ 2012-03-12 20:05 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Claudio Takahasi
---
input/device.c | 19 ++++++-------------
1 files changed, 6 insertions(+), 13 deletions(-)
diff --git a/input/device.c b/input/device.c
index e4e0b21..743699f 100644
--- a/input/device.c
+++ b/input/device.c
@@ -68,7 +68,6 @@ struct input_conn {
struct fake_input *fake;
DBusMessage *pending_connect;
char *uuid;
- char *alias;
GIOChannel *ctrl_io;
GIOChannel *intr_io;
guint ctrl_watch;
@@ -110,9 +109,6 @@ static struct input_conn *find_connection(GSList *list, const char *pattern)
if (!strcasecmp(iconn->uuid, pattern))
return iconn;
-
- if (!strcasecmp(iconn->alias, pattern))
- return iconn;
}
return NULL;
@@ -136,7 +132,6 @@ static void input_conn_free(struct input_conn *iconn)
g_io_channel_unref(iconn->ctrl_io);
g_free(iconn->uuid);
- g_free(iconn->alias);
g_free(iconn->fake);
g_free(iconn);
}
@@ -915,7 +910,7 @@ static DBusMessage *input_device_connect(DBusConnection *conn,
DBusMessage *reply;
GError *err = NULL;
- iconn = find_connection(idev->connections, "HID");
+ iconn = find_connection(idev->connections, HID_UUID);
if (!iconn)
return btd_error_not_supported(msg);
@@ -1068,15 +1063,13 @@ static struct input_device *input_device_new(DBusConnection *conn,
}
static struct input_conn *input_conn_new(struct input_device *idev,
- const char *uuid, const char *alias,
- int timeout)
+ const char *uuid, int timeout)
{
struct input_conn *iconn;
iconn = g_new0(struct input_conn, 1);
iconn->timeout = timeout;
iconn->uuid = g_strdup(uuid);
- iconn->alias = g_strdup(alias);
iconn->idev = idev;
return iconn;
@@ -1097,7 +1090,7 @@ int input_device_register(DBusConnection *conn, struct btd_device *device,
devices = g_slist_append(devices, idev);
}
- iconn = input_conn_new(idev, uuid, "hid", timeout);
+ iconn = input_conn_new(idev, uuid, timeout);
if (!iconn)
return -EINVAL;
@@ -1120,7 +1113,7 @@ int fake_input_register(DBusConnection *conn, struct btd_device *device,
devices = g_slist_append(devices, idev);
}
- iconn = input_conn_new(idev, uuid, "hsp", 0);
+ iconn = input_conn_new(idev, uuid, 0);
if (!iconn)
return -EINVAL;
@@ -1212,7 +1205,7 @@ int input_device_set_channel(const bdaddr_t *src, const bdaddr_t *dst, int psm,
if (!idev)
return -ENOENT;
- iconn = find_connection(idev->connections, "hid");
+ iconn = find_connection(idev->connections, HID_UUID);
if (!iconn)
return -ENOENT;
@@ -1243,7 +1236,7 @@ int input_device_close_channels(const bdaddr_t *src, const bdaddr_t *dst)
if (!idev)
return -ENOENT;
- iconn = find_connection(idev->connections, "hid");
+ iconn = find_connection(idev->connections, HID_UUID);
if (!iconn)
return -ENOENT;
--
1.7.8.5
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH BlueZ 1/2] input: Remove unneeded Bluetooth Address arguments
2012-03-12 20:05 [PATCH BlueZ 1/2] input: Remove unneeded Bluetooth Address arguments Claudio Takahasi
2012-03-12 20:05 ` [PATCH BlueZ 2/2] input: Remove unneeded alias Claudio Takahasi
@ 2012-03-16 15:21 ` Johan Hedberg
1 sibling, 0 replies; 3+ messages in thread
From: Johan Hedberg @ 2012-03-16 15:21 UTC (permalink / raw)
To: Claudio Takahasi; +Cc: linux-bluetooth
Hi Claudio,
On Mon, Mar 12, 2012, Claudio Takahasi wrote:
> ---
> input/device.c | 26 ++++++++++++--------------
> input/device.h | 8 +++-----
> input/manager.c | 17 +++--------------
> 3 files changed, 18 insertions(+), 33 deletions(-)
Both patches have been applied. Thanks.
Johan
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2012-03-16 15:21 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-03-12 20:05 [PATCH BlueZ 1/2] input: Remove unneeded Bluetooth Address arguments Claudio Takahasi
2012-03-12 20:05 ` [PATCH BlueZ 2/2] input: Remove unneeded alias Claudio Takahasi
2012-03-16 15:21 ` [PATCH BlueZ 1/2] input: Remove unneeded Bluetooth Address arguments Johan Hedberg
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.