public inbox for linux-bluetooth@vger.kernel.org
 help / color / mirror / Atom feed
* [Bluez-devel] Asus WL-BTD202 needs force_scofix
@ 2008-01-22  8:47 Guillaume Bedot
  2008-01-22 11:37 ` [Bluez-devel] [PATCH][HFP] Support for CLIP Alok
  2008-01-22 11:40 ` [Bluez-devel] Asus WL-BTD202 needs force_scofix Marcel Holtmann
  0 siblings, 2 replies; 5+ messages in thread
From: Guillaume Bedot @ 2008-01-22  8:47 UTC (permalink / raw)
  To: BlueZ development

Hello,

I'm currently testing bluetooth audio with latest cvs.

I use this dongle and a mono headset (PROF PBH-6W) :
$ /usr/sbin/lsusb | grep ASUS
Bus 001 Device 002: ID 0b05:1715 ASUSTek Computer, Inc. 

Apparently, it only works with this option set hci_usb :
options hci_usb force_scofix=1

Recording and playback work, mostly.
Sometimes noise is produced, retrying once or twice make it work...

Could this option be set as a default in hci_usb.c, or could it have
some drawback I'm not aware of ?

Best regards,

Guillaume B.


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Bluez-devel mailing list
Bluez-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-devel

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

* [Bluez-devel] [PATCH][HFP] Support for CLIP
  2008-01-22  8:47 [Bluez-devel] Asus WL-BTD202 needs force_scofix Guillaume Bedot
@ 2008-01-22 11:37 ` Alok
  2008-01-22 11:40 ` [Bluez-devel] Asus WL-BTD202 needs force_scofix Marcel Holtmann
  1 sibling, 0 replies; 5+ messages in thread
From: Alok @ 2008-01-22 11:37 UTC (permalink / raw)
  To: BlueZ development

[-- Attachment #1: Type: text/plain, Size: 142 bytes --]

Hi Johan/Fredric, 

Here is the patch for IdentifyCall() method as discussed. 

Let me know if anything needs to be changed.

Thanks, 
Alok. 

[-- Attachment #2: patch --]
[-- Type: text/x-patch, Size: 6713 bytes --]

Index: audio/headset.c
===================================================================
RCS file: /cvsroot/bluez/utils/audio/headset.c,v
retrieving revision 1.158
diff -u -5 -p -r1.158 headset.c
--- audio/headset.c	16 Jan 2008 09:08:26 -0000	1.158
+++ audio/headset.c	22 Jan 2008 11:23:10 -0000
@@ -113,10 +113,13 @@ struct headset {
 	int data_start;
 	int data_length;
 
 	gboolean hfp_active;
 	gboolean search_hfp;
+	gboolean cli_active;
+	char *ph_number;
+	int type;
 
 	headset_state_t state;
 	GSList *pending;
 
 	int sp_gain;
@@ -230,10 +233,15 @@ static int answer_call(struct device *de
 	}
 
 	if (!hs->hfp_active)
 		return headset_send(hs, "\r\nOK\r\n");
 
+	if (hs->ph_number) {
+		g_free(hs->ph_number);
+		hs->ph_number = NULL;
+	}
+
 	err = headset_send(hs, "\r\nOK\r\n");
 	if (err < 0)
 		return err;
 
 	/*+CIEV: (call = 1)*/
@@ -256,10 +264,15 @@ static int terminate_call(struct device 
 
 	err = headset_send(hs, "\r\nOK\r\n");
 	if (err < 0)
 		return err;
 
+	if (hs->ph_number) {
+		g_free(hs->ph_number);
+		hs->ph_number = NULL;
+	}
+
 	if (hs->ring_timer) {
 		g_source_remove(hs->ring_timer);
 		hs->ring_timer = 0;
 		/*+CIEV: (callsetup = 0)*/
 		return headset_send(hs, "\r\n+CIEV:3, 0\r\n");
@@ -267,10 +280,22 @@ static int terminate_call(struct device 
 
 	/*+CIEV: (call = 0)*/
 	return headset_send(hs, "\r\n+CIEV:2, 0\r\n");
 }
 
+static int cli_notification(struct device *device, const char *buf)
+{
+	struct headset *hs = device->headset;
+
+	if (buf[8] == '1')
+		hs->cli_active = TRUE;
+	else
+		hs->cli_active = FALSE;
+
+	return headset_send(hs, "\r\nOK\r\n");
+}
+
 static int signal_gain_setting(struct device *device, const char *buf)
 {
 	struct headset *hs = device->headset;
 	const char *name;
 	dbus_uint16_t gain;
@@ -321,10 +346,11 @@ static struct event event_callbacks[] = 
 	{"AT+CIND", report_indicators},
 	{"AT+CMER", event_reporting},
 	{"AT+CHLD", call_hold},
 	{"AT+CHUP", terminate_call},
 	{"AT+CKPD", answer_call},
+	{"AT+CLIP", cli_notification},
 	{0}
 };
 
 static GIOError handle_event(struct device *device, const char *buf)
 {
@@ -1178,11 +1204,19 @@ static gboolean ring_timer_cb(gpointer d
 	int err;
 
 	err = headset_send(hs, "\r\nRING\r\n");
 
 	if (err < 0)
-		error("Sending RING failed");
+		error("Error while sending RING: %s (%d)", strerror(-err), -err);
+
+	if (hs->cli_active && hs->ph_number) {
+		err = headset_send(hs, "\r\n+CLIP:\"%s\", %d\r\n",
+					hs->ph_number, hs->type);
+
+		if (err < 0)
+			error("Error while sending CLIP: %s (%d)", strerror(-err), -err);
+	}
 
 	return TRUE;
 }
 
 static DBusHandlerResult hs_ring(DBusConnection *conn, DBusMessage *msg,
@@ -1209,10 +1243,19 @@ static DBusHandlerResult hs_ring(DBusCon
 	if (err < 0) {
 		dbus_message_unref(reply);
 		return error_failed(conn, msg, "Failed");
 	}
 
+	if (hs->cli_active && hs->ph_number) {
+		err = headset_send(hs, "\r\n+CLIP:\"%s\", %d\r\n",
+					hs->ph_number, hs->type);
+		if (err < 0) {
+			dbus_message_unref(reply);
+			return error_failed(conn, msg, "Failed");
+		}
+	}
+
 	hs->ring_timer = g_timeout_add(RING_INTERVAL, ring_timer_cb, device);
 
 done:
 	send_message_and_unref(conn, reply);
 
@@ -1454,10 +1497,54 @@ static DBusHandlerResult hf_setup_call(D
 	send_message_and_unref(conn, reply);
 
 	return DBUS_HANDLER_RESULT_HANDLED;
 }
 
+static DBusHandlerResult hf_identify_call(DBusConnection *conn,
+						DBusMessage *msg,
+						void *data)
+{
+	struct device *device = data;
+	struct headset *hs = device->headset;
+	DBusMessage *reply;
+	DBusError derr;
+	const char *number;
+	dbus_int32_t type;
+
+	if (!hs->hfp_active && !hs->cli_active)
+		return error_not_supported(device->conn, msg);
+
+	if (hs->state < HEADSET_STATE_CONNECTED)
+		return error_not_connected(conn, msg);
+
+	dbus_error_init(&derr);
+	dbus_message_get_args(msg, &derr, DBUS_TYPE_STRING, &number,
+			      DBUS_TYPE_INT32, &type, DBUS_TYPE_INVALID);
+
+	if (dbus_error_is_set(&derr)) {
+		error_invalid_arguments(conn, msg, derr.message);
+		dbus_error_free(&derr);
+		return DBUS_HANDLER_RESULT_HANDLED;
+	}
+
+	reply = dbus_message_new_method_return(msg);
+	if (!reply)
+		return DBUS_HANDLER_RESULT_NEED_MEMORY;
+
+	if (hs->ph_number) {
+		g_free(hs->ph_number);
+		hs->ph_number = NULL;
+	}
+
+	hs->ph_number = g_strdup(number);
+	hs->type = type;
+
+	send_message_and_unref(conn, reply);
+
+	return DBUS_HANDLER_RESULT_HANDLED;
+}
+
 static DBusMethodVTable headset_methods[] = {
 	{ "Connect",		hs_connect,		"",	""	},
 	{ "Disconnect",		hs_disconnect,		"",	""	},
 	{ "IsConnected",	hs_is_connected,	"",	"b"	},
 	{ "IndicateCall",	hs_ring,		"",	""	},
@@ -1468,10 +1555,11 @@ static DBusMethodVTable headset_methods[
 	{ "GetSpeakerGain",	hs_get_speaker_gain,	"",	"q"	},
 	{ "GetMicrophoneGain",	hs_get_mic_gain,	"",	"q"	},
 	{ "SetSpeakerGain",	hs_set_speaker_gain,	"q",	""	},
 	{ "SetMicrophoneGain",	hs_set_mic_gain,	"q",	""	},
 	{ "SetupCall",		hf_setup_call,		"s",	""	},
+	{ "IdentifyCall",	hf_identify_call,	"si",	""	},
 	{ NULL, NULL, NULL, NULL }
 };
 
 static DBusSignalVTable headset_signals[] = {
 	{ "Connected",			""	},
@@ -1554,10 +1642,12 @@ struct headset *headset_init(struct devi
 	hs->rfcomm_ch = -1;
 	hs->sp_gain = -1;
 	hs->mic_gain = -1;
 	hs->search_hfp = server_is_enabled(HANDSFREE_SVCLASS_ID);
 	hs->hfp_active = FALSE;
+	hs->cli_active = FALSE;
+	hs->ph_number = NULL;
 
 	if (!record)
 		goto register_iface;
 
 	switch (svc) {
Index: audio/audio-api.txt
===================================================================
RCS file: /cvsroot/bluez/utils/audio/audio-api.txt,v
retrieving revision 1.27
diff -u -5 -p -r1.27 audio-api.txt
--- audio/audio-api.txt	9 Jan 2008 03:00:22 -0000	1.27
+++ audio/audio-api.txt	22 Jan 2008 11:23:13 -0000
@@ -181,17 +181,24 @@ Methods		void Connect()
 
 		void SetMicrophoneGain(uint16 gain)
 
 			Changes the current speaker gain if possible.
 
-                void SetupCall(string value)
+                void SetupCall(string value) [experimental]
 
 			Sets up an call with the connected HFP. The value can
 			be "incoming", "outgoing" or "remote" to indicate
 			incoming call, outgoing call and remote party alerted
 			respectively.
 
+                void IdentifyCall(string phone_number, int32 type) [experimental]
+                         
+                        Enables a called subscriber to get the calling
+                        line identity (CLI) of the calling party when
+                        receiving a call. The value of type shud be
+                        the same as provided by the GSM stack.                       
+
 Signals		void AnswerRequested()
 
 			Sent when the answer button is pressed on the headset
 
 		void Connected()

[-- Attachment #3: Type: text/plain, Size: 228 bytes --]

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/

[-- Attachment #4: Type: text/plain, Size: 164 bytes --]

_______________________________________________
Bluez-devel mailing list
Bluez-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-devel

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

* Re: [Bluez-devel] Asus WL-BTD202 needs force_scofix
  2008-01-22  8:47 [Bluez-devel] Asus WL-BTD202 needs force_scofix Guillaume Bedot
  2008-01-22 11:37 ` [Bluez-devel] [PATCH][HFP] Support for CLIP Alok
@ 2008-01-22 11:40 ` Marcel Holtmann
  2008-01-26 10:42   ` Guillaume Bedot
  1 sibling, 1 reply; 5+ messages in thread
From: Marcel Holtmann @ 2008-01-22 11:40 UTC (permalink / raw)
  To: BlueZ development

Hi Guillaume,

> I'm currently testing bluetooth audio with latest cvs.
> 
> I use this dongle and a mono headset (PROF PBH-6W) :
> $ /usr/sbin/lsusb | grep ASUS
> Bus 001 Device 002: ID 0b05:1715 ASUSTek Computer, Inc. 
> 
> Apparently, it only works with this option set hci_usb :
> options hci_usb force_scofix=1
> 
> Recording and playback work, mostly.
> Sometimes noise is produced, retrying once or twice make it work...
> 
> Could this option be set as a default in hci_usb.c, or could it have
> some drawback I'm not aware of ?

include the content of /proc/bus/usb/devices for this dongle and create
a kernel patch for hci_usb to always enable the SCO fix.

Regards

Marcel



-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Bluez-devel mailing list
Bluez-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-devel

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

* Re: [Bluez-devel] Asus WL-BTD202 needs force_scofix
  2008-01-22 11:40 ` [Bluez-devel] Asus WL-BTD202 needs force_scofix Marcel Holtmann
@ 2008-01-26 10:42   ` Guillaume Bedot
  2008-01-28  8:38     ` Guillaume Bedot
  0 siblings, 1 reply; 5+ messages in thread
From: Guillaume Bedot @ 2008-01-26 10:42 UTC (permalink / raw)
  To: BlueZ development

[-- Attachment #1: Type: text/plain, Size: 2544 bytes --]


Le mardi 22 janvier 2008 à 12:40 +0100, Marcel Holtmann a écrit :
> Hi Guillaume,
> 
> > I'm currently testing bluetooth audio with latest cvs.
> > 
> > I use this dongle and a mono headset (PROF PBH-6W) :
> > $ /usr/sbin/lsusb | grep ASUS
> > Bus 001 Device 002: ID 0b05:1715 ASUSTek Computer, Inc. 
> > 
> > Apparently, it only works with this option set hci_usb :
> > options hci_usb force_scofix=1
> > 
> > Recording and playback work, mostly.
> > Sometimes noise is produced, retrying once or twice make it work...
> > 
> > Could this option be set as a default in hci_usb.c, or could it have
> > some drawback I'm not aware of ?
> 
> include the content of /proc/bus/usb/devices for this dongle
T:  Bus=01 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#=  3 Spd=12  MxCh= 0
D:  Ver= 2.00 Cls=e0(unk. ) Sub=01 Prot=01 MxPS=64 #Cfgs=  1
P:  Vendor=0b05 ProdID=1715 Rev= 1.00
S:  Manufacturer=Broadcom Corp
S:  Product=WL-BTD202
C:* #Ifs= 4 Cfg#= 1 Atr=a0 MxPwr=100mA
I:* If#= 0 Alt= 0 #EPs= 3 Cls=e0(unk. ) Sub=01 Prot=01 Driver=hci_usb
E:  Ad=81(I) Atr=03(Int.) MxPS=  16 Ivl=1ms
E:  Ad=82(I) Atr=02(Bulk) MxPS=  64 Ivl=0ms
E:  Ad=02(O) Atr=02(Bulk) MxPS=  64 Ivl=0ms
I:  If#= 1 Alt= 0 #EPs= 2 Cls=e0(unk. ) Sub=01 Prot=01 Driver=hci_usb
E:  Ad=83(I) Atr=01(Isoc) MxPS=   0 Ivl=1ms
E:  Ad=03(O) Atr=01(Isoc) MxPS=   0 Ivl=1ms
I:  If#= 1 Alt= 1 #EPs= 2 Cls=e0(unk. ) Sub=01 Prot=01 Driver=hci_usb
E:  Ad=83(I) Atr=01(Isoc) MxPS=   9 Ivl=1ms
E:  Ad=03(O) Atr=01(Isoc) MxPS=   9 Ivl=1ms
I:* If#= 1 Alt= 2 #EPs= 2 Cls=e0(unk. ) Sub=01 Prot=01 Driver=hci_usb
E:  Ad=83(I) Atr=01(Isoc) MxPS=  17 Ivl=1ms
E:  Ad=03(O) Atr=01(Isoc) MxPS=  17 Ivl=1ms
I:  If#= 1 Alt= 3 #EPs= 2 Cls=e0(unk. ) Sub=01 Prot=01 Driver=hci_usb
E:  Ad=83(I) Atr=01(Isoc) MxPS=  25 Ivl=1ms
E:  Ad=03(O) Atr=01(Isoc) MxPS=  25 Ivl=1ms
I:  If#= 1 Alt= 4 #EPs= 2 Cls=e0(unk. ) Sub=01 Prot=01 Driver=hci_usb
E:  Ad=83(I) Atr=01(Isoc) MxPS=  33 Ivl=1ms
E:  Ad=03(O) Atr=01(Isoc) MxPS=  33 Ivl=1ms
I:  If#= 1 Alt= 5 #EPs= 2 Cls=e0(unk. ) Sub=01 Prot=01 Driver=hci_usb
E:  Ad=83(I) Atr=01(Isoc) MxPS=  49 Ivl=1ms
E:  Ad=03(O) Atr=01(Isoc) MxPS=  49 Ivl=1ms
I:* If#= 2 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=(none)
E:  Ad=84(I) Atr=02(Bulk) MxPS=  32 Ivl=0ms
E:  Ad=04(O) Atr=02(Bulk) MxPS=  32 Ivl=0ms
I:* If#= 3 Alt= 0 #EPs= 0 Cls=fe(app. ) Sub=01 Prot=00 Driver=(none)


>  and create
> a kernel patch for hci_usb to always enable the SCO fix.

It is the joined file (it remains to test though).

What's the use of usb_device_id blacklist_ids[] ?

Best regards,

Guillaume B.

[-- Attachment #2: hci_usb.c-automatically-set-scofix-for-wl-btd202.patch --]
[-- Type: text/x-patch, Size: 393 bytes --]

--- drivers/bluetooth/hci_usb.c.orig	2008-01-26 11:33:36.000000000 +0100
+++ drivers/bluetooth/hci_usb.c	2008-01-26 11:36:43.000000000 +0100
@@ -98,6 +98,9 @@
 	/* Canyon CN-BTU1 with HID interfaces */
 	{ USB_DEVICE(0x0c10, 0x0000), .driver_info = HCI_RESET },
 
+	/* ASUS WL-BTD202 */
+	{ USB_DEVICE(0x0b05, 0x1715), .driver_info = HCI_WRONG_SCO_MTU },
+
 	{ }	/* Terminating entry */
 };
 

[-- Attachment #3: Type: text/plain, Size: 228 bytes --]

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/

[-- Attachment #4: Type: text/plain, Size: 164 bytes --]

_______________________________________________
Bluez-devel mailing list
Bluez-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-devel

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

* Re: [Bluez-devel] Asus WL-BTD202 needs force_scofix
  2008-01-26 10:42   ` Guillaume Bedot
@ 2008-01-28  8:38     ` Guillaume Bedot
  0 siblings, 0 replies; 5+ messages in thread
From: Guillaume Bedot @ 2008-01-28  8:38 UTC (permalink / raw)
  To: BlueZ development

[-- Attachment #1: Type: text/plain, Size: 74 bytes --]

Hello,

Hopefully, this time a working patch :-)

Regards,

Guillaume B.


[-- Attachment #2: hci_usb.c-automatically-set-scofix-for-wl-btd202-v2.patch --]
[-- Type: text/x-patch, Size: 437 bytes --]

--- drivers/bluetooth/hci_usb.c.orig	2008-01-28 02:43:22.000000000 +0100
+++ drivers/bluetooth/hci_usb.c	2008-01-28 00:34:12.000000000 +0100
@@ -104,6 +104,9 @@
 MODULE_DEVICE_TABLE (usb, bluetooth_ids);
 
 static struct usb_device_id blacklist_ids[] = {
+	/* ASUS WL-BTD202 */
+	{ USB_DEVICE(0x0b05, 0x1715), .driver_info = HCI_WRONG_SCO_MTU },
+
 	/* CSR BlueCore devices */
 	{ USB_DEVICE(0x0a12, 0x0001), .driver_info = HCI_CSR },
 

[-- Attachment #3: Type: text/plain, Size: 228 bytes --]

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/

[-- Attachment #4: Type: text/plain, Size: 164 bytes --]

_______________________________________________
Bluez-devel mailing list
Bluez-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-devel

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

end of thread, other threads:[~2008-01-28  8:38 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-01-22  8:47 [Bluez-devel] Asus WL-BTD202 needs force_scofix Guillaume Bedot
2008-01-22 11:37 ` [Bluez-devel] [PATCH][HFP] Support for CLIP Alok
2008-01-22 11:40 ` [Bluez-devel] Asus WL-BTD202 needs force_scofix Marcel Holtmann
2008-01-26 10:42   ` Guillaume Bedot
2008-01-28  8:38     ` Guillaume Bedot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox