All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Frédéric DALLEAU" <frederic.dalleau@palmsource.com>
To: BlueZ development <bluez-devel@lists.sourceforge.net>
Subject: Re: [Bluez-devel] a2dpd: cmdplay fails: "No such application: 'amarok player play'"
Date: Mon, 15 Jan 2007 17:43:55 +0100	[thread overview]
Message-ID: <45ABAF4B.6050702@palmsource.com> (raw)
In-Reply-To: <45AB9C88.1040808@xmission.com>

Brad,

I already tried system here and this led to strange interactions between =

processes. I just tried it again (in case it would be better) and it is =

still the same.

Here is the procedure to reproduce :
 - xmms must not be started.
 - start a2dpd.
 - then from an avrcp headset press play to connect : xmms will start.
 - kill a2dpd : xmms will deadlock.

Any player should behave the same. I found that the a2dpd main unix =

socket must be closed immediatly after any fork(). I suspect the socket =

remain open in the xmms process space which will try to write to an open =

socket that is no longer polled for data, thus deadlock (btw, can any =

linux guru confirm?). Any process started by system() will be forked but =

this socket won't be closed.

More over, the execution must be asynchronous, system("xmms") will wait =

until you terminate xmms before returning, system("xmms &") should work.

It is still possible to fork() then close_server_socket() then system() =

as did Robert, but a shell is spawned for that (+ 2 additionnal fork =

calls!) which is a few megabytes that could be used better...

It should be enough to rewrite the parser code just before so it handles =

more parameters.
        char* argv[2];
        strncpy(command, cmd, sizeof(command));
        command[sizeof(command)-1]=3D '\0';
        argv[0] =3D strchr(command, ' ');
        if(argv[0]) { *argv[0]=3D'\0'; argv[0]++; }

I stay open to any other solutions if this limitation is a real problem, =

but as stated in amarok man page :
   Options:
       -r, --previous
              Skip backwards in playlist
       -p, --play
              Start playing current playlist
       -s, --stop
              Stop playback
       --pause
              Pause playback
       -f, --next
              Skip forwards in playlist

Fr=E9d=E9ric


Brad Midgley a =E9crit :
> Robert
>
> this idea looks ok. The extra fork() could be removed.
>
> Brad
>
>   =

>> Index: a2dpd_ipc.c
>> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
>> RCS file: /cvsroot/bluetooth-alsa/plugz/alsa-plugins/a2dpd/a2dpd_ipc.c,v
>> retrieving revision 1.3
>> diff -u -r1.3 a2dpd_ipc.c
>> --- a2dpd_ipc.c 12 Jan 2007 16:34:01 -0000      1.3
>> +++ a2dpd_ipc.c 15 Jan 2007 02:02:15 -0000
>> @@ -384,8 +384,10 @@
>>                                  close_server_socket_on_fork();
>>
>>                                  // Replace children with new process
>> -                                i =3D execlp(command, command, argv[0],=
 NULL);
>> -                                DBG("execlp failed %s=3D%d (errno=3D%d:=
%s)", cmd, =

>> i, errno, strerror(errno));
>> +                                system(cmd);
>> +                                exit(0);
>>                                  break;
>>                          case -1:
>>                                  // failed
>>     =

>
> -------------------------------------------------------------------------
> Take Surveys. Earn Cash. Influence the Future of IT
> Join SourceForge.net's Techsay panel and you'll get the chance to share y=
our
> opinions on IT & business topics through brief surveys - and earn cash
> http://www.techsay.com/default.php?page=3Djoin.php&p=3Dsourceforge&CID=3D=
DEVDEV
> _______________________________________________
> Bluez-devel mailing list
> Bluez-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/bluez-devel
>   =



-- =

Frederic

Without the wind, the grass does not move.


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=3Djoin.php&p=3Dsourceforge&CID=3DDE=
VDEV
_______________________________________________
Bluez-devel mailing list
Bluez-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-devel

  reply	other threads:[~2007-01-15 16:43 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-01-15  2:05 [Bluez-devel] a2dpd: cmdplay fails: "No such application: 'amarok player play'" Robert Huitl
2007-01-15 10:16 ` Frédéric DALLEAU
2007-01-23 19:20   ` Michel Brabants
2007-01-24 10:48     ` Frédéric DALLEAU
2007-01-25 19:02       ` Michel Brabants
2007-01-15 15:23 ` Brad Midgley
2007-01-15 16:43   ` Frédéric DALLEAU [this message]
2007-01-16  3:43     ` Brad Midgley

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=45ABAF4B.6050702@palmsource.com \
    --to=frederic.dalleau@palmsource.com \
    --cc=bluez-devel@lists.sourceforge.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.