public inbox for linux-bluetooth@vger.kernel.org
 help / color / mirror / Atom feed
* [Bluez-devel] patch removing one extra memset
@ 2008-01-07 23:09 Pavel Semerad
  2008-01-07 23:47 ` Brad Midgley
  0 siblings, 1 reply; 5+ messages in thread
From: Pavel Semerad @ 2008-01-07 23:09 UTC (permalink / raw)
  To: bluez-devel


Helo,

I have found one mistake in audio/ctl_bluetooth.c . When initializing
this plugin, 'data' is allocated and memset-ed to 0. Then socket is
created and assigned to 'data'. And then there is another memset, which
sets this socket back to zero.
    Patch removing this extra memset is attached:

--- ./audio/ctl_bluetooth.c.ps  2007-12-08 20:04:39.000000000 +0100
+++ ./audio/ctl_bluetooth.c     2008-01-07 23:41:23.000000000 +0100
@ -327,8 +327,6 @@ SND_CTL_PLUGIN_DEFINE_FUNC(bluetooth)
        if (err < 0)
                goto error;
 
-       memset(data, 0, sizeof(*data));
-
        data->ext.version = SND_CTL_EXT_VERSION;
        data->ext.card_idx = -1;
 

Pavel Semerad


-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
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] patch removing one extra memset
  2008-01-07 23:09 [Bluez-devel] patch removing one extra memset Pavel Semerad
@ 2008-01-07 23:47 ` Brad Midgley
  2008-01-08 15:23   ` [Bluez-devel] [PATCH] HFP method "SetupCall" + audio-api.txt update Alok
  0 siblings, 1 reply; 5+ messages in thread
From: Brad Midgley @ 2008-01-07 23:47 UTC (permalink / raw)
  To: BlueZ development

Pavel

> I have found one mistake in audio/ctl_bluetooth.c . When initializing
> this plugin, 'data' is allocated and memset-ed to 0. Then socket is
> created and assigned to 'data'. And then there is another memset

ok, fixed. I also saw the first memset happened before the test to see
if the malloc worked.

-- 
Brad

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
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 method "SetupCall" + audio-api.txt update
  2008-01-07 23:47 ` Brad Midgley
@ 2008-01-08 15:23   ` Alok
  2008-01-08 18:28     ` Marcel Holtmann
  0 siblings, 1 reply; 5+ messages in thread
From: Alok @ 2008-01-08 15:23 UTC (permalink / raw)
  To: BlueZ development

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

Hi Johan/Fredric, 

Here is a patch for adding the SetupCall method , used for call setup on
hfp. Also adding a patch to update the audio-api.txt file for the same. 

Let me know if anything needs to be changed. 

-Alok.

[-- Attachment #2: audio-api.patch --]
[-- Type: text/x-patch, Size: 1306 bytes --]

Index: audio/audio-api.txt
===================================================================
RCS file: /cvsroot/bluez/utils/audio/audio-api.txt,v
retrieving revision 1.25
diff -u -5 -p -r1.25 audio-api.txt
--- audio/audio-api.txt	29 Aug 2007 11:41:15 -0000	1.25
+++ audio/audio-api.txt	8 Jan 2008 15:01:51 -0000
@@ -181,10 +181,17 @@ Methods		void Connect()
 
 		void SetMicrophoneGain(uint16 gain)
 
 			Changes the current speaker gain if possible.
 
+                void SetupCall(string value)
+
+                        Sets up an call with the connected HFP.
+                        value can be incoming, outgoing
+                        or remote to indicate incoming call, outgoing
+                        call and remote party alerted respectively.                                                                   
+
 Signals		void AnswerRequested()
 
 			Sent when the answer button is pressed on the headset
 
 		void Connected()
@@ -209,10 +216,14 @@ Signals		void AnswerRequested()
 
 		void MicrophoneGainChanged(uint16 gain)
 
 			The microphone gain changed.
 
+                void TerminateCall()
+
+                        Sent when an ongoing call is terminated.                
+
 
 org.bluez.audio.Gateway interface
 =================================
 
 [not yet implemented]

[-- Attachment #3: setupCall.patch --]
[-- Type: text/x-patch, Size: 2423 bytes --]

Index: audio/headset.c
===================================================================
RCS file: /cvsroot/bluez/utils/audio/headset.c,v
retrieving revision 1.153
diff -u -5 -p -r1.153 headset.c
--- audio/headset.c	8 Jan 2008 14:45:32 -0000	1.153
+++ audio/headset.c	8 Jan 2008 14:52:49 -0000
@@ -1395,10 +1395,60 @@ static DBusHandlerResult hs_set_mic_gain
 						void *data)
 {
 	return hs_set_gain(conn, msg, data, HEADSET_GAIN_MICROPHONE);
 }
 
+static DBusHandlerResult hf_setup_call(DBusConnection *conn,
+						DBusMessage *msg,
+						void *data)
+{
+	struct device *device = data;
+	struct headset *hs = device->headset;
+	DBusMessage *reply;
+	DBusError derr;
+	const char *value;
+	int err;
+
+	if (!hs->hfp_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, &value,
+				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 (!strncmp(value, "incoming", 8))
+		err = headset_send(hs, "\r\n+CIEV:3, 1\r\n");
+	else if (!strncmp(value, "outgoing", 8))
+		err = headset_send(hs, "\r\n+CIEV:3, 2\r\n");
+	else if (!strncmp(value, "remote", 6))
+		err = headset_send(hs, "\r\n+CIEV:3, 3\r\n");
+	else
+		err = -EINVAL;
+
+	if (err < 0) {
+		dbus_message_unref(reply);
+		return error_failed_errno(conn, msg, -err);
+	}
+
+	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,		"",	""	},
@@ -1408,10 +1458,11 @@ static DBusMethodVTable headset_methods[
 	{ "IsPlaying",		hs_is_playing,		"",	"b"	},
 	{ "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",	""	},
 	{ NULL, NULL, NULL, NULL }
 };
 
 static DBusSignalVTable headset_signals[] = {
 	{ "Connected",			""	},

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

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace

[-- Attachment #5: 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] [PATCH] HFP method "SetupCall" + audio-api.txt update
  2008-01-08 15:23   ` [Bluez-devel] [PATCH] HFP method "SetupCall" + audio-api.txt update Alok
@ 2008-01-08 18:28     ` Marcel Holtmann
  2008-01-09  3:06       ` Johan Hedberg
  0 siblings, 1 reply; 5+ messages in thread
From: Marcel Holtmann @ 2008-01-08 18:28 UTC (permalink / raw)
  To: BlueZ development

Hi Alok,

> Here is a patch for adding the SetupCall method , used for call setup on
> hfp. Also adding a patch to update the audio-api.txt file for the same. 
> 
> Let me know if anything needs to be changed. 

the signal should be "CallTerminated" or its description is wrong. A
name like "TerminateCall" would be a name for a method.

Regards

Marcel



-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
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] [PATCH] HFP method "SetupCall" + audio-api.txt update
  2008-01-08 18:28     ` Marcel Holtmann
@ 2008-01-09  3:06       ` Johan Hedberg
  0 siblings, 0 replies; 5+ messages in thread
From: Johan Hedberg @ 2008-01-09  3:06 UTC (permalink / raw)
  To: BlueZ development

Hi Marcel,

On Jan 8, 2008, at 20:28, Marcel Holtmann wrote:
>> Here is a patch for adding the SetupCall method , used for call  
>> setup on
>> hfp. Also adding a patch to update the audio-api.txt file for the  
>> same.
>>
>> Let me know if anything needs to be changed.
>
> the signal should be "CallTerminated" or its description is wrong. A
> name like "TerminateCall" would be a name for a method.

The CVS now has the correct name for the signal ("CallTerminated").

Johan

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
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-09  3:06 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-01-07 23:09 [Bluez-devel] patch removing one extra memset Pavel Semerad
2008-01-07 23:47 ` Brad Midgley
2008-01-08 15:23   ` [Bluez-devel] [PATCH] HFP method "SetupCall" + audio-api.txt update Alok
2008-01-08 18:28     ` Marcel Holtmann
2008-01-09  3:06       ` Johan Hedberg

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