linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] hidd shows different names for same device when connected from GUI and CLI.
@ 2010-10-19 13:51 Balamurugan Mahalingam
  2010-10-19 14:09 ` Johan Hedberg
  0 siblings, 1 reply; 3+ messages in thread
From: Balamurugan Mahalingam @ 2010-10-19 13:51 UTC (permalink / raw)
  To: marcel; +Cc: linux-bluetooth, charubala, Balamurugan Mahalingam

Blueman and other GUIs use the string from ServiceName
attribute as device name in the SDP response, but hidd tool
uses strings from Service Description and Provider Name atrribute.

SDP response from Microsoft Bluetooth device has extended ASCII
character 174(registered symbol) in its ServiceDescription attribute.
Android platform expects the device name to have only printable characters and
therefore GUI Crashes while connecting Microsoft Bluetooth Mouse using hidd

Using the ServiceName attribute from the SDP response
instead of ProviderName+ServiceDescription for device name in the
hidd tool solves both the issues.
---
 compat/sdp.c |   33 +++++++++++++++++----------------
 1 files changed, 17 insertions(+), 16 deletions(-)

diff --git a/compat/sdp.c b/compat/sdp.c
index ff2e39f..f384844 100644
--- a/compat/sdp.c
+++ b/compat/sdp.c
@@ -248,22 +248,23 @@ int get_sdp_device_info(const bdaddr_t *src, const bdaddr_t *dst, struct hidp_co
 
 	rec = (sdp_record_t *) hid_rsp->data;
 
-	pdlist = sdp_data_get(rec, 0x0101);
-	pdlist2 = sdp_data_get(rec, 0x0102);
-	if (pdlist) {
-		if (pdlist2) {
-			if (strncmp(pdlist->val.str, pdlist2->val.str, 5)) {
-				strncpy(req->name, pdlist2->val.str, sizeof(req->name) - 1);
-				strcat(req->name, " ");
-			}
-			strncat(req->name, pdlist->val.str,
-					sizeof(req->name) - strlen(req->name));
-		} else
-			strncpy(req->name, pdlist->val.str, sizeof(req->name) - 1);
-	} else {
-		pdlist2 = sdp_data_get(rec, 0x0100);
-		if (pdlist2)
-			strncpy(req->name, pdlist2->val.str, sizeof(req->name) - 1);
+	pdlist2 = sdp_data_get(rec, 0x0100);
+	if (pdlist2)
+		strncpy(req->name, pdlist2->val.str, sizeof(req->name) - 1);
+	else {
+		pdlist = sdp_data_get(rec, 0x0101);
+		pdlist2 = sdp_data_get(rec, 0x0102);
+		if (pdlist) {
+			if (pdlist2) {
+				if (strncmp(pdlist->val.str, pdlist2->val.str, 5)) {
+					strncpy(req->name, pdlist2->val.str, sizeof(req->name) - 1);
+					strcat(req->name, " ");
+				}
+				strncat(req->name, pdlist->val.str,
+						sizeof(req->name) - strlen(req->name));
+			} else
+				strncpy(req->name, pdlist->val.str, sizeof(req->name) - 1);
+		}
 	}
 
 	pdlist = sdp_data_get(rec, 0x0201);
-- 
1.6.3.3

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] hidd shows different names for same device when connected from GUI and CLI.
  2010-10-19 13:51 [PATCH] hidd shows different names for same device when connected from GUI and CLI Balamurugan Mahalingam
@ 2010-10-19 14:09 ` Johan Hedberg
  2010-10-20  9:12   ` Balamurugan Mahalingam
  0 siblings, 1 reply; 3+ messages in thread
From: Johan Hedberg @ 2010-10-19 14:09 UTC (permalink / raw)
  To: Balamurugan Mahalingam; +Cc: marcel, linux-bluetooth, charubala

Hi,

On Tue, Oct 19, 2010, Balamurugan Mahalingam wrote:
> Blueman and other GUIs use the string from ServiceName attribute as
> device name in the SDP response, but hidd tool uses strings from
> Service Description and Provider Name atrribute.
> 
> SDP response from Microsoft Bluetooth device has extended ASCII
> character 174(registered symbol) in its ServiceDescription attribute.
> Android platform expects the device name to have only printable
> characters and therefore GUI Crashes while connecting Microsoft
> Bluetooth Mouse using hidd
> 
> Using the ServiceName attribute from the SDP response
> instead of ProviderName+ServiceDescription for device name in the
> hidd tool solves both the issues.
> ---
>  compat/sdp.c |   33 +++++++++++++++++----------------
>  1 files changed, 17 insertions(+), 16 deletions(-)

Same issues as with the previous commit message. Lines should be max 74
characters long and please redo the summary line to be of the format
"Fix ..." and shorter than it is now.

Btw, why are you using hidd and not the bluetoothd input plugin? hidd is
legacy stuff which will disappear from BlueZ in the future.

Johan

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] hidd shows different names for same device when connected from GUI and CLI.
  2010-10-19 14:09 ` Johan Hedberg
@ 2010-10-20  9:12   ` Balamurugan Mahalingam
  0 siblings, 0 replies; 3+ messages in thread
From: Balamurugan Mahalingam @ 2010-10-20  9:12 UTC (permalink / raw)
  To: Balamurugan Mahalingam, marcel, linux-bluetooth, charubala

Johan Hedberg wrote:
> Hi,
>
> On Tue, Oct 19, 2010, Balamurugan Mahalingam wrote:
>   
>> Blueman and other GUIs use the string from ServiceName attribute as
>> device name in the SDP response, but hidd tool uses strings from
>> Service Description and Provider Name atrribute.
>>
>> SDP response from Microsoft Bluetooth device has extended ASCII
>> character 174(registered symbol) in its ServiceDescription attribute.
>> Android platform expects the device name to have only printable
>> characters and therefore GUI Crashes while connecting Microsoft
>> Bluetooth Mouse using hidd
>>
>> Using the ServiceName attribute from the SDP response
>> instead of ProviderName+ServiceDescription for device name in the
>> hidd tool solves both the issues.
>> ---
>>  compat/sdp.c |   33 +++++++++++++++++----------------
>>  1 files changed, 17 insertions(+), 16 deletions(-)
>>     
>
> Same issues as with the previous commit message. Lines should be max 74
> characters long and please redo the summary line to be of the format
> "Fix ..." and shorter than it is now.
>
> Btw, why are you using hidd and not the bluetoothd input plugin? hidd is
> legacy stuff which will disappear from BlueZ in the future.
>
> Johan
> .
>
>   

Johan,

We use the bluetooth input plugin too.
We use hidd for some scripting works.

Regards
Balamurugan

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2010-10-20  9:12 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-10-19 13:51 [PATCH] hidd shows different names for same device when connected from GUI and CLI Balamurugan Mahalingam
2010-10-19 14:09 ` Johan Hedberg
2010-10-20  9:12   ` Balamurugan Mahalingam

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).