[tuxdroid-svn] r413 - in daemon/trunk: . libs
Status: Beta
Brought to you by:
ks156
From: neimad <c2m...@c2...> - 2007-06-23 15:28:25
|
Author: neimad Date: 2007-06-23 17:27:46 +0200 (Sat, 23 Jun 2007) New Revision: 413 Modified: daemon/trunk/libs/USBDaemon_command_tux.c daemon/trunk/libs/USBDaemon_command_tux.h daemon/trunk/libs/USBDaemon_usb_enum.c daemon/trunk/main.c Log: * Moved audio initialization out of usb_capture_TuxDroid() so as to avoid an inter-dependency between modules USBDaemon_usb_enum and USBDaemon_command_tux. Audio is now initialized directly by main(). Not very nice, but this is just a step towards a nicer separation between low-level usb module, commands and the future higher-level "droid" object. Modified: daemon/trunk/libs/USBDaemon_command_tux.c =================================================================== --- daemon/trunk/libs/USBDaemon_command_tux.c 2007-06-21 14:07:21 UTC (rev 412) +++ daemon/trunk/libs/USBDaemon_command_tux.c 2007-06-23 15:27:46 UTC (rev 413) @@ -962,6 +962,17 @@ } /** + * Initialize audio. + */ +void tux_audio_init(void) +{ + /* Resets audio channel selection; there are 2 audio interfaces in the + * dongle, the second is dedicated to TTS. */ + send_usb_dongle_cmd(USB_AUDIO_CMD, 0, 0, 0); + current_audio_channel = 0; +} + +/** * Disconnect from tux * * The return value only tells whether the command has been sent successfully Modified: daemon/trunk/libs/USBDaemon_command_tux.h =================================================================== --- daemon/trunk/libs/USBDaemon_command_tux.h 2007-06-21 14:07:21 UTC (rev 412) +++ daemon/trunk/libs/USBDaemon_command_tux.h 2007-06-23 15:27:46 UTC (rev 413) @@ -41,6 +41,7 @@ unsigned char param1, unsigned char param2, unsigned char param3); +extern void tux_audio_init(void); extern unsigned char send_wave_wings(unsigned char count, unsigned char speed); extern unsigned char send_stop_wings(); extern unsigned char send_blink_eyes(unsigned char count); Modified: daemon/trunk/libs/USBDaemon_usb_enum.c =================================================================== --- daemon/trunk/libs/USBDaemon_usb_enum.c 2007-06-21 14:07:21 UTC (rev 412) +++ daemon/trunk/libs/USBDaemon_usb_enum.c 2007-06-23 15:27:46 UTC (rev 413) @@ -29,7 +29,6 @@ #include "USBDaemon_log.h" #include "USBDaemon_status_table.h" #include "USBDaemon_usb_readWrite.h" -#include "USBDaemon_command_tux.h" #include "USBDaemon_tcp_server.h" /*_____________________ V A R I A B L E S __________________________________*/ @@ -156,11 +155,6 @@ usb_connection_status = USB_CONNECTED; - /* Resets audio channel selection; there are 2 audio interfaces in the - * dongle, the second is dedicated to TTS. */ - send_usb_dongle_cmd(USB_AUDIO_CMD, 0, 0, 0); - current_audio_channel = 0; - return 1; } Modified: daemon/trunk/main.c =================================================================== --- daemon/trunk/main.c 2007-06-21 14:07:21 UTC (rev 412) +++ daemon/trunk/main.c 2007-06-23 15:27:46 UTC (rev 413) @@ -40,6 +40,7 @@ #include "libs/USBDaemon_usb_enum.h" #include "libs/USBDaemon_tcp_server.h" #include "libs/USBDaemon_status_table.h" +#include "libs/USBDaemon_command_tux.h" #include "version.h" /*_____________________ F U N C T I O N S __________________________________*/ @@ -398,6 +399,8 @@ if (drop_privileges() < 0) exit(1); + tux_audio_init(); + if (tcp_server_init() < 0) exit(1); |