* Re: [PATCH BlueZ 1/4] core: Print profile name in device_profile_connected
From: Johan Hedberg @ 2012-12-19 11:41 UTC (permalink / raw)
To: Luiz Augusto von Dentz; +Cc: linux-bluetooth
In-Reply-To: <1355916421-29304-1-git-send-email-luiz.dentz@gmail.com>
Hi Luiz,
On Wed, Dec 19, 2012, Luiz Augusto von Dentz wrote:
> ---
> src/device.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
All patches in this set have been applied. Thanks.
Johan
^ permalink raw reply
* [PATCH BlueZ 4/4] audio: Fix calling device_profile_connected on disconnected cases
From: Luiz Augusto von Dentz @ 2012-12-19 11:27 UTC (permalink / raw)
To: linux-bluetooth
In-Reply-To: <1355916421-29304-1-git-send-email-luiz.dentz@gmail.com>
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
---
profiles/audio/manager.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/profiles/audio/manager.c b/profiles/audio/manager.c
index 1f49aa3..0f6a4f7 100644
--- a/profiles/audio/manager.c
+++ b/profiles/audio/manager.c
@@ -485,7 +485,7 @@ void audio_sink_connected(struct btd_device *dev, int err)
void audio_sink_disconnected(struct btd_device *dev, int err)
{
- device_profile_connected(dev, &a2dp_sink_profile, err);
+ device_profile_disconnected(dev, &a2dp_sink_profile, err);
}
void audio_source_connected(struct btd_device *dev, int err)
@@ -495,7 +495,7 @@ void audio_source_connected(struct btd_device *dev, int err)
void audio_source_disconnected(struct btd_device *dev, int err)
{
- device_profile_connected(dev, &a2dp_source_profile, err);
+ device_profile_disconnected(dev, &a2dp_source_profile, err);
}
void audio_control_connected(struct btd_device *dev, int err)
--
1.7.11.7
^ permalink raw reply related
* [PATCH BlueZ 3/4] audio: Remove unused parameters from sink_connect/sink_disconnect
From: Luiz Augusto von Dentz @ 2012-12-19 11:27 UTC (permalink / raw)
To: linux-bluetooth
In-Reply-To: <1355916421-29304-1-git-send-email-luiz.dentz@gmail.com>
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Profile .connect and .disconnect no longer use callbacks so there is no
reason to keep these parameters around.
---
profiles/audio/device.c | 2 +-
profiles/audio/manager.c | 18 ++----------------
profiles/audio/sink.c | 5 ++---
profiles/audio/sink.h | 5 ++---
4 files changed, 7 insertions(+), 23 deletions(-)
diff --git a/profiles/audio/device.c b/profiles/audio/device.c
index 080ebc9..d4ba6d2 100644
--- a/profiles/audio/device.c
+++ b/profiles/audio/device.c
@@ -184,7 +184,7 @@ static void disconnect_cb(struct btd_device *btd_dev, gboolean removal,
avrcp_disconnect(dev);
if (dev->sink && priv->sink_state != SINK_STATE_DISCONNECTED)
- sink_disconnect(dev, TRUE, NULL, NULL);
+ sink_disconnect(dev, TRUE);
else
priv->disconnecting = FALSE;
}
diff --git a/profiles/audio/manager.c b/profiles/audio/manager.c
index 620127c..1f49aa3 100644
--- a/profiles/audio/manager.c
+++ b/profiles/audio/manager.c
@@ -174,20 +174,6 @@ static int avrcp_probe(struct btd_profile *p, struct btd_device *device,
return 0;
}
-static void connect_cb(struct audio_device *dev, int err, void *data)
-{
- struct btd_profile *profile = data;
-
- device_profile_connected(dev->btd_dev, profile, err);
-}
-
-static void disconnect_cb(struct audio_device *dev, int err, void *data)
-{
- struct btd_profile *profile = data;
-
- device_profile_disconnected(dev->btd_dev, profile, err);
-}
-
static int a2dp_source_connect(struct btd_device *dev,
struct btd_profile *profile)
{
@@ -236,7 +222,7 @@ static int a2dp_sink_connect(struct btd_device *dev,
return -1;
}
- return sink_connect(audio_dev, connect_cb, profile);
+ return sink_connect(audio_dev);
}
static int a2dp_sink_disconnect(struct btd_device *dev,
@@ -253,7 +239,7 @@ static int a2dp_sink_disconnect(struct btd_device *dev,
return -1;
}
- return sink_disconnect(audio_dev, FALSE, disconnect_cb, profile);
+ return sink_disconnect(audio_dev, FALSE);
}
static int avrcp_control_connect(struct btd_device *dev,
diff --git a/profiles/audio/sink.c b/profiles/audio/sink.c
index b12c913..02e1a65 100644
--- a/profiles/audio/sink.c
+++ b/profiles/audio/sink.c
@@ -305,7 +305,7 @@ gboolean sink_setup_stream(struct sink *sink, struct avdtp *session)
return TRUE;
}
-int sink_connect(struct audio_device *dev, audio_device_cb cb, void *data)
+int sink_connect(struct audio_device *dev)
{
struct sink *sink = dev->sink;
@@ -415,8 +415,7 @@ gboolean sink_new_stream(struct audio_device *dev, struct avdtp *session,
return TRUE;
}
-int sink_disconnect(struct audio_device *dev, gboolean shutdown,
- audio_device_cb cb, void *data)
+int sink_disconnect(struct audio_device *dev, gboolean shutdown)
{
struct sink *sink = dev->sink;
diff --git a/profiles/audio/sink.h b/profiles/audio/sink.h
index b9e97e3..fc7ed92 100644
--- a/profiles/audio/sink.h
+++ b/profiles/audio/sink.h
@@ -42,9 +42,8 @@ gboolean sink_remove_state_cb(unsigned int id);
struct sink *sink_init(struct audio_device *dev);
void sink_unregister(struct audio_device *dev);
gboolean sink_is_active(struct audio_device *dev);
-int sink_connect(struct audio_device *dev, audio_device_cb cb, void *data);
+int sink_connect(struct audio_device *dev);
gboolean sink_new_stream(struct audio_device *dev, struct avdtp *session,
struct avdtp_stream *stream);
gboolean sink_setup_stream(struct sink *sink, struct avdtp *session);
-int sink_disconnect(struct audio_device *dev, gboolean shutdown,
- audio_device_cb cb, void *data);
+int sink_disconnect(struct audio_device *dev, gboolean shutdown);
--
1.7.11.7
^ permalink raw reply related
* [PATCH BlueZ 2/4] audio: Fix not cleaning up player when device is removed
From: Luiz Augusto von Dentz @ 2012-12-19 11:26 UTC (permalink / raw)
To: linux-bluetooth
In-Reply-To: <1355916421-29304-1-git-send-email-luiz.dentz@gmail.com>
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
All profile connections need to be reported to the core otherwise it
won't be able to disconnect them properly.
---
profiles/audio/control.c | 58 ++++++------------------------------------------
profiles/audio/control.h | 5 ++---
profiles/audio/manager.c | 14 ++++++++++--
profiles/audio/manager.h | 2 ++
4 files changed, 23 insertions(+), 56 deletions(-)
diff --git a/profiles/audio/control.c b/profiles/audio/control.c
index 1600fce..642fdd5 100644
--- a/profiles/audio/control.c
+++ b/profiles/audio/control.c
@@ -61,28 +61,11 @@
static unsigned int avctp_id = 0;
-struct pending_request {
- audio_device_cb cb;
- void *data;
- unsigned int id;
-};
-
struct control {
struct avctp *session;
gboolean target;
- struct pending_request *connect;
};
-static void pending_request_free(struct audio_device *dev,
- struct pending_request *pending,
- int err)
-{
- if (pending->cb)
- pending->cb(dev, err, pending->data);
-
- g_free(pending);
-}
-
static void state_changed(struct audio_device *dev, avctp_state_t old_state,
avctp_state_t new_state, void *user_data)
{
@@ -94,13 +77,12 @@ static void state_changed(struct audio_device *dev, avctp_state_t old_state,
case AVCTP_STATE_DISCONNECTED:
control->session = NULL;
- if (control->connect) {
- pending_request_free(dev, control->connect, -EIO);
- control->connect = NULL;
+ if (old_state != AVCTP_STATE_CONNECTED) {
+ audio_control_connected(dev->btd_dev, -EIO);
+ break;
}
- if (old_state != AVCTP_STATE_CONNECTED)
- break;
+ audio_control_disconnected(dev->btd_dev, 0);
g_dbus_emit_property_changed(conn, path,
AUDIO_CONTROL_INTERFACE, "Connected");
@@ -114,10 +96,7 @@ static void state_changed(struct audio_device *dev, avctp_state_t old_state,
break;
case AVCTP_STATE_CONNECTED:
- if (control->connect) {
- pending_request_free(dev, control->connect, 0);
- control->connect = NULL;
- }
+ audio_control_connected(dev->btd_dev, 0);
g_dbus_emit_property_changed(conn, path,
AUDIO_CONTROL_INTERFACE, "Connected");
@@ -127,10 +106,9 @@ static void state_changed(struct audio_device *dev, avctp_state_t old_state,
}
}
-int control_connect(struct audio_device *dev, audio_device_cb cb, void *data)
+int control_connect(struct audio_device *dev)
{
struct control *control = dev->control;
- struct pending_request *pending;
if (control->session)
return -EALREADY;
@@ -138,42 +116,23 @@ int control_connect(struct audio_device *dev, audio_device_cb cb, void *data)
if (!control->target)
return -ENOTSUP;
- if (control->connect)
- return -EINPROGRESS;
-
control->session = avctp_connect(dev);
if (!control->session)
return -EIO;
- pending = g_new0(struct pending_request, 1);
- pending->cb = cb;
- pending->data = data;
- control->connect = pending;
-
return 0;
}
-int control_disconnect(struct audio_device *dev, audio_device_cb cb,
- void *data)
+int control_disconnect(struct audio_device *dev)
{
struct control *control = dev->control;
if (!control->session)
return -ENOTCONN;
- /* cancel pending connect */
- if (control->connect) {
- pending_request_free(dev, control->connect, -ECANCELED);
- control->connect = NULL;
- }
-
avctp_disconnect(control->session);
- if (cb)
- cb(dev, 0, data);
-
return 0;
-
}
static DBusMessage *key_pressed(DBusConnection *conn, DBusMessage *msg,
@@ -291,9 +250,6 @@ static void path_unregister(void *data)
if (control->session)
avctp_disconnect(control->session);
- if (control->connect)
- pending_request_free(dev, control->connect, -ECANCELED);
-
g_free(control);
dev->control = NULL;
}
diff --git a/profiles/audio/control.h b/profiles/audio/control.h
index 878dd1e..001b564 100644
--- a/profiles/audio/control.h
+++ b/profiles/audio/control.h
@@ -29,6 +29,5 @@ void control_update(struct control *control, GSList *uuids);
void control_unregister(struct audio_device *dev);
gboolean control_is_active(struct audio_device *dev);
-int control_connect(struct audio_device *dev, audio_device_cb cb, void *data);
-int control_disconnect(struct audio_device *dev, audio_device_cb cb,
- void *data);
+int control_connect(struct audio_device *dev);
+int control_disconnect(struct audio_device *dev);
diff --git a/profiles/audio/manager.c b/profiles/audio/manager.c
index 422316e..620127c 100644
--- a/profiles/audio/manager.c
+++ b/profiles/audio/manager.c
@@ -270,7 +270,7 @@ static int avrcp_control_connect(struct btd_device *dev,
return -1;
}
- return control_connect(audio_dev, connect_cb, profile);
+ return control_connect(audio_dev);
}
static int avrcp_control_disconnect(struct btd_device *dev,
@@ -287,7 +287,7 @@ static int avrcp_control_disconnect(struct btd_device *dev,
return -1;
}
- return control_disconnect(audio_dev, disconnect_cb, profile);
+ return control_disconnect(audio_dev);
}
static struct audio_adapter *audio_adapter_ref(struct audio_adapter *adp)
@@ -512,6 +512,16 @@ void audio_source_disconnected(struct btd_device *dev, int err)
device_profile_connected(dev, &a2dp_source_profile, err);
}
+void audio_control_connected(struct btd_device *dev, int err)
+{
+ device_profile_connected(dev, &avrcp_profile, err);
+}
+
+void audio_control_disconnected(struct btd_device *dev, int err)
+{
+ device_profile_disconnected(dev, &avrcp_profile, err);
+}
+
int audio_manager_init(GKeyFile *conf)
{
char **list;
diff --git a/profiles/audio/manager.h b/profiles/audio/manager.h
index 2b924dc..e70d795 100644
--- a/profiles/audio/manager.h
+++ b/profiles/audio/manager.h
@@ -33,6 +33,8 @@ void audio_sink_connected(struct btd_device *dev, int err);
void audio_sink_disconnected(struct btd_device *dev, int err);
void audio_source_connected(struct btd_device *dev, int err);
void audio_source_disconnected(struct btd_device *dev, int err);
+void audio_control_connected(struct btd_device *dev, int err);
+void audio_control_disconnected(struct btd_device *dev, int err);
int audio_manager_init(GKeyFile *config);
void audio_manager_exit(void);
--
1.7.11.7
^ permalink raw reply related
* [PATCH BlueZ 1/4] core: Print profile name in device_profile_connected
From: Luiz Augusto von Dentz @ 2012-12-19 11:26 UTC (permalink / raw)
To: linux-bluetooth
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
---
src/device.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/device.c b/src/device.c
index 6a98645..ba8790e 100644
--- a/src/device.c
+++ b/src/device.c
@@ -1112,7 +1112,7 @@ static int connect_next(struct btd_device *dev)
void device_profile_connected(struct btd_device *dev,
struct btd_profile *profile, int err)
{
- DBG("%s (%d)", strerror(-err), -err);
+ DBG("%s %s (%d)", profile->name, strerror(-err), -err);
dev->pending = g_slist_remove(dev->pending, profile);
--
1.7.11.7
^ permalink raw reply related
* hci_emu and hci_vhci
From: Kevin Wilson @ 2012-12-19 11:10 UTC (permalink / raw)
To: linux-bluetooth
Hi,
What can we test with hci_emu and hci_vhci ?
When I tried:
modprobe hci_vhci
and then
./hciemu -n 10
I see with hciconfig that a virtual device was created (it shows Bus: VIRTUAL)
When I have no other BT physical device, which tests can I do with the virtual
hci device ?
When I try :
hciconfig scan
or
hciconfig inq
I get this answer in both cases:
Inquiry failed: Invalid request code
Also when I set both PSCAN/ISCAN bit in it, I cannot see it when scanning
from other machine with physical BT devices.
So I assume testing with pan --connect, etc also won't work.
Are there any tests which we can do with a virtual
hci device ?
rgs
Kevin
^ permalink raw reply
* Re: PulseAudio branch to test BlueZ master
From: Mikel Astiz @ 2012-12-19 11:07 UTC (permalink / raw)
To: Vinicius Costa Gomes; +Cc: linux-bluetooth, Tanu Kaskinen
In-Reply-To: <20121218202458.GA8716@samus>
Hi Vinicius,
On Tue, Dec 18, 2012 at 9:24 PM, Vinicius Costa Gomes
<vinicius.gomes@openbossa.org> wrote:
> Hi Mikel,
>
> On 11:19 Tue 18 Dec, Mikel Astiz wrote:
>> On the other hand, A2DP is not working for me any more. I think this
>> might be an unrelated issue, probably a regression in BlueZ, but I
>> have to do further research.
>>
>
> This problem may have been caused by me :-) The commit "bluetooth: Add
> HFP 1.6 codec ID" was buggy, and was registering the A2DP endpoint with
> the wrong codec. Sorry about that. I pushed an updated version to my
> fork of pulseaudio[1].
You're right, it was caused by this patch. Thanks for testing.
I updated now and it seems to work both with A2DP and HFP.
Btw, now that the PulseAudio "next" branch has been merged to the
master branch, I'll send the patches as RFC to the PulseAudio mailing
list.
Cheers,
Mikel
^ permalink raw reply
* Re: [PATCH BlueZ 1/3] core: Fix trying to store NULL adapter->name
From: Johan Hedberg @ 2012-12-19 7:32 UTC (permalink / raw)
To: Anderson Lizardo; +Cc: linux-bluetooth
In-Reply-To: <1355879775-5809-1-git-send-email-anderson.lizardo@openbossa.org>
Hi Lizardo,
On Tue, Dec 18, 2012, Anderson Lizardo wrote:
> When BlueZ starts without a main.conf, adapter->name will be initially
> NULL, until adapter_name_changed() is called and name is set to "BlueZ".
>
> Before this, store_adapter_info() will try to access a NULL pointer.
>
> Fixes this GLib error:
>
> (bluetoothd:1721): GLib-CRITICAL **: g_key_file_set_string: assertion
> `string != NULL' failed
> ---
> src/adapter.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
All three patches have been applied. Thanks.
Johan
^ permalink raw reply
* [PATCH BlueZ 3/3] core: Remove reference to old "mgmtops" name
From: Anderson Lizardo @ 2012-12-19 1:16 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Anderson Lizardo
In-Reply-To: <1355879775-5809-1-git-send-email-anderson.lizardo@openbossa.org>
---
src/mgmt.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/mgmt.c b/src/mgmt.c
index 17518cb..f10bd15 100644
--- a/src/mgmt.c
+++ b/src/mgmt.c
@@ -1155,7 +1155,7 @@ static void read_info_complete(int sk, uint16_t index, void *buf, size_t len)
adapter = btd_manager_register_adapter(index,
mgmt_powered(info->current_settings));
if (adapter == NULL) {
- error("mgmtops: unable to register adapter");
+ error("mgmt: unable to register adapter");
return;
}
--
1.7.9.5
^ permalink raw reply related
* [PATCH BlueZ 2/3] core: Remove bogus DBG()
From: Anderson Lizardo @ 2012-12-19 1:16 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Anderson Lizardo
In-Reply-To: <1355879775-5809-1-git-send-email-anderson.lizardo@openbossa.org>
mgmt_set_name() already prints the same information, and message still
refers to mgmtops.
---
src/mgmt.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/src/mgmt.c b/src/mgmt.c
index ce1ff2f..17518cb 100644
--- a/src/mgmt.c
+++ b/src/mgmt.c
@@ -1163,8 +1163,6 @@ static void read_info_complete(int sk, uint16_t index, void *buf, size_t len)
name = btd_adapter_get_name(adapter);
- DBG("mgmtops setting name %s", name);
-
if (name)
mgmt_set_name(index, name);
else
--
1.7.9.5
^ permalink raw reply related
* [PATCH BlueZ 1/3] core: Fix trying to store NULL adapter->name
From: Anderson Lizardo @ 2012-12-19 1:16 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Anderson Lizardo
When BlueZ starts without a main.conf, adapter->name will be initially
NULL, until adapter_name_changed() is called and name is set to "BlueZ".
Before this, store_adapter_info() will try to access a NULL pointer.
Fixes this GLib error:
(bluetoothd:1721): GLib-CRITICAL **: g_key_file_set_string: assertion
`string != NULL' failed
---
src/adapter.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/adapter.c b/src/adapter.c
index 9b83afe..d62b0fe 100644
--- a/src/adapter.c
+++ b/src/adapter.c
@@ -193,7 +193,9 @@ static void store_adapter_info(struct btd_adapter *adapter)
key_file = g_key_file_new();
- g_key_file_set_string(key_file, "General", "Name", adapter->name);
+ if (adapter->name)
+ g_key_file_set_string(key_file, "General", "Name",
+ adapter->name);
g_key_file_set_boolean(key_file, "General", "Pairable",
adapter->pairable);
--
1.7.9.5
^ permalink raw reply related
* Re: PulseAudio branch to test BlueZ master
From: Vinicius Costa Gomes @ 2012-12-18 20:24 UTC (permalink / raw)
To: Mikel Astiz; +Cc: linux-bluetooth, Tanu Kaskinen
In-Reply-To: <CANT-zCVXOjncycx6GSghO6T5y3TEM0FDA1Ke3W8FZSE=ZOhbVQ@mail.gmail.com>
Hi Mikel,
On 11:19 Tue 18 Dec, Mikel Astiz wrote:
> On the other hand, A2DP is not working for me any more. I think this
> might be an unrelated issue, probably a regression in BlueZ, but I
> have to do further research.
>
This problem may have been caused by me :-) The commit "bluetooth: Add
HFP 1.6 codec ID" was buggy, and was registering the A2DP endpoint with
the wrong codec. Sorry about that. I pushed an updated version to my
fork of pulseaudio[1].
Cheers,
--
Vinicius
[1] git://github.com/vcgomes/pulseaudio-bluez5.git
^ permalink raw reply
* Re: [PATCH BlueZ 8/8] hog: Rename hog_device_unregister
From: Anderson Lizardo @ 2012-12-18 20:13 UTC (permalink / raw)
To: Andre Guedes; +Cc: linux-bluetooth
In-Reply-To: <1355856590-19222-8-git-send-email-andre.guedes@openbossa.org>
Hi Guedes,
On Tue, Dec 18, 2012 at 2:49 PM, Andre Guedes
<andre.guedes@openbossa.org> wrote:
> This patch renames hog_device_unregister function to hog_device_
> unregister.
Minor typo: "hog_device_ unregister" -> "hog_unregister_device".
Regards,
--
Anderson Lizardo
Instituto Nokia de Tecnologia - INdT
Manaus - Brazil
^ permalink raw reply
* [PATCH BlueZ] monitor: Add support for parsing Flow Control Lag flags
From: Vinicius Costa Gomes @ 2012-12-18 19:48 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Vinicius Costa Gomes
---
monitor/packet.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/monitor/packet.c b/monitor/packet.c
index 1ca94e8..fb2d8d7 100644
--- a/monitor/packet.c
+++ b/monitor/packet.c
@@ -1146,6 +1146,9 @@ static const struct features_data features_page0[] = {
{ 17, "Paging parameter negotiation" },
{ 18, "Power control" },
{ 19, "Transparent synchronous data" },
+ { 20, "Flow control lag (least significant bit)"},
+ { 21, "Flow control lag (middle bit)" },
+ { 22, "Flow control lag (most significant bit)" },
{ 23, "Broadcast Encryption" },
{ 25, "Enhanced Data Rate ACL 2 Mbps mode" },
{ 26, "Enhanced Data Rate ACL 3 Mbps mode" },
--
1.8.0.1
^ permalink raw reply related
* [PATCH BlueZ 8/8] hog: Rename hog_device_unregister
From: Andre Guedes @ 2012-12-18 18:49 UTC (permalink / raw)
To: linux-bluetooth
In-Reply-To: <1355856590-19222-1-git-send-email-andre.guedes@openbossa.org>
This patch renames hog_device_unregister function to hog_device_
unregister.
---
profiles/input/hog.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/profiles/input/hog.c b/profiles/input/hog.c
index fa8069c..b6ac61d 100644
--- a/profiles/input/hog.c
+++ b/profiles/input/hog.c
@@ -753,7 +753,7 @@ static struct hog_device *hog_register_device(struct btd_device *device,
return hogdev;
}
-static int hog_device_unregister(struct hog_device *hogdev)
+static int hog_unregister_device(struct hog_device *hogdev)
{
struct uhid_event ev;
@@ -860,7 +860,7 @@ static void remove_device(gpointer a, gpointer b)
return;
devices = g_slist_remove(devices, hogdev);
- hog_device_unregister(hogdev);
+ hog_unregister_device(hogdev);
}
static void hog_remove(struct btd_profile *p, struct btd_device *device)
--
1.8.0.1
^ permalink raw reply related
* [PATCH BlueZ 7/8] hog: Rename hog_device_register
From: Andre Guedes @ 2012-12-18 18:49 UTC (permalink / raw)
To: linux-bluetooth
In-Reply-To: <1355856590-19222-1-git-send-email-andre.guedes@openbossa.org>
This patch renames hog_device_register function to hog_register_device.
---
profiles/input/hog.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/profiles/input/hog.c b/profiles/input/hog.c
index 8d8f804..fa8069c 100644
--- a/profiles/input/hog.c
+++ b/profiles/input/hog.c
@@ -716,7 +716,7 @@ static void hog_free_device(struct hog_device *hogdev)
g_free(hogdev);
}
-static struct hog_device *hog_device_register(struct btd_device *device,
+static struct hog_device *hog_register_device(struct btd_device *device,
struct gatt_primary *prim)
{
struct hog_device *hogdev;
@@ -841,7 +841,7 @@ static int hog_probe(struct btd_profile *p, struct btd_device *device,
if (strcmp(prim->uuid, HOG_UUID) != 0)
continue;
- hogdev = hog_device_register(device, prim);
+ hogdev = hog_register_device(device, prim);
if (hogdev == NULL)
continue;
--
1.8.0.1
^ permalink raw reply related
* [PATCH BlueZ 6/8] hog: Rename hog_device_free
From: Andre Guedes @ 2012-12-18 18:49 UTC (permalink / raw)
To: linux-bluetooth
In-Reply-To: <1355856590-19222-1-git-send-email-andre.guedes@openbossa.org>
This patch renames hog_device_free function to hog_free_device.
---
profiles/input/hog.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/profiles/input/hog.c b/profiles/input/hog.c
index c68a089..8d8f804 100644
--- a/profiles/input/hog.c
+++ b/profiles/input/hog.c
@@ -707,7 +707,7 @@ static void report_free(void *data)
g_free(report);
}
-static void hog_device_free(struct hog_device *hogdev)
+static void hog_free_device(struct hog_device *hogdev)
{
btd_device_unref(hogdev->device);
g_slist_free_full(hogdev->reports, report_free);
@@ -731,7 +731,7 @@ static struct hog_device *hog_device_register(struct btd_device *device,
if (hogdev->uhid_fd < 0) {
error("Failed to open uHID device: %s(%d)", strerror(errno),
errno);
- hog_device_free(hogdev);
+ hog_free_device(hogdev);
return NULL;
}
@@ -772,7 +772,7 @@ static int hog_device_unregister(struct hog_device *hogdev)
close(hogdev->uhid_fd);
hogdev->uhid_fd = -1;
- hog_device_free(hogdev);
+ hog_free_device(hogdev);
return 0;
}
--
1.8.0.1
^ permalink raw reply related
* [PATCH BlueZ 5/8] hog: Rename hog_device_new
From: Andre Guedes @ 2012-12-18 18:49 UTC (permalink / raw)
To: linux-bluetooth
In-Reply-To: <1355856590-19222-1-git-send-email-andre.guedes@openbossa.org>
This patch renames hog_device_new function to hog_new_device.
---
profiles/input/hog.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/profiles/input/hog.c b/profiles/input/hog.c
index 186f6b1..c68a089 100644
--- a/profiles/input/hog.c
+++ b/profiles/input/hog.c
@@ -680,7 +680,7 @@ static void attio_disconnected_cb(gpointer user_data)
hogdev->attrib = NULL;
}
-static struct hog_device *hog_device_new(struct btd_device *device,
+static struct hog_device *hog_new_device(struct btd_device *device,
uint16_t id)
{
struct hog_device *hogdev;
@@ -723,7 +723,7 @@ static struct hog_device *hog_device_register(struct btd_device *device,
GIOCondition cond = G_IO_IN | G_IO_ERR | G_IO_NVAL;
GIOChannel *io;
- hogdev = hog_device_new(device, prim->range.start);
+ hogdev = hog_new_device(device, prim->range.start);
if (!hogdev)
return NULL;
--
1.8.0.1
^ permalink raw reply related
* [PATCH BlueZ 4/8] hog: Rename hog_device_set_control_point
From: Andre Guedes @ 2012-12-18 18:49 UTC (permalink / raw)
To: linux-bluetooth
In-Reply-To: <1355856590-19222-1-git-send-email-andre.guedes@openbossa.org>
This patch renames hog_device_set_control_point function to
set_control_point.
---
profiles/input/hog.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/profiles/input/hog.c b/profiles/input/hog.c
index 00ec151..186f6b1 100644
--- a/profiles/input/hog.c
+++ b/profiles/input/hog.c
@@ -777,8 +777,7 @@ static int hog_device_unregister(struct hog_device *hogdev)
return 0;
}
-static int hog_device_set_control_point(struct hog_device *hogdev,
- gboolean suspend)
+static int set_control_point(struct hog_device *hogdev, gboolean suspend)
{
uint8_t value = suspend ? 0x00 : 0x01;
@@ -802,7 +801,7 @@ static void set_suspend(gpointer data, gpointer user_data)
struct hog_device *hogdev = data;
gboolean suspend = GPOINTER_TO_INT(user_data);
- hog_device_set_control_point(hogdev, suspend);
+ set_control_point(hogdev, suspend);
}
static void suspend_callback(void)
--
1.8.0.1
^ permalink raw reply related
* [PATCH BlueZ 3/8] hog: Rename hog_device_remove
From: Andre Guedes @ 2012-12-18 18:49 UTC (permalink / raw)
To: linux-bluetooth
In-Reply-To: <1355856590-19222-1-git-send-email-andre.guedes@openbossa.org>
This patch renames hog_device_remove function to hog_remove.
---
profiles/input/hog.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/profiles/input/hog.c b/profiles/input/hog.c
index 1cb580e..00ec151 100644
--- a/profiles/input/hog.c
+++ b/profiles/input/hog.c
@@ -864,7 +864,7 @@ static void remove_device(gpointer a, gpointer b)
hog_device_unregister(hogdev);
}
-static void hog_device_remove(struct btd_profile *p, struct btd_device *device)
+static void hog_remove(struct btd_profile *p, struct btd_device *device)
{
const gchar *path = device_get_path(device);
@@ -877,7 +877,7 @@ static struct btd_profile hog_profile = {
.name = "input-hog",
.remote_uuids = BTD_UUIDS(HOG_UUID),
.device_probe = hog_probe,
- .device_remove = hog_device_remove,
+ .device_remove = hog_remove,
};
static int hog_init(void)
--
1.8.0.1
^ permalink raw reply related
* [PATCH BlueZ 2/8] hog: Rename hog_device_probe
From: Andre Guedes @ 2012-12-18 18:49 UTC (permalink / raw)
To: linux-bluetooth
In-Reply-To: <1355856590-19222-1-git-send-email-andre.guedes@openbossa.org>
This patch renames hog_device_probe function to hog_probe.
---
profiles/input/hog.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/profiles/input/hog.c b/profiles/input/hog.c
index e2a3488..1cb580e 100644
--- a/profiles/input/hog.c
+++ b/profiles/input/hog.c
@@ -823,7 +823,7 @@ static void resume_callback(void)
g_slist_foreach(devices, set_suspend, GINT_TO_POINTER(suspend));
}
-static int hog_device_probe(struct btd_profile *p, struct btd_device *device,
+static int hog_probe(struct btd_profile *p, struct btd_device *device,
GSList *uuids)
{
const char *path = device_get_path(device);
@@ -876,7 +876,7 @@ static void hog_device_remove(struct btd_profile *p, struct btd_device *device)
static struct btd_profile hog_profile = {
.name = "input-hog",
.remote_uuids = BTD_UUIDS(HOG_UUID),
- .device_probe = hog_device_probe,
+ .device_probe = hog_probe,
.device_remove = hog_device_remove,
};
--
1.8.0.1
^ permalink raw reply related
* [PATCH BlueZ 1/8] hog: Rename hog_device.c file to hog.c
From: Andre Guedes @ 2012-12-18 18:49 UTC (permalink / raw)
To: linux-bluetooth
Since hog_manager.c and hog_device.h were merged into hog_device.c,
now the whole HoG logic is in this file. So, calling this file hog.c
instead of hog_device.c is more suitable.
---
Makefile.plugins | 2 +-
profiles/input/{hog_device.c => hog.c} | 0
2 files changed, 1 insertion(+), 1 deletion(-)
rename profiles/input/{hog_device.c => hog.c} (100%)
diff --git a/Makefile.plugins b/Makefile.plugins
index 41b6876..73055ef 100644
--- a/Makefile.plugins
+++ b/Makefile.plugins
@@ -59,7 +59,7 @@ builtin_sources += profiles/input/manager.h profiles/input/manager.c \
profiles/input/device.h profiles/input/device.c
builtin_modules += hog
-builtin_sources += profiles/input/hog_device.c profiles/input/uhid_copy.h \
+builtin_sources += profiles/input/hog.c profiles/input/uhid_copy.h \
profiles/input/suspend.h profiles/input/suspend-dummy.c
builtin_modules += health
diff --git a/profiles/input/hog_device.c b/profiles/input/hog.c
similarity index 100%
rename from profiles/input/hog_device.c
rename to profiles/input/hog.c
--
1.8.0.1
^ permalink raw reply related
* Re: [PATCH BlueZ 1/4] hog: Merge hog_manager.c code into hog_device.c
From: Johan Hedberg @ 2012-12-18 15:22 UTC (permalink / raw)
To: Andre Guedes; +Cc: linux-bluetooth
In-Reply-To: <1355841681-2589-1-git-send-email-andre.guedes@openbossa.org>
Hi Andre,
On Tue, Dec 18, 2012, Andre Guedes wrote:
> This patch merges hog_manager.c code into hog_device.c and removes
> hog_manager.c file. hog_manager.c is a very small file, so there is
> no need to keep it separated.
> ---
> Makefile.plugins | 6 +-
> profiles/input/hog_device.c | 117 +++++++++++++++++++++++++++++++
> profiles/input/hog_manager.c | 161 -------------------------------------------
> 3 files changed, 120 insertions(+), 164 deletions(-)
> delete mode 100644 profiles/input/hog_manager.c
All patches in this set have been applied. Thanks.
Johan
^ permalink raw reply
* [PATCH BlueZ 4/4] hog: Fix removing HoG device bug
From: Andre Guedes @ 2012-12-18 14:41 UTC (permalink / raw)
To: linux-bluetooth
In-Reply-To: <1355841681-2589-1-git-send-email-andre.guedes@openbossa.org>
We should remove only hog_devices from the given btd_device.
Otherwise, all hog_devices will be removed.
---
profiles/input/hog_device.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/profiles/input/hog_device.c b/profiles/input/hog_device.c
index 47f0e43..2284453 100644
--- a/profiles/input/hog_device.c
+++ b/profiles/input/hog_device.c
@@ -851,8 +851,14 @@ static int hog_device_probe(struct btd_profile *p, struct btd_device *device,
return 0;
}
-static void remove_device(gpointer hogdev, gpointer b)
+static void remove_device(gpointer a, gpointer b)
{
+ struct hog_device *hogdev = a;
+ struct btd_device *device = b;
+
+ if (hogdev->device != device)
+ return;
+
devices = g_slist_remove(devices, hogdev);
hog_device_unregister(hogdev);
}
@@ -863,7 +869,7 @@ static void hog_device_remove(struct btd_profile *p, struct btd_device *device)
DBG("path %s", path);
- g_slist_foreach(devices, remove_device, NULL);
+ g_slist_foreach(devices, remove_device, device);
}
static struct btd_profile hog_profile = {
--
1.8.0.1
^ permalink raw reply related
* [PATCH BlueZ 3/4] hog: Refactor hog init and exit functions
From: Andre Guedes @ 2012-12-18 14:41 UTC (permalink / raw)
To: linux-bluetooth
In-Reply-To: <1355841681-2589-1-git-send-email-andre.guedes@openbossa.org>
This patch simply renames hog_manager_init and hog_manager_exit
functions to hog_init and hog_exit.
---
profiles/input/hog_device.c | 14 ++------------
1 file changed, 2 insertions(+), 12 deletions(-)
diff --git a/profiles/input/hog_device.c b/profiles/input/hog_device.c
index 7efabf2..47f0e43 100644
--- a/profiles/input/hog_device.c
+++ b/profiles/input/hog_device.c
@@ -873,7 +873,7 @@ static struct btd_profile hog_profile = {
.device_remove = hog_device_remove,
};
-static int hog_manager_init(void)
+static int hog_init(void)
{
int err;
@@ -886,7 +886,7 @@ static int hog_manager_init(void)
return btd_profile_register(&hog_profile);
}
-static void hog_manager_exit(void)
+static void hog_exit(void)
{
if (suspend_supported)
suspend_exit();
@@ -894,15 +894,5 @@ static void hog_manager_exit(void)
btd_profile_unregister(&hog_profile);
}
-static int hog_init(void)
-{
- return hog_manager_init();
-}
-
-static void hog_exit(void)
-{
- hog_manager_exit();
-}
-
BLUETOOTH_PLUGIN_DEFINE(hog, VERSION, BLUETOOTH_PLUGIN_PRIORITY_DEFAULT,
hog_init, hog_exit)
--
1.8.0.1
^ permalink raw reply related
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox