Skip to contentSkip to conversation

a2dpd getting into an endless loop when it fails to get a socket and not dying on CTRL+c

Bluez-devel Petteri Räty 2 participants 5 messages May 12, 2007 – May 13, 2007 Bluetooth drivers

lore
Share & tools
lore
#0 lore raw

betelgeuse@pena ~ $ a2dpd -n -v -o -g -b
A2DPD[21:17:29.577]: init_ipc: Selected IPC: inet, addr=127.0.0.1, bcst=127.0.0.255, port=8000
A2DPD[21:17:29.577]: make_daemon_process: a2dpd [May 12 2007 19:46:25] starting ...
A2DPD[21:17:29.577]: main: (errno=13:Permission denied)a2dpd addr=00:13:17:70:3E:A0 timer=0 us [May 12 2007 19:46:26] A2DPD[21:17:29.577]: a2dpd_signal_init: Getting on DBUS A2DPD[21:17:29.579]: a2dpd_signal_init: Installing watch A2DPD[21:17:29.579]: add_dbus_watch: Added watch 0 0x80a3770 disabled A2DPD[21:17:29.579]: add_dbus_watch: Added watch 1 0x80a3798 enabled A2DPD[21:17:29.579]: a2dpd_signal_init: Registering object path:
/com/access/a2dpd
A2DPD[21:17:29.579]: a2dpd_signal_init: Acquiring service: com.access.a2dpd A2DPD[21:17:29.580]: a2dpd_signal_init: OK
A2DPD[21:17:29.580]: a2dpd_signal_init: OK
A2DPD[21:17:29.580]: a2dpd_register_sdp: Start A2DPD[21:17:29.580]: add_avrtg:
A2DPD[21:17:29.580]: add_a2source:
A2DPD[21:17:29.580]: a2dpd_register_sdp: OK A2DPD[21:17:29.580]: main_loop:
A2DPD[21:17:29.581]: make_server_socket:
A2DPD[21:17:29.581]: a2dp_make_listen_socket: (errno=13:Permission denied)Cannot bind socket 6 for psm 25
A2DPD[21:17:29.581]: main_loop: Cannot get AVDTP socket A2DPD[21:17:30.581]: main_loop:
A2DPD[21:17:30.581]: make_server_socket:
A2DPD[21:17:30.581]: main_loop: (errno=98:Address already in use)Cannot get UNIX socket
A2DPD[21:17:31.581]: main_loop:
A2DPD[21:17:31.581]: make_server_socket:
A2DPD[21:17:31.581]: main_loop: (errno=98:Address already in use)Cannot get UNIX socket
A2DPD[21:17:32.581]: main_loop:
A2DPD[21:17:32.581]: make_server_socket:
A2DPD[21:17:32.581]: main_loop: (errno=98:Address already in use)Cannot get UNIX socket
A2DPD[21:17:33.514]: sigint_handler: handling SIGINT A2DPD[21:17:33.514]: main_loop: (errno=4:Interrupted system call) A2DPD[21:17:33.514]: make_server_socket:
A2DPD[21:17:33.514]: main_loop: (errno=98:Address already in use)Cannot get UNIX socket
A2DPD[21:17:33.968]: sigint_handler: handling SIGINT

Basically it seems to go into an endless loop when it can't get the socket and I must then kill it with kill -9 <pid>.

I tried to change various things in .a2pdrc but didn't make a difference.

Regards,
Petteri

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/

_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

#1 lore raw
Quoted 2 lines

Basically it seems to go into an endless loop when it can't get the socket and I must then kill it with kill -9 <pid>.

Try to run it as root to get the sockets.
You'll need to run your player as root too.
It can't figure why these sockets are failing until I get a computer doing it.

Regards,
Frederic

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/

_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

#2 lore raw
In reply to Petteri Räty

Petteri Räty kirjoitti:

Quoted 4 lines

Basically it seems to go into an endless loop when it can't get the socket and I must then kill it with kill -9 <pid>.

Attached is a patch that fixes this.

Regards,
Petteri

Index: a2dpd.c
===================================================================
RCS file: /cvsroot/bluetooth-alsa/plugz/alsa-plugins/a2dpd/a2dpd.c,v retrieving revision 1.31

a2dpd.c +1 -1
diff -u -r1.31 a2dpd.c
@@ -1780,7 +1780,7 @@
 	a2dp_init();
 
 	// Run main loop
-	while(main_loop(addr)<0) {
+	while(main_loop(addr)<0 && !bSigINTReceived) {
 		sleep(1);
 	}
 

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/

_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

#3 lore raw

Petteri Räty kirjoitti:

Quoted 11 lines

Petteri Räty kirjoitti:

Quoted 3 lines

Basically it seems to go into an endless loop when it can't get the socket and I must then kill it with kill -9 <pid>.

Attached is a patch that fixes this.

Regards,
Petteri

Can someone explain why this code is in the main loop in the first place. I would think that the sockets need to be created only once.

	// Master socket
	sockfd = make_server_socket();
	if(sockfd<0) {
		DBG("Cannot get UNIX socket");
		return -1;
	}

	avdtpfd = a2dp_make_listen_socket(25);
	if(avdtpfd<0) {
		DBG("Cannot get AVDTP socket");
		return -1;
	}

Regards,
Petteri

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/

_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

#4 lore raw
Quoted 2 lines

Can someone explain why this code is in the main loop in the first place. I would think that the sockets need to be created only once.

This is mainly historical, as the main_loop wasn't called in loop first.
If the socket fails to create, a2dpd will retry until it is ok. This is useful when coding, if you forgot another process running.

Frederic

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/

_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel