tux-droid-svn Mailing List for Tux Droid CE (Page 228)
Status: Beta
Brought to you by:
ks156
You can subscribe to this list here.
2007 |
Jan
|
Feb
(32) |
Mar
(108) |
Apr
(71) |
May
(38) |
Jun
(128) |
Jul
(1) |
Aug
(14) |
Sep
(77) |
Oct
(104) |
Nov
(90) |
Dec
(71) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2008 |
Jan
(81) |
Feb
(18) |
Mar
(40) |
Apr
(102) |
May
(151) |
Jun
(74) |
Jul
(151) |
Aug
(257) |
Sep
(447) |
Oct
(379) |
Nov
(404) |
Dec
(430) |
2009 |
Jan
(173) |
Feb
(236) |
Mar
(519) |
Apr
(300) |
May
(112) |
Jun
(232) |
Jul
(314) |
Aug
(58) |
Sep
(203) |
Oct
(293) |
Nov
(26) |
Dec
(109) |
2010 |
Jan
(19) |
Feb
(25) |
Mar
(33) |
Apr
(1) |
May
|
Jun
(3) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: jaguarondi <c2m...@c2...> - 2007-05-31 12:13:34
|
Author: jaguarondi Date: 2007-05-31 14:13:32 +0200 (Thu, 31 May 2007) New Revision: 332 Modified: daemon/trunk/main.c Log: - CHG: pid file is only written in daemon mode, it is now possible to launch tuxdaemon as a non-root user if you don't daemonize it. Modified: daemon/trunk/main.c =================================================================== --- daemon/trunk/main.c 2007-05-31 09:02:10 UTC (rev 331) +++ daemon/trunk/main.c 2007-05-31 12:13:32 UTC (rev 332) @@ -55,6 +55,7 @@ unsigned char show_raw_status = 0; unsigned char show_invalid_raw = 0; unsigned short daemon_pid = 0; +unsigned char daemonized = 0; /************************************************************************ */ @@ -133,10 +134,10 @@ { send_daemon_disconnected(); - if (remove_pid()) + if (daemonized && remove_pid()) log_error("Could not delete PID file"); - log_info("terminated"); + log_info("tuxdaemon stopped"); log_close(); } @@ -275,7 +276,6 @@ unsigned char i; log_target_t log_target = LOG_TARGET_SYSLOG; log_level_t log_level = LOG_LEVEL_INFO; - unsigned char daemonized = 0; /* On exiting */ signal(SIGINT, quit_handler); @@ -311,10 +311,10 @@ } } - /* Only one instance of the daemon is authorized */ + /* Only one instance of the daemon is allowed */ if (check_pid()) { - printf("Tuxdaemon is already launched !\n"); + printf("tuxdaemon is already running!\n"); exit(0); } @@ -327,9 +327,6 @@ log_open(LOG_TARGET_SHELL); log_set_level(log_level); - - if (!write_pid()) - exit(1); } /* Setup & print daemon information */ |
From: jaguarondi <c2m...@c2...> - 2007-05-31 09:02:40
|
Author: jaguarondi Date: 2007-05-31 11:02:10 +0200 (Thu, 31 May 2007) New Revision: 331 Modified: firmware/tuxcore/trunk/main.c Log: - ADD: configure all blocks and pins to minimize power during sleep. Modified: firmware/tuxcore/trunk/main.c =================================================================== --- firmware/tuxcore/trunk/main.c 2007-05-31 07:46:46 UTC (rev 330) +++ firmware/tuxcore/trunk/main.c 2007-05-31 09:02:10 UTC (rev 331) @@ -40,7 +40,8 @@ #define DBG_STACK 0 /* stack overflow detection */ #define TEST_CHARGER 0 /* use eyes LED's to indicate charger status */ -void ioInit(void); +void initIO(void); +void closeIO(void); void timer2Init(void); void updateStatus(void); void sleep(void); @@ -201,7 +202,7 @@ initMotors(); initIR(); timer2Init(); - ioInit(); + initIO(); config_init(); /* I2C communication initialization */ @@ -278,7 +279,7 @@ * I/O initialisation * */ -void ioInit(void) +void initIO(void) { /* Set charger inhibit line as output */ CHARGER_INH_DDR |= CHARGER_INH_MK; @@ -316,6 +317,19 @@ } /* + * Close IO pins to minimize power consumption. + * + * CHARGER_INH and IR stay configured, they're just turned off. + */ +void closeIO(void) +{ + PCICR = 0; + EICRA = 0; + ADCSRA = 0; + turnLedsOff(); + turnIrOff(); +} +/* * timer 2 intitialisation * * Main tick timer every 4ms. A 8 bits software counter @@ -387,13 +401,27 @@ } /* - * Sleep functions + * Sleep function + * + * Configures all blocks and pins to minimize power, + * sleep until a wake-up condition is met, + * restore the configuration to continue normal operation. */ void sleep(void) { + uint8_t led_bak; + uint8_t PRR_bak; + /* Set power savings configuration. */ + led_bak = readLeds(); + closeIO(); closePosSwitches(); + stopSpin(); + stopMouth(); + stopWings(); + PRR_bak = PRR; + PRR = _BV(PRTTWI) | _BV(PRTIM2) | _BV(PRTIM0) | _BV(PRTIM1) | _BV(PRADC); /* Sleep. */ while(SW_HD_PIN & SW_HD_MK) /* exit sleep if head is pushed */ @@ -402,9 +430,13 @@ } /* Re-configure in normal mode. */ + PRR = PRR_bak; + setLeds(led_bak); /* restore leds status */ + i2cCommunicationInit(); initPosSwitches(); + initIO(); - /* Set the post-sleep event */ + /* Trigger the post-sleep event */ cond_flags.sleep = COND_POST_SLEEP; - event_timer = 2; /* wait 200ms for the pull-up to rise before next standalone behavior */ + event_timer = 2; /* wait 200ms for the pull-up to rise before next standalone behavior otherwise position switches signals are wrong */ } |
From: thomas_c <c2m...@c2...> - 2007-05-31 07:47:19
|
Author: thomas_c Date: 2007-05-31 09:46:46 +0200 (Thu, 31 May 2007) New Revision: 330 Added: software/tux_pidgin/trunk/version.txt Log: Add version.txt Added: software/tux_pidgin/trunk/version.txt =================================================================== --- software/tux_pidgin/trunk/version.txt (rev 0) +++ software/tux_pidgin/trunk/version.txt 2007-05-31 07:46:46 UTC (rev 330) @@ -0,0 +1 @@ +0.0.1(SVN/UNRELEASED) |
From: jaguarondi <c2m...@c2...> - 2007-05-30 14:01:15
|
Author: jaguarondi Date: 2007-05-30 16:00:23 +0200 (Wed, 30 May 2007) New Revision: 329 Modified: firmware/tuxcore/trunk/standalone.c Log: - BUG: when 2 events are happening at the same time, they are conflicting in the event manager. Modified: firmware/tuxcore/trunk/standalone.c =================================================================== --- firmware/tuxcore/trunk/standalone.c 2007-05-30 12:36:27 UTC (rev 328) +++ firmware/tuxcore/trunk/standalone.c 2007-05-30 14:00:23 UTC (rev 329) @@ -94,70 +94,70 @@ } /* Head button */ - if (cond_flags.head) + else if (cond_flags.head) { cond_flags.head = 0; launchActions((const uint8_t *)&head_e); } /* Left flipper button */ - if (cond_flags.left_flip) + else if (cond_flags.left_flip) { cond_flags.left_flip = 0; launchActions((const uint8_t *)&left_flip_e); } /* Right flipper button */ - if (cond_flags.right_flip) + else if (cond_flags.right_flip) { cond_flags.right_flip = 0; launchActions((const uint8_t *)&right_flip_e); } /* Start charging */ - if (cond_flags.charger_start) + else if (cond_flags.charger_start) { cond_flags.charger_start = 0; launchActions((const uint8_t *)&charger_start_e); } /* Unplug condition */ - if (cond_flags.unplug) + else if (cond_flags.unplug) { cond_flags.unplug = 0; launchActions((const uint8_t *)&unplug_e); } /* Entering sleep mode. */ - if (cond_flags.sleep == COND_PRE_SLEEP) + else if (cond_flags.sleep == COND_PRE_SLEEP) { cond_flags.sleep = COND_SLEEP; launchActions((const uint8_t *)&sleep_enter_e); } /* Exiting sleep mode. */ - if (cond_flags.sleep == COND_POST_SLEEP) + else if (cond_flags.sleep == COND_POST_SLEEP) { launchActions((const uint8_t *)&sleep_exit_e); cond_flags.sleep = COND_NO_SLEEP; } /* RF connection */ - if (cond_flags.rf_conn) + else if (cond_flags.rf_conn) { cond_flags.rf_conn = 0; launchActions((const uint8_t *)&rf_conn_e); } /* RF disconnection */ - if (cond_flags.rf_disconn) + else if (cond_flags.rf_disconn) { cond_flags.rf_disconn = 0; launchActions((const uint8_t *)&rf_disconn_e); } /* Tux greetings */ - if (cond_flags.tux_recog == 0xF0) /* send a greeting */ + else if (cond_flags.tux_recog == 0xF0) /* send a greeting */ { cond_flags.tux_recog++; cond_flags.tux_recog_cnt = 3; /* send reply for few secs */ |
From: jaguarondi <c2m...@c2...> - 2007-05-30 12:36:31
|
Author: jaguarondi Date: 2007-05-30 14:36:27 +0200 (Wed, 30 May 2007) New Revision: 328 Modified: firmware/tuxcore/trunk/Makefile firmware/tuxcore/trunk/config.c firmware/tuxcore/trunk/config.h firmware/tuxcore/trunk/global.h firmware/tuxcore/trunk/main.c firmware/tuxcore/trunk/motors.c firmware/tuxcore/trunk/motors.h firmware/tuxcore/trunk/parser.c firmware/tuxcore/trunk/standalone.c Log: - ADD: events for entering and exiting sleep mode. - ADD: closePosSwitches to minimize power during sleep mode. - ADD: closeEyes command. Modified: firmware/tuxcore/trunk/Makefile =================================================================== Modified: firmware/tuxcore/trunk/config.c =================================================================== --- firmware/tuxcore/trunk/config.c 2007-05-29 17:54:51 UTC (rev 327) +++ firmware/tuxcore/trunk/config.c 2007-05-30 12:36:27 UTC (rev 328) @@ -40,6 +40,11 @@ /* Unplug event */ uint8_t unplug_e[SHORT_EVENT] EEMEM = UNPLUG_E_SEQ; +/* Entering sleep event */ +uint8_t sleep_enter_e[SHORT_EVENT] EEMEM = SLEEP_ENTER_E_SEQ; +/* Exiting sleep event */ +uint8_t sleep_exit_e[SHORT_EVENT] EEMEM = SLEEP_EXIT_E_SEQ; + /* RF connection event */ uint8_t rf_conn_e[SHORT_EVENT] EEMEM = RF_CONN_E_SEQ; Modified: firmware/tuxcore/trunk/config.h =================================================================== --- firmware/tuxcore/trunk/config.h 2007-05-29 17:54:51 UTC (rev 327) +++ firmware/tuxcore/trunk/config.h 2007-05-30 12:36:27 UTC (rev 328) @@ -44,6 +44,11 @@ /* Unplug event */ extern uint8_t unplug_e[]; +/* Entering sleep event */ +extern uint8_t sleep_enter_e[]; +/* Exiting sleep event */ +extern uint8_t sleep_exit_e[]; + /* RF connection event */ extern uint8_t rf_conn_e[]; Modified: firmware/tuxcore/trunk/global.h =================================================================== --- firmware/tuxcore/trunk/global.h 2007-05-29 17:54:51 UTC (rev 327) +++ firmware/tuxcore/trunk/global.h 2007-05-30 12:36:27 UTC (rev 328) @@ -332,6 +332,18 @@ extern uint8_t led_backup; /* + * Sleep modes + */ + +typedef enum +{ + COND_NO_SLEEP = 0, + COND_PRE_SLEEP, + COND_SLEEP, + COND_POST_SLEEP, +} sleep_modes_t; + +/* * Condition flags * * TODO merge flags by categories in bitfields or bytes and masks @@ -349,7 +361,7 @@ uint8_t unplug; uint8_t tux_recog_cnt; uint8_t tux_recog; - uint8_t sleep; + sleep_modes_t sleep; /* flags not reset by the COND_RESET_CMD */ uint8_t eyes_closed; uint8_t rf_conn; Modified: firmware/tuxcore/trunk/main.c =================================================================== --- firmware/tuxcore/trunk/main.c 2007-05-29 17:54:51 UTC (rev 327) +++ firmware/tuxcore/trunk/main.c 2007-05-30 12:36:27 UTC (rev 328) @@ -237,8 +237,8 @@ standalone_behavior(); /* standalone behavior manager */ - /* Entering sleep mode */ - if (cond_flags.sleep) + /* Entering sleep mode. */ + if ((cond_flags.sleep == COND_SLEEP) && !event_timer) /* wait for standalone actions to be done */ sleep(); /* @@ -392,11 +392,19 @@ void sleep(void) { - turnLeftLedOff(); + /* Set power savings configuration. */ + closePosSwitches(); + + /* Sleep. */ while(SW_HD_PIN & SW_HD_MK) /* exit sleep if head is pushed */ { /* XXX Enter sleep mode here, either wakeup regularly to check the head button or better configure an interrupt on the head button to wake-up the CPU */ } - turnLeftLedOn(); - cond_flags.sleep = 0; + + /* Re-configure in normal mode. */ + initPosSwitches(); + + /* Set the post-sleep event */ + cond_flags.sleep = COND_POST_SLEEP; + event_timer = 2; /* wait 200ms for the pull-up to rise before next standalone behavior */ } Modified: firmware/tuxcore/trunk/motors.c =================================================================== --- firmware/tuxcore/trunk/motors.c 2007-05-29 17:54:51 UTC (rev 327) +++ firmware/tuxcore/trunk/motors.c 2007-05-30 12:36:27 UTC (rev 328) @@ -201,7 +201,7 @@ void initPosSwitches(void) { - /* wings switch */ + /* flipper switch */ PSW_WINGS_DDR &= ~PSW_WINGS_MK; PSW_WINGS_PT |= PSW_WINGS_MK; /* eyes switches */ @@ -215,6 +215,28 @@ PSW_SPIN_PT |= PSW_SPIN_MK; } +/* + * Set position switches for minimal power consumption. + * + * All pins have internal pull-up and the switch shorts the pin low so to avoid + * undefined states, we must set all pins as strong low. + */ +void closePosSwitches(void) +{ + /* flipper switch */ + PSW_WINGS_PT &= ~PSW_WINGS_MK; + PSW_WINGS_DDR |= PSW_WINGS_MK; + /* eyes switches */ + PSW_EYES_PT &= ~PSW_EYES_MK; + PSW_EYES_DDR |= PSW_EYES_MK; + /* mouth switches */ + PSW_MOUTH_PT &= ~PSW_MOUTH_MK; + PSW_MOUTH_DDR |= PSW_MOUTH_MK; + /* spin switch */ + PSW_SPIN_PT &= ~PSW_SPIN_MK; + PSW_SPIN_DDR |= PSW_SPIN_MK; +} + uint8_t getPosSwitches(void) { // return (PINB & PSW_MK); Modified: firmware/tuxcore/trunk/motors.h =================================================================== --- firmware/tuxcore/trunk/motors.h 2007-05-29 17:54:51 UTC (rev 327) +++ firmware/tuxcore/trunk/motors.h 2007-05-30 12:36:27 UTC (rev 328) @@ -50,6 +50,7 @@ * Init as pull-up input */ void initPosSwitches(void); +void closePosSwitches(void); uint8_t getPosSwitches(void); /* Modified: firmware/tuxcore/trunk/parser.c =================================================================== --- firmware/tuxcore/trunk/parser.c 2007-05-29 17:54:51 UTC (rev 327) +++ firmware/tuxcore/trunk/parser.c 2007-05-30 12:36:27 UTC (rev 328) @@ -80,6 +80,10 @@ { openEyes(); } + else if (command[0] == CLOSE_EYES_CMD) + { + closeEyes(); + } else if (command[0] == MOVE_MOUTH_CMD) { moveMouth(command[1]); @@ -178,7 +182,7 @@ for (i = 0; i < 3; i++) /* forward the command to the audio CPU */ audioIntBuf[i] = command[i]; audioIntBufIdx = 3; - cond_flags.sleep = 1; + cond_flags.sleep = COND_PRE_SLEEP; return; } Modified: firmware/tuxcore/trunk/standalone.c =================================================================== --- firmware/tuxcore/trunk/standalone.c 2007-05-29 17:54:51 UTC (rev 327) +++ firmware/tuxcore/trunk/standalone.c 2007-05-30 12:36:27 UTC (rev 328) @@ -65,7 +65,9 @@ { while ((event_timer <= action.time) && (action.time != END_OF_ACTIONS)) { + /* Execute the pre-loaded action */ split_command_parser(action.command, MAX_COMMAND_SIZE); + /* then load the next action for execution at action.time. */ loadAction(); } event_manager_flag = 0; @@ -126,6 +128,20 @@ launchActions((const uint8_t *)&unplug_e); } + /* Entering sleep mode. */ + if (cond_flags.sleep == COND_PRE_SLEEP) + { + cond_flags.sleep = COND_SLEEP; + launchActions((const uint8_t *)&sleep_enter_e); + } + + /* Exiting sleep mode. */ + if (cond_flags.sleep == COND_POST_SLEEP) + { + launchActions((const uint8_t *)&sleep_exit_e); + cond_flags.sleep = COND_NO_SLEEP; + } + /* RF connection */ if (cond_flags.rf_conn) { |
From: Thomas_C <c2m...@c2...> - 2007-05-29 17:55:21
|
Author: Thomas_C Date: 2007-05-29 19:54:51 +0200 (Tue, 29 May 2007) New Revision: 327 Added: software/tux_pidgin/ software/tux_pidgin/branches/ software/tux_pidgin/tags/ software/tux_pidgin/trunk/ software/tux_pidgin/trunk/tux_pidgin.py Log: Initial import of Tux_pidgin Added: software/tux_pidgin/trunk/tux_pidgin.py =================================================================== --- software/tux_pidgin/trunk/tux_pidgin.py (rev 0) +++ software/tux_pidgin/trunk/tux_pidgin.py 2007-05-29 17:54:51 UTC (rev 327) @@ -0,0 +1,118 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +# ----------------------------------------------------------------------------- +# Tux Droid - Pidgin InterFace +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. +# ----------------------------------------------------------------------------- +# $Id: $ +# ----------------------------------------------------------------------------- + +""" +CHANGES +======= +2007/05/26 - version 0.2: + - Tuxdroid speaks with TTS voices that say the contact on pidgin + +2007/05/21 - version 0.1: + - Initial version + +TODO LIST +======== +- Make some actions when a conversation started +- Internationalization +- Improvement of conversion received message (html2text) + +""" + +__author__ = "Thomas CARPENTIER <car...@fr...> & Julien Ruchaud" +__appname__ = "TuxPidgin" +__version__ = "0.2" +__date__ = "2007/05/26" +__license__ = "GPL" + +# ----------------------------------------------- +# Initalization of modules +# uses objects "tux" and "tss" +# ----------------------------------------------- +import sys +sys.path.append('/opt/tuxdroid/api/python') +from tux import * + +# Others +import dbus +import dbus.glib +import dbus.decorators +import gobject +import os +import re +import time + + +# This method is execute when a message is receive +def received_im_msg(account, name, message, conversation, flags): + buddy = purple.PurpleFindBuddy(account, name) + if buddy != 0: + alias = purple.PurpleBuddyGetAlias(buddy) + else: + alias = name + text = "%s says %s" % (alias, message) + text = re.sub("<.*?>", "", text)#html2text + + + tuxspeak(text) + +# This method is excute when a buddy is sign on +def buddy_signed_on(buddyid): + alias = purple.PurpleBuddyGetAlias(buddyid) + + text = "%s is online" % alias + text=text.encode('utf-8') + tux_speak(text) + +# Tux speak the text +def tux_speak(text): + print text + tux.cmd.mouth_open() + tux.tts.select_voice(2,100) + tux.tts.speak(text) + tux.cmd.mouth_close() + +# Main + +bus = dbus.SessionBus() + +try: + obj = bus.get_object("im.pidgin.purple.PurpleService", "/im/pidgin/purple/PurpleObject") + purple = dbus.Interface(obj, "im.pidgin.purple.PurpleInterface") +except dbus.DBusException: + print "Pidgin is not launched" + sys.exit(0) + + + +bus.add_signal_receiver(received_im_msg, + dbus_interface = "im.pidgin.purple.PurpleInterface", + signal_name = "ReceivedImMsg") + +bus.add_signal_receiver(buddy_signed_on, + dbus_interface = "im.pidgin.purple.PurpleInterface", + signal_name = "BuddySignedOn") + +print "TuxPidgin is started" +loop = gobject.MainLoop() +loop.run() |
From: jaguarondi <c2m...@c2...> - 2007-05-29 14:55:28
|
Author: jaguarondi Date: 2007-05-29 16:54:54 +0200 (Tue, 29 May 2007) New Revision: 326 Modified: api/python/trunk/tuxapi_class.py Log: - UPD: issue #30 - patch from Vincent Fretin to fix documentation. Modified: api/python/trunk/tuxapi_class.py =================================================================== --- api/python/trunk/tuxapi_class.py 2007-05-26 13:59:44 UTC (rev 325) +++ api/python/trunk/tuxapi_class.py 2007-05-29 14:54:54 UTC (rev 326) @@ -592,10 +592,10 @@ "on_head_bt_released" as pof : On tux head button released "on_lwing_bt_released" as pof : On tux left wing button released "on_rwing_bt_released" as pof : On tux right wing button released - "on_remote_bt" as tuple of pof : On remote controller button pressed - param 1 : Key as integer + "on_remote_bt" as list of pof : On remote controller button pressed "on_status" as pof : On status arrival "on_remote" as pof : On remote controller event + param 1 : Key as integer "on_light_level" as pof : On light level event param 1 : light value as integer "on_connected" as pof : On api connected to tuxdaemon @@ -627,8 +627,13 @@ Example of associating a function to a remote event: >>> def my_function(key): >>> print "Button %s is pressed"%remote_bt_name[key] - >>> tux.event.on_remote_bt=my_function + >>> tux.event.on_remote=my_function + Example of associating a function to a specific remote event: + >>> def play_pause(): + >>> tux.sys.shell("audacious --play-pause") + >>> tux.event.on_remote_bt[K_PLAYPAUSE]=play_pause + Key constants of the remote controller: (K_0,K_1,K_2,K_3,K_4,K_5,K_6,K_7,K_8,K_9,K_STANDBY, K_MUTE,K_VOLUMEPLUS,K_VOLUMEMINUS,K_ESCAPE,K_YES, @@ -2039,7 +2044,7 @@ """ while self.parent.daemon.connected: if self.parent.event.on_light_level!=None: - self.parent.event.on_light_level(self.get_light_level()) + self.parent.event.on_light_level(self.light_level()) self.parent.sys.wait(1) #-------------------------------------------------------------------------- |
From: neimad <c2m...@c2...> - 2007-05-26 14:00:13
|
Author: neimad Date: 2007-05-26 15:59:44 +0200 (Sat, 26 May 2007) New Revision: 325 Modified: api/python/trunk/tux.py Log: * Only print the API version if run as a program. "Polluting" the output of the users of the API is not polite ;-) * Pint a hint on how to use the API interactively when python is launched is non-interactive mode. This is done by using a trick checking for the presence of readline in sys.modules. If someone knows of a better way... Modified: api/python/trunk/tux.py =================================================================== --- api/python/trunk/tux.py 2007-05-25 17:04:52 UTC (rev 324) +++ api/python/trunk/tux.py 2007-05-26 13:59:44 UTC (rev 325) @@ -9,8 +9,18 @@ import atexit global tux + +# If run as main, print version banner. Otherwise, keep quiet. +if __name__ == "__main__": + misc = tuxapi_class.TUXmisc(None) + misc.print_api_version() + del misc + # Trick to detect whether python is in interactive mode + if not 'readline' in sys.modules: + print "For interactive use, run: python -i tux.py" + sys.exit(0) + tux=tuxapi_class.TUXTCPCommunicator() -tux.misc.print_api_version() wavs=tuxapi_wav_merger.WavMerger(tux) tux.daemon.connect() tux.tts.connect() @@ -28,3 +38,4 @@ signal.signal(signal.SIGTERM, exit) signal.signal(signal.SIGINT, exit) atexit.register(my_exitfunct) + |
From: jaguarondi <c2m...@c2...> - 2007-05-25 17:05:19
|
Author: jaguarondi Date: 2007-05-25 19:04:52 +0200 (Fri, 25 May 2007) New Revision: 324 Modified: firmware/tuxcore/trunk/Makefile firmware/tuxcore/trunk/main.c firmware/tuxcore/trunk/parser.c firmware/tuxcore/trunk/standalone.c Log: - UPD: ISP programming from the Makefile now also handles the eeprom and the bootloader. - some minor comment updates. Modified: firmware/tuxcore/trunk/Makefile =================================================================== --- firmware/tuxcore/trunk/Makefile 2007-05-25 17:02:03 UTC (rev 323) +++ firmware/tuxcore/trunk/Makefile 2007-05-25 17:04:52 UTC (rev 324) @@ -169,8 +169,14 @@ prog: $(PROJECT).hex tuxup $(PROJECT).hex $(PROJECT).eep -progisp: $(PROJECT).hex - AVRDUDE -p $(MCU) -c jtag2isp -P usb -B 10 -e -U flash:w:$(PROJECT).hex +progisp: $(PROJECT).hex $(PROJECT).eep + $(AVRDUDE) -p $(MCU) -c jtag2isp -P usb -B 10 -e -U flash:w:$(PROJECT).hex -U eeprom:w:$(PROJECT).eep -progstk: $(PROJECT).hex - AVRDUDE -p $(MCU) -c stk500v2 -e -U flash:w:$(PROJECT).hex +progisp_bl: $(PROJECT).hex $(PROJECT).eep $(PROJECT)_bl.hex + $(AVRDUDE) -p $(MCU) -c jtag2isp -P usb -B 10 -e -U flash:w:$(PROJECT).hex -U eeprom:w:$(PROJECT).eep -D -U flash:w:$(PROJECT)_bl.hex + +progstk: $(PROJECT).hex $(PROJECT).eep + $(AVRDUDE) -p $(MCU) -c stk500v2 -e -U flash:w:$(PROJECT).hex -U eeprom:w:$(PROJECT).eep + +progstk_bl: $(PROJECT).hex $(PROJECT).eep $(PROJECT)_bl.hex + $(AVRDUDE) -p $(MCU) -c stk500v2 -e -U flash:w:$(PROJECT).hex -U eeprom:w:$(PROJECT).eep -D -U flash:w:$(PROJECT)_bl.hex Modified: firmware/tuxcore/trunk/main.c =================================================================== --- firmware/tuxcore/trunk/main.c 2007-05-25 17:02:03 UTC (rev 323) +++ firmware/tuxcore/trunk/main.c 2007-05-25 17:04:52 UTC (rev 324) @@ -37,8 +37,8 @@ /* * Debug and test flags */ -#define DBG_STACK 0 -#define TEST_CHARGER 0 /* Use eyes LED's to indicate charger status */ +#define DBG_STACK 0 /* stack overflow detection */ +#define TEST_CHARGER 0 /* use eyes LED's to indicate charger status */ void ioInit(void); void timer2Init(void); Modified: firmware/tuxcore/trunk/parser.c =================================================================== --- firmware/tuxcore/trunk/parser.c 2007-05-25 17:02:03 UTC (rev 323) +++ firmware/tuxcore/trunk/parser.c 2007-05-25 17:04:52 UTC (rev 324) @@ -39,7 +39,7 @@ { uint8_t i; - /* Moves */ + /* Check new conditions and update status from tuxaudio */ if (command[0] == SEND_AUDIOSENSORS_CMD) { if ((command[1] & STATUS_HEADBTN_MK) @@ -66,6 +66,8 @@ gStatus.bat = command[3]; return; } + + /* Moves */ else if (command[0] == BLINK_EYES_CMD) { blinkEyes(command[1]); @@ -257,7 +259,7 @@ /* Extract a command from the buffer */ cli(); /* XXX check if we can only disable the twi interrupts here */ - /* XXX commented the cli sei because we are in an interrupt, if this code is moved outside, we should replace them */ + /* XXX we should be able to replace this block with the split_command_parser above */ commandType = commandBuf[commandBufIdx - 1] >> 6; /* commandType is 0-3 (num from 0 to 3) if the command is 0-3 bytes long */ for (i = 0; i <= commandType; i++) /* so we loop 1-4 times here to get all command bytes */ { Modified: firmware/tuxcore/trunk/standalone.c =================================================================== --- firmware/tuxcore/trunk/standalone.c 2007-05-25 17:02:03 UTC (rev 323) +++ firmware/tuxcore/trunk/standalone.c 2007-05-25 17:04:52 UTC (rev 324) @@ -205,7 +205,7 @@ if ((!test_mode) || (test_mode == BT_REMOTE)) { /* Disable spinning when plugged */ - if ((gStatus.sw & GSTATUS_POWERPLUGSW_MK)) /* disable spinning when plugged */ + if ((gStatus.sw & GSTATUS_POWERPLUGSW_MK)) { stopSpin(); /* flush the spinning commands */ spinPosCnt = 0; |
From: jaguarondi <c2m...@c2...> - 2007-05-25 17:02:33
|
Author: jaguarondi Date: 2007-05-25 19:02:03 +0200 (Fri, 25 May 2007) New Revision: 323 Modified: firmware/tuxcore/trunk/main.c Log: - ADD: sleep function in tuxcore, no power savings yet but the status are stopped. Modified: firmware/tuxcore/trunk/main.c =================================================================== --- firmware/tuxcore/trunk/main.c 2007-05-19 11:26:40 UTC (rev 322) +++ firmware/tuxcore/trunk/main.c 2007-05-25 17:02:03 UTC (rev 323) @@ -43,6 +43,7 @@ void ioInit(void); void timer2Init(void); void updateStatus(void); +void sleep(void); /* * External variables @@ -217,7 +218,7 @@ /* * Communication: updating status, receiving and sending commands */ - if (updateStatusFlag) /* do all stuff that needs to be updated before status are sent */ + if (updateStatusFlag && !cond_flags.sleep) /* do all stuff that needs to be updated before status are sent; we don't send status when entering sleep mode */ { updateStatusFlag = 0; updateStatus(); /* add sensors states to the status queue */ @@ -236,6 +237,10 @@ standalone_behavior(); /* standalone behavior manager */ + /* Entering sleep mode */ + if (cond_flags.sleep) + sleep(); + /* * Test and debug functions */ @@ -380,3 +385,18 @@ statusFifoFlag = 0; } + +/* + * Sleep functions + */ + +void sleep(void) +{ + turnLeftLedOff(); + while(SW_HD_PIN & SW_HD_MK) /* exit sleep if head is pushed */ + { + /* XXX Enter sleep mode here, either wakeup regularly to check the head button or better configure an interrupt on the head button to wake-up the CPU */ + } + turnLeftLedOn(); + cond_flags.sleep = 0; +} |
From: neimad <c2m...@c2...> - 2007-05-19 11:27:10
|
Author: neimad Date: 2007-05-19 13:26:40 +0200 (Sat, 19 May 2007) New Revision: 322 Modified: daemon/trunk/libs/USBDaemon_command_tux.c daemon/trunk/libs/USBDaemon_globals.h daemon/trunk/libs/USBDaemon_log.c daemon/trunk/libs/USBDaemon_tcp_server.c daemon/trunk/libs/USBDaemon_tcp_server.h daemon/trunk/libs/USBDaemon_usb_enum.c daemon/trunk/libs/USBDaemon_usb_enum.h daemon/trunk/libs/USBDaemon_usb_readWrite.c daemon/trunk/main.c Log: * Got rid of the so-called "USB thread". It merely periodically checked whether the dongle was still connected and updated tux's status. This is now performed by specifying a timeout to select(). NOTE: the current implementation assumes that select() "modifies the timeout to reflect the amount of time not slept" (see manpage), which is the case on Linux but is not portable. A subsequent patch will fix this. * The change above means tuxdaemon is now a single threaded process, hence I got rid of all the pthread locking. It didn't seem to be of any use, anyway. As a nice side-effect, the thread-related problem encountered on the NSLU2 (as reported by Philippe Teuwen aka doegox) is solved. * Renamed tcp_server_start_task() to tcp_server_loop(). Modified: daemon/trunk/libs/USBDaemon_command_tux.c =================================================================== --- daemon/trunk/libs/USBDaemon_command_tux.c 2007-05-19 11:04:04 UTC (rev 321) +++ daemon/trunk/libs/USBDaemon_command_tux.c 2007-05-19 11:26:40 UTC (rev 322) @@ -242,7 +242,6 @@ switch (data[0]) { case SUB_D_CMD_STRUC_DISCONNECT_CLIENT: - pthread_mutex_lock(&tcp_mutex); /* Byte 2 equal id client to disconnect */ if (tcp_clients_handle[data[1]] >= 0) { @@ -253,13 +252,10 @@ { /* Bad id client */ result[0] = ACK_CMD_KO; } - pthread_mutex_unlock(&tcp_mutex); break; case SUB_D_CMD_STRUC_DISCONNECT_CLIENT_ME: - pthread_mutex_lock(&tcp_mutex); tcp_remove_client(id_client); result[0] = ACK_CMD_NO_ACK; - pthread_mutex_unlock(&tcp_mutex); break; case SUB_D_CMD_STRUC_KILL_DAEMON: log_warning("daemon killed by user"); Modified: daemon/trunk/libs/USBDaemon_globals.h =================================================================== --- daemon/trunk/libs/USBDaemon_globals.h 2007-05-19 11:04:04 UTC (rev 321) +++ daemon/trunk/libs/USBDaemon_globals.h 2007-05-19 11:26:40 UTC (rev 322) @@ -26,7 +26,6 @@ /*_____________________ I N C L U D E S____________________________________ */ #include <usb.h> -#include <pthread.h> /*_____________________ D E F I N E S ______________________________________*/ Modified: daemon/trunk/libs/USBDaemon_log.c =================================================================== --- daemon/trunk/libs/USBDaemon_log.c 2007-05-19 11:04:04 UTC (rev 321) +++ daemon/trunk/libs/USBDaemon_log.c 2007-05-19 11:26:40 UTC (rev 322) @@ -5,6 +5,7 @@ #include <stdlib.h> #include <stdio.h> #include <stdarg.h> +#include <time.h> #include <assert.h> #include <syslog.h> Modified: daemon/trunk/libs/USBDaemon_tcp_server.c =================================================================== --- daemon/trunk/libs/USBDaemon_tcp_server.c 2007-05-19 11:04:04 UTC (rev 321) +++ daemon/trunk/libs/USBDaemon_tcp_server.c 2007-05-19 11:26:40 UTC (rev 322) @@ -33,6 +33,8 @@ #include "USBDaemon_command_tux.h" #include "USBDaemon_status_table.h" #include "USBDaemon_tcp_server.h" +#include "USBDaemon_usb_enum.h" +#include "USBDaemon_usb_readWrite.h" #include "USBDaemon_pidfile.h" #include "USBDaemon_log.h" @@ -41,7 +43,6 @@ int tcp_server_handle = -1; struct sockaddr_in tcp_server_sockaddr; tux_tcp_status_t tux_tcp_status = TUX_TCP_STATUS_DOWN; -pthread_mutex_t tcp_mutex; int tcp_clients_handle[TUX_MAX_TCP_CLIENTS] = {[(0)...(TUX_MAX_TCP_CLIENTS - 1)] = -1 }; @@ -50,18 +51,35 @@ /*_____________________ F U N C T I O N S __________________________________*/ +/** + * Update/check Tux status. + * + * @return 1 if tux is present, 0 otherwise + */ +static int update_tux_status(void) +{ + static int check_count = 0; + + check_count = (check_count + 1) % 16; + if (check_count == 0 && usb_find_TuxDroid() == NULL) + return 0; + + usb_get_status_TuxDroid(); + + return 1; +} + /************************************************************************ */ /* tcp_server_start_task() */ /************************************************************************ */ -void *tcp_server_start_task(void *unused) +void *tcp_server_loop(void) { +#define TIMEOUT ((struct timeval){ .tv_sec = 0, .tv_usec = 50000 }) tcp_frame_t datas_recv; int val; - pthread_mutex_init(&tcp_mutex, NULL); - if ((tcp_server_handle = socket(AF_INET, SOCK_STREAM, 0)) < 0) { log_error("TCP socket: socket creation failed: %m"); @@ -98,6 +116,7 @@ while (tcp_server_handle >= 0) { + struct timeval timeout = TIMEOUT; fd_set rset; int i, r, fdmax; @@ -106,7 +125,6 @@ fdmax = tcp_server_handle; /* Client connection */ - pthread_mutex_lock(&tcp_mutex); for (i = 0; i < TUX_MAX_TCP_CLIENTS; i++) if (tcp_clients_handle[i] >= 0) { @@ -114,18 +132,27 @@ if (tcp_clients_handle[i] > fdmax) fdmax = tcp_clients_handle[i]; } - pthread_mutex_unlock(&tcp_mutex); - r = select(fdmax + 1, &rset, NULL, NULL, NULL); - if (r < 0) + r = select(fdmax + 1, &rset, NULL, NULL, &timeout); + if (r == 0) { + if (!update_tux_status()) + { + log_error("Tux dongle is disconnected"); + /* FIXME: exit loop cleanly */ + exit(1); + } + + timeout = TIMEOUT; + } + else if (r < 0) + { if (errno == EINTR) continue; break; } /* Incoming connection request ? */ - pthread_mutex_lock(&tcp_mutex); if (FD_ISSET(tcp_server_handle, &rset)) { int tmp_client = @@ -167,18 +194,10 @@ r = recv(tcp_clients_handle[i], datas_recv, sizeof(datas_recv), 0); if (r == 0) - { tcp_remove_client(i); - } else if (r > 0) - { - pthread_mutex_unlock(&tcp_mutex); commands_dispatcher((unsigned char)i, datas_recv); - pthread_mutex_lock(&tcp_mutex); - } } - - pthread_mutex_unlock(&tcp_mutex); } return NULL; @@ -193,13 +212,8 @@ { int i; - pthread_mutex_lock(&tcp_mutex); - if (tux_tcp_status == TUX_TCP_STATUS_DOWN) - { - pthread_mutex_unlock(&tcp_mutex); return; - } for (i = 0; i < TUX_MAX_TCP_CLIENTS; i++) { @@ -209,8 +223,6 @@ if (send(tcp_clients_handle[i], data, sizeof(tcp_frame_t), 0) == 0) tcp_remove_client(i); } - - pthread_mutex_unlock(&tcp_mutex); } /************************************************************************ */ @@ -220,13 +232,8 @@ /************************************************************************ */ void tcp_server_send_raw_to_client(int client_index, const tcp_frame_t data) { - pthread_mutex_lock(&tcp_mutex); - if (tux_tcp_status == TUX_TCP_STATUS_DOWN) - { - pthread_mutex_unlock(&tcp_mutex); return; - } if (tcp_clients_handle[client_index] >= 0) { @@ -234,8 +241,6 @@ == 0) tcp_remove_client(client_index); } - - pthread_mutex_unlock(&tcp_mutex); } /************************************************************************ */ @@ -255,9 +260,7 @@ tcp_server_send_raw(data); - pthread_mutex_lock(&tcp_mutex); close(tcp_server_handle); - pthread_mutex_unlock(&tcp_mutex); usleep(10000); } Modified: daemon/trunk/libs/USBDaemon_tcp_server.h =================================================================== --- daemon/trunk/libs/USBDaemon_tcp_server.h 2007-05-19 11:04:04 UTC (rev 321) +++ daemon/trunk/libs/USBDaemon_tcp_server.h 2007-05-19 11:26:40 UTC (rev 322) @@ -53,10 +53,9 @@ extern int tcp_clients_handle[]; extern unsigned char tcp_clients_count; extern client_name_t tcp_clients_name[]; -extern pthread_mutex_t tcp_mutex; /*_____________________ F U N C T I O N S __________________________________*/ -extern void *tcp_server_start_task(void *unused); +extern void *tcp_server_loop(void); extern void tcp_server_send_raw(const tcp_frame_t data); extern void tcp_server_send_raw_to_client(int client_index, const tcp_frame_t data); Modified: daemon/trunk/libs/USBDaemon_usb_enum.c =================================================================== --- daemon/trunk/libs/USBDaemon_usb_enum.c 2007-05-19 11:04:04 UTC (rev 321) +++ daemon/trunk/libs/USBDaemon_usb_enum.c 2007-05-19 11:26:40 UTC (rev 322) @@ -37,7 +37,6 @@ usb_dev_handle *tux_handle; struct usb_device *tux_device; TUX_USB_CONN_STATUS TUX_USB_STATUS = TUX_USB_DISCONNECTED; -pthread_mutex_t usb_mutex; /*_____________________ F U N C T I O N S __________________________________*/ @@ -46,7 +45,7 @@ /* usb_find_TuxDroid() */ /************************************************************************ */ -static struct usb_device *usb_find_TuxDroid() +struct usb_device *usb_find_TuxDroid() { struct usb_bus *bus; struct usb_device *tux_dev; @@ -108,7 +107,6 @@ /************************************************************************ */ int usb_init_TuxDroid(void) { - pthread_mutex_init(&usb_mutex, NULL); /* Find Tux */ do { @@ -139,44 +137,11 @@ return 0; } - return 1; -} - -/************************************************************************ */ - -/* usb_start_task_TuxDroid() */ - -/************************************************************************ */ -void *usb_start_task(void *unused) -{ - unsigned char dongle_is_present_counter; - - usleep(50000); - TUX_USB_STATUS = TUX_USB_CONNECTED; /* Reinit audio channel */ send_usb_dongle_cmd(0x02, 0, 0, 0); current_audio_channel = 0; - /* Read loop */ - dongle_is_present_counter = 0; - while (tux_handle) - { - /* Make circular the variable to 16 values */ - dongle_is_present_counter = (dongle_is_present_counter + 1) & 0x0F; - /* Once on 16, we test the presence of the dongle */ - if (dongle_is_present_counter == 0) - if (usb_find_TuxDroid() == NULL) - { - log_error("Tux dongle is disconnected"); - send_daemon_disconnected(); - exit(1); - } - - usb_get_status_TuxDroid(); - usleep(50000); - } - - return NULL; + return 1; } Modified: daemon/trunk/libs/USBDaemon_usb_enum.h =================================================================== --- daemon/trunk/libs/USBDaemon_usb_enum.h 2007-05-19 11:04:04 UTC (rev 321) +++ daemon/trunk/libs/USBDaemon_usb_enum.h 2007-05-19 11:26:40 UTC (rev 322) @@ -39,10 +39,10 @@ /*_____________________ V A R I A B L E S __________________________________*/ extern usb_dev_handle *tux_handle; extern TUX_USB_CONN_STATUS TUX_USB_STATUS; -extern pthread_mutex_t usb_mutex; /*_____________________ F U N C T I O N S __________________________________*/ -extern void *usb_start_task(void *unused); + +extern struct usb_device *usb_find_TuxDroid(); extern int usb_init_TuxDroid(void); #endif Modified: daemon/trunk/libs/USBDaemon_usb_readWrite.c =================================================================== --- daemon/trunk/libs/USBDaemon_usb_readWrite.c 2007-05-19 11:04:04 UTC (rev 321) +++ daemon/trunk/libs/USBDaemon_usb_readWrite.c 2007-05-19 11:26:40 UTC (rev 322) @@ -48,11 +48,9 @@ for (i = 0; i < 5; i++) { - pthread_mutex_lock(&usb_mutex); idx = usb_interrupt_read(tux_handle, TUX_READ_EP, (char *)data, TUX_RECV_LENGTH, TUX_READ_TIMEOUT); - pthread_mutex_unlock(&usb_mutex); if (idx != TUX_RECV_LENGTH) i = 0; @@ -83,31 +81,20 @@ cmd_send[3] = 0x00; cmd_send[4] = 0x00; - pthread_mutex_lock(&usb_mutex); - if (TUX_USB_CONNECTED != TUX_USB_STATUS) - { - pthread_mutex_unlock(&usb_mutex); return; - } idx = usb_interrupt_write(tux_handle, TUX_WRITE_EP, (char *)cmd_send, sizeof(cmd_send), TUX_WRITE_TIMEOUT); if (idx <= 0) - { - pthread_mutex_unlock(&usb_mutex); return; - } idx = usb_interrupt_read(tux_handle, TUX_READ_EP, (char *)data, sizeof(data), TUX_READ_TIMEOUT); if (idx <= 0) - { - pthread_mutex_unlock(&usb_mutex); return; - } cmd_dispatch[0] = data[0]; cmd_dispatch[1] = data[1]; @@ -137,8 +124,6 @@ update_raw_status_table(cmd_dispatch); } } - - pthread_mutex_unlock(&usb_mutex); } /************************************************************************ */ @@ -152,13 +137,8 @@ unsigned char counter; unsigned char csf; - pthread_mutex_lock(&usb_mutex); - if (TUX_USB_CONNECTED != TUX_USB_STATUS) - { - pthread_mutex_unlock(&usb_mutex); return ACK_CMD_DONGLE_NOT_PRESENT; - } /* Send data */ cmd_status_flag = 1; @@ -168,13 +148,9 @@ counter = 0; csf = cmd_status_flag; - pthread_mutex_unlock(&usb_mutex); - while (csf) { - pthread_mutex_lock(&usb_mutex); csf = cmd_status_flag; - pthread_mutex_unlock(&usb_mutex); counter++; usleep(10000); Modified: daemon/trunk/main.c =================================================================== --- daemon/trunk/main.c 2007-05-19 11:04:04 UTC (rev 321) +++ daemon/trunk/main.c 2007-05-19 11:26:40 UTC (rev 322) @@ -26,8 +26,6 @@ #include <stdlib.h> #include <string.h> #include <usb.h> -#include <glib.h> -#include <glib-object.h> #include <errno.h> #include <sys/types.h> #include <sys/stat.h> @@ -274,10 +272,6 @@ /************************************************************************ */ int main(int argc, char *argv[]) { - GMainLoop *loop; - GThread *UsbThread; - GThread *TcpThread; - GError *error = NULL; unsigned char i; log_target_t log_target = LOG_TARGET_SYSLOG; log_level_t log_level = LOG_LEVEL_INFO; @@ -350,40 +344,9 @@ /* open USB handler and setuid nobody */ if (!usb_init_TuxDroid()) - { exit(1); - } - /* Gestion Multithread */ - if (!g_thread_supported()) - { - g_thread_init(NULL); - } - else - { - log_error("g_thread NOT supported"); - exit(1); - } - /* Start USB task thread */ - UsbThread = - g_thread_create((GThreadFunc) usb_start_task, NULL, TRUE, &error); - if (UsbThread == NULL) - { - log_error("Thread creation failed: %s", error->message); - exit(2); - } - /* Start TCP task thread */ - TcpThread = - g_thread_create((GThreadFunc) tcp_server_start_task, NULL, TRUE, - &error); - if (TcpThread == NULL) - { - log_error("Thread creation failed: %s", error->message); - exit(2); - } + tcp_server_loop(); - loop = g_main_loop_new(NULL, FALSE); - g_main_loop_run(loop); - exit(0); } |
From: neimad <c2m...@c2...> - 2007-05-19 11:04:39
|
Author: neimad Date: 2007-05-19 13:04:04 +0200 (Sat, 19 May 2007) New Revision: 321 Modified: software/tuxgi/trunk/tuxgi.py Log: * Removed unnecessary line continuation tokens and indented continued lines properly. Modified: software/tuxgi/trunk/tuxgi.py =================================================================== --- software/tuxgi/trunk/tuxgi.py 2007-05-13 15:31:44 UTC (rev 320) +++ software/tuxgi/trunk/tuxgi.py 2007-05-19 11:04:04 UTC (rev 321) @@ -73,7 +73,7 @@ for term in terminal_shells: if not os.popen('type %s'%term[0]).close(): xterm_cmd = '%s %s %s -i /opt/tuxdroid/api/python/tux.py' \ - % (term[0], term[1], py_cmd) + % (term[0], term[1], py_cmd) break #============================================================================== # Main window class @@ -226,31 +226,31 @@ soundcard = tux.hw.alsa_device self.get_widget("togglebutton3").set_active(False) toggled_by_event=False - self.get_widget("image2").set_from_stock(gtk.STOCK_APPLY\ - ,gtk.ICON_SIZE_BUTTON) + self.get_widget("image2").set_from_stock(gtk.STOCK_APPLY, + gtk.ICON_SIZE_BUTTON) self.on_mouth_stop() self.on_eyes_stop() tux.cmd.leds_blink(2,1) else: - self.get_widget("image2").set_from_stock(gtk.STOCK_CANCEL\ - ,gtk.ICON_SIZE_BUTTON) + self.get_widget("image2").set_from_stock(gtk.STOCK_CANCEL, + gtk.ICON_SIZE_BUTTON) tux.status.rf_connected = False if tux.tts.connected!=last_tuxttsdaemon_connect: last_tuxttsdaemon_connect=tux.tts.connected if tux.tts.connected: - self.get_widget("image3").set_from_stock(gtk.STOCK_APPLY\ - ,gtk.ICON_SIZE_BUTTON) + self.get_widget("image3").set_from_stock(gtk.STOCK_APPLY, + gtk.ICON_SIZE_BUTTON) else: - self.get_widget("image3").set_from_stock(gtk.STOCK_CANCEL\ - ,gtk.ICON_SIZE_BUTTON) + self.get_widget("image3").set_from_stock(gtk.STOCK_CANCEL, + gtk.ICON_SIZE_BUTTON) if tux.status.rf_state()!=last_rf_state: last_rf_state = tux.status.rf_connected if last_rf_state: - self.get_widget("image4").set_from_stock(gtk.STOCK_APPLY\ - ,gtk.ICON_SIZE_BUTTON) + self.get_widget("image4").set_from_stock(gtk.STOCK_APPLY, + gtk.ICON_SIZE_BUTTON) else: - self.get_widget("image4").set_from_stock(gtk.STOCK_CANCEL\ - ,gtk.ICON_SIZE_BUTTON) + self.get_widget("image4").set_from_stock(gtk.STOCK_CANCEL, + gtk.ICON_SIZE_BUTTON) tux.sys.wait(0.5) # ----------------------------------------------------------------------------- # Tab "main" events @@ -499,8 +499,8 @@ #-------------------------------------------------------------------------- def on_wave_external_play_bt_clicked(self, widget, *args): if str(self.get_widget("filechooserbutton1").get_filename())=="None": return - tux.sys.shell_free("aplay -D %s %s"% (soundcard,\ - self.get_widget("filechooserbutton1").get_filename())) + tux.sys.shell_free("aplay -D %s %s"% (soundcard, + self.get_widget("filechooserbutton1").get_filename())) #-------------------------------------------------------------------------- # On select original sounds @@ -588,27 +588,27 @@ wav_te=self.get_widget("textview3") wav_buffer=wav_te.get_buffer() if not wavs.wavs_merging("merged.wav"): - print wav_buffer.insert(wav_buffer.get_end_iter(),\ - "Sound storing : Error : file merged is too big\n") + print wav_buffer.insert(wav_buffer.get_end_iter(), + "Sound storing : Error : file merged is too big\n") return - wav_buffer.insert(wav_buffer.get_end_iter(),\ - "Sound storing : Erase flash\n") + wav_buffer.insert(wav_buffer.get_end_iter(), + "Sound storing : Erase flash\n") tux.cmd.sound_storing(len(wavs.wav_sizes)) tux.sys.wait(10) current_pos=0x0400 tux.sys.wait(0.1) - wav_buffer.insert(wav_buffer.get_end_iter(),\ - "Sound storing : Indexes\n") + wav_buffer.insert(wav_buffer.get_end_iter(), + "Sound storing : Indexes\n") tux.cmd.sound_store_index(0x00,0x04,0x00) for size in wavs.wav_sizes: current_pos=current_pos+size tux.sys.wait(0.1) - tux.cmd.sound_store_index((current_pos & 0xFF0000)>>16,\ - (current_pos & 0x00FF00)>>8,current_pos & 0x0000FF) + tux.cmd.sound_store_index((current_pos & 0xFF0000)>>16, + (current_pos & 0x00FF00)>>8,current_pos & 0x0000FF) wav_buffer.insert(wav_buffer.get_end_iter(),"Sound storing : Record\n") tux.sys.shell("aplay -D %s merged.wav"%soundcard) - wav_buffer.insert(wav_buffer.get_end_iter(),\ - "Sound storing : Storage done.\n") + wav_buffer.insert(wav_buffer.get_end_iter(), + "Sound storing : Storage done.\n") tux.sys.wait(0.3) #-------------------------------------------------------------------------- @@ -736,8 +736,8 @@ commandp[i]=int(commands[i][2:],16) else: commandp[i]=int(commands[i]) - tux.cmd.raw(int(commandp[0]),int(commandp[1]),int(commandp[2]),\ - int(commandp[3])) + tux.cmd.raw(int(commandp[0]),int(commandp[1]),int(commandp[2]), + int(commandp[3])) #------------------------------------------------------------------------------ |
From: madjar <c2m...@c2...> - 2007-05-13 15:32:53
|
Author: madjar Date: 2007-05-13 17:31:44 +0200 (Sun, 13 May 2007) New Revision: 320 Modified: api/python/trunk/tuxapi_class.py Log: ADD: new fonction tux.hw.oss_device() return the path to the oss tux device (ex:/dev/dsp1) #31 Modified: api/python/trunk/tuxapi_class.py =================================================================== --- api/python/trunk/tuxapi_class.py 2007-05-12 18:00:13 UTC (rev 319) +++ api/python/trunk/tuxapi_class.py 2007-05-13 15:31:44 UTC (rev 320) @@ -3574,6 +3574,22 @@ else: self.alsa_device="default" + #-------------------------------------------------------------------------- + # Get the oss compatibility device of the tux sound card + #-------------------------------------------------------------------------- + def oss_device(self): + """ + Get the oss compatibility device of the tux sound card + + Return a string (ex : '/dev/dsp') + """ + if self.alsa_device=='default': + return '' + elif self.alsa_device[3]=='0': + return '/dev/dsp' + else: + return '/dev/dsp%s'%self.alsa_device[3] + #============================================================================== # TUXTCPCommunicator - TTS - class #============================================================================== |
From: doegox <c2m...@c2...> - 2007-05-12 18:00:17
|
Author: doegox Date: 2007-05-12 20:00:13 +0200 (Sat, 12 May 2007) New Revision: 319 Modified: software/tuxgi/trunk/tuxgi.py Log: Use ipython for the shell if available Modified: software/tuxgi/trunk/tuxgi.py =================================================================== --- software/tuxgi/trunk/tuxgi.py 2007-05-12 12:08:09 UTC (rev 318) +++ software/tuxgi/trunk/tuxgi.py 2007-05-12 18:00:13 UTC (rev 319) @@ -65,10 +65,15 @@ ('xterm', '-e'), # X ] # list of tuple instead of a dictionary as the order matters +if not os.popen('type ipython').close(): + py_cmd = 'ipython' +else: + py_cmd = 'python' + for term in terminal_shells: if not os.popen('type %s'%term[0]).close(): - xterm_cmd = '%s %s python -i /opt/tuxdroid/api/python/tux.py' \ - % (term[0], term[1]) + xterm_cmd = '%s %s %s -i /opt/tuxdroid/api/python/tux.py' \ + % (term[0], term[1], py_cmd) break #============================================================================== # Main window class |
From: jaguarondi <c2m...@c2...> - 2007-05-12 12:08:17
|
Author: jaguarondi Date: 2007-05-12 14:08:09 +0200 (Sat, 12 May 2007) New Revision: 318 Modified: firmware/tuxaudio/trunk/Makefile firmware/tuxaudio/trunk/communication.c firmware/tuxaudio/trunk/fifo.c firmware/tuxaudio/trunk/fifo.h firmware/tuxaudio/trunk/interrupt.c firmware/tuxaudio/trunk/spi.c firmware/tuxaudio/trunk/test.c firmware/tuxcore/trunk/Makefile firmware/tuxcore/trunk/communication.c firmware/tuxcore/trunk/fifo.c firmware/tuxcore/trunk/fifo.h firmware/tuxcore/trunk/ir.c firmware/tuxcore/trunk/ir.h firmware/tuxcore/trunk/motors.c firmware/tuxcore/trunk/motors.h firmware/tuxdefs/commands.h firmware/tuxup/trunk/bootloader.c firmware/tuxup/trunk/main.c firmware/tuxup/trunk/usb-connection.c firmware/tuxup/trunk/usb-connection.h Log: Removed trailing whitespaces in firmware. Modified: firmware/tuxaudio/trunk/Makefile =================================================================== --- firmware/tuxaudio/trunk/Makefile 2007-05-12 11:57:43 UTC (rev 317) +++ firmware/tuxaudio/trunk/Makefile 2007-05-12 12:08:09 UTC (rev 318) @@ -32,7 +32,7 @@ COMMON = -mmcu=$(MCU) # Place -D or -U options here -CDEFS = -DF_CPU=8000000UL -DMIC_GAIN=$(MIC_GAIN) +CDEFS = -DF_CPU=8000000UL -DMIC_GAIN=$(MIC_GAIN) # Place -I options here CINCS = @@ -46,7 +46,7 @@ CWARN = -Wall -Wstrict-prototypes CTUNING = -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums CFLAGS = $(COMMON) $(CDEBUG) $(CDEFS) $(CINCS) -O$(OPT) $(CWARN) $(CSTANDARD) $(CEXTRA) -CFLAGS += -MD -MP -MT $(*F).o -MF dep/$(@F).d +CFLAGS += -MD -MP -MT $(*F).o -MF dep/$(@F).d ## Assembly specific flags ASMFLAGS = $(COMMON) @@ -72,7 +72,7 @@ OBJECTS = init.o main.o varis.o fifo.o spi.o flash.o communication.o i2c.o config.o ## Objects explicitly added by the user -LINKONLYOBJECTS = +LINKONLYOBJECTS = ## Build all: svnrev.h $(TARGET) tuxaudio.hex tuxaudio.eep tuxaudio.lss size @@ -160,11 +160,11 @@ -include $(shell mkdir dep 2>/dev/null) $(wildcard dep/*) # Programming -prog: $(PROJECT).hex +prog: $(PROJECT).hex tuxup $(PROJECT).hex $(PROJECT).eep -progisp: $(PROJECT).hex +progisp: $(PROJECT).hex AVRDUDE -p $(MCU) -c jtag2isp -P usb -B 10 -e -U flash:w:$(PROJECT).hex -progstk: $(PROJECT).hex +progstk: $(PROJECT).hex AVRDUDE -p $(MCU) -c stk500v2 -e -U flash:w:$(PROJECT).hex Modified: firmware/tuxaudio/trunk/communication.c =================================================================== --- firmware/tuxaudio/trunk/communication.c 2007-05-12 11:57:43 UTC (rev 317) +++ firmware/tuxaudio/trunk/communication.c 2007-05-12 12:08:09 UTC (rev 318) @@ -98,7 +98,7 @@ * and send them by i2c. * * In order to protect this buffer of being corrupted by any modification in - * interrupts, a flag (i2cFlags.i2c_idx) is set during manipulations. + * interrupts, a flag (i2cFlags.i2c_idx) is set during manipulations. * * The i2c busy flag (i2cFlags.i2c_busy) is checked here to know if we can send * the next command. Modified: firmware/tuxaudio/trunk/fifo.c =================================================================== --- firmware/tuxaudio/trunk/fifo.c 2007-05-12 11:57:43 UTC (rev 317) +++ firmware/tuxaudio/trunk/fifo.c 2007-05-12 12:08:09 UTC (rev 318) @@ -36,25 +36,25 @@ All functions that use modulo usually use typecasts i.e. the following statement - + \code length = (p->inIdx - p->outIdx) % p->size; \endcode has a problem when (p->inIdx - p->outIdx) is <0. Then the modulus is not done, the return value is 0xF9 for example. This is due to the implicit promotion of the intermediate value to an int. - + "%" is a signed modulus, so -1 % 8 == -1. We need to trim down the intermediate result to a uint8_t result immediately so the modulus applies to a uint8_t otherwise the implicit promotion of a uint8_t argument to an int expression makes the expression signed and brake the code for the above reason. The correct expression is - + \code length = ((uint8_t)(p->inIdx - p->outIdx) % p->size); \endcode So forgetting the typecast not only makes the code much bigger, it also brake it when the intermediate result is negative. - + */ /** \name Accessors Modified: firmware/tuxaudio/trunk/fifo.h =================================================================== --- firmware/tuxaudio/trunk/fifo.h 2007-05-12 11:57:43 UTC (rev 317) +++ firmware/tuxaudio/trunk/fifo.h 2007-05-12 12:08:09 UTC (rev 318) @@ -93,7 +93,7 @@ /* * Adaptive parameters */ -/** \brief UD- Rate at which the adaptation is done. +/** \brief UD- Rate at which the adaptation is done. * * The adaptation function will only be run each 2^FIFO_ADAPT_RATE sample */ #define FIFO_ADAPT_RATE 1 /* adaptation is done each 2^FIFO_ADAPT_RATE sample */ Modified: firmware/tuxaudio/trunk/interrupt.c =================================================================== --- firmware/tuxaudio/trunk/interrupt.c 2007-05-12 11:57:43 UTC (rev 317) +++ firmware/tuxaudio/trunk/interrupt.c 2007-05-12 12:08:09 UTC (rev 318) @@ -23,7 +23,7 @@ #include <avr/interrupt.h> #include "varis.h" -// Timer 0 overflow interrupt service routine (PWM) +// Timer 0 overflow interrupt service routine (PWM) ISR(SIG_OVERFLOW0) { if (--sampling_pwm == 0) /* timer 0 is clocked at 32KHz so we divide it by 4 to get 8KHz */ @@ -32,7 +32,7 @@ //FIFOputMic (AudioRampCmpt); //AudioRampCmpt++; - sampling_pwm = 0x04; // Reinit + sampling_pwm = 0x04; // Reinit OCR0B = pullFifo(&PWMFifo); /* set the sample value to timer pulse width */ // adaptSpkFifo(); Modified: firmware/tuxaudio/trunk/spi.c =================================================================== --- firmware/tuxaudio/trunk/spi.c 2007-05-12 11:57:43 UTC (rev 317) +++ firmware/tuxaudio/trunk/spi.c 2007-05-12 12:08:09 UTC (rev 318) @@ -141,7 +141,7 @@ if (spi_master_config & 0x02) { cli(); - pushFifo(&PWMFifo, SPDR); // Put into the FIFO + pushFifo(&PWMFifo, SPDR); // Put into the FIFO sei(); } if (spi_count == (spi_lenght_data + 1)) @@ -154,7 +154,7 @@ if (spi_master_config & 0x80) spi_commandRX[spi_count - 36] = SPDR; // Put command into the buffer else - spi_commandRX[spi_count - 19] = SPDR; // Put command into the buffer + spi_commandRX[spi_count - 19] = SPDR; // Put command into the buffer } if (spi_count == spi_lenght_data + 6) { Modified: firmware/tuxaudio/trunk/test.c =================================================================== --- firmware/tuxaudio/trunk/test.c 2007-05-12 11:57:43 UTC (rev 317) +++ firmware/tuxaudio/trunk/test.c 2007-05-12 12:08:09 UTC (rev 318) @@ -42,31 +42,31 @@ write_enable (); PORTB &= ~0x02; // Chip Select SPDR = 0xAF; // Send Sequencial Program Command - while ((SPSR & 0x80) == 0); // Wait SPI response + while ((SPSR & 0x80) == 0); // Wait SPI response SPDR = ad2; // Send Address - while ((SPSR & 0x80) == 0); // Wait SPI response + while ((SPSR & 0x80) == 0); // Wait SPI response SPDR = ad1; - while ((SPSR & 0x80) == 0); // Wait SPI response + while ((SPSR & 0x80) == 0); // Wait SPI response SPDR = ad0; - while ((SPSR & 0x80) == 0); // Wait SPI response + while ((SPSR & 0x80) == 0); // Wait SPI response SPDR = 0x00; - while ((SPSR & 0x80) == 0); // Wait SPI response - PORTB |= 0x02; // Chip Deselect - while (read_status() != 0x10); // Wait Page Program Cycle + while ((SPSR & 0x80) == 0); // Wait SPI response + PORTB |= 0x02; // Chip Deselect + while (read_status() != 0x10); // Wait Page Program Cycle tmp = 1; for (i = 0; i < 15872; i++) { PORTB &= ~0x02; // Chip Select SPDR = 0xAF; // Send Sequencial Program Command while ((SPSR & 0x80) == 0); // Wait SPI response - SPDR = tmp; // Write data in flash + SPDR = tmp; // Write data in flash while ((SPSR & 0x80) == 0); // Wait SPI response - PORTB |= 0x02; // Chip DeselecT + PORTB |= 0x02; // Chip DeselecT tmp++; ad0++; // Increment address byte if (ad0 == 0x00) { - ad1++; + ad1++; if (ad1 == 0x00) ad2++; } Modified: firmware/tuxcore/trunk/Makefile =================================================================== --- firmware/tuxcore/trunk/Makefile 2007-05-12 11:57:43 UTC (rev 317) +++ firmware/tuxcore/trunk/Makefile 2007-05-12 12:08:09 UTC (rev 318) @@ -43,7 +43,7 @@ CWARN = -Wall -Wstrict-prototypes CTUNING = -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums CFLAGS = $(COMMON) $(CDEBUG) $(CDEFS) $(CINCS) -O$(OPT) $(CWARN) $(CSTANDARD) $(CEXTRA) -CFLAGS += -MD -MP -MT $(*F).o -MF dep/$(@F).d +CFLAGS += -MD -MP -MT $(*F).o -MF dep/$(@F).d ## Assembly specific flags ASMFLAGS = $(COMMON) @@ -66,10 +66,10 @@ ## Objects that must be built in order to link -OBJECTS = main.o sensors.o motors.o global.o led.o communication.o i2c.o fifo.o ir.o parser.o config.o standalone.o +OBJECTS = main.o sensors.o motors.o global.o led.o communication.o i2c.o fifo.o ir.o parser.o config.o standalone.o ## Objects explicitly added by the user -LINKONLYOBJECTS = +LINKONLYOBJECTS = ## Build all: svnrev.h $(TARGET) tuxcore.hex tuxcore.eep tuxcore.lss size @@ -166,11 +166,11 @@ -include $(shell mkdir dep 2>/dev/null) $(wildcard dep/*) # Programming -prog: $(PROJECT).hex +prog: $(PROJECT).hex tuxup $(PROJECT).hex $(PROJECT).eep -progisp: $(PROJECT).hex +progisp: $(PROJECT).hex AVRDUDE -p $(MCU) -c jtag2isp -P usb -B 10 -e -U flash:w:$(PROJECT).hex -progstk: $(PROJECT).hex +progstk: $(PROJECT).hex AVRDUDE -p $(MCU) -c stk500v2 -e -U flash:w:$(PROJECT).hex Modified: firmware/tuxcore/trunk/communication.c =================================================================== --- firmware/tuxcore/trunk/communication.c 2007-05-12 11:57:43 UTC (rev 317) +++ firmware/tuxcore/trunk/communication.c 2007-05-12 12:08:09 UTC (rev 318) @@ -43,7 +43,7 @@ /* * audioIntBuf is a single buffer for audio commands to be sent to the audio - * interface + * interface * * audioIntBufIdx should be set to the number of valid bytes in the buffer, * depending on the number of parameters associated with the command. It is Modified: firmware/tuxcore/trunk/fifo.c =================================================================== --- firmware/tuxcore/trunk/fifo.c 2007-05-12 11:57:43 UTC (rev 317) +++ firmware/tuxcore/trunk/fifo.c 2007-05-12 12:08:09 UTC (rev 318) @@ -35,25 +35,25 @@ All functions that use modulo usually use typecasts i.e. the following statement - + \code length = (p->inIdx - p->outIdx) % p->size; \endcode has a problem when (p->inIdx - p->outIdx) is <0. Then the modulus is not done, the return value is 0xF9 for example. This is due to the implicit promotion of the intermediate value to an int. - + "%" is a signed modulus, so -1 % 8 == -1. We need to trim down the intermediate result to a uint8_t result immediately so the modulus applies to a uint8_t otherwise the implicit promotion of a uint8_t argument to an int expression makes the expression signed and brake the code for the above reason. The correct expression is - + \code length = ((uint8_t)(p->inIdx - p->outIdx) % p->size); \endcode So forgetting the typecast not only makes the code much bigger, it also brake it when the intermediate result is negative. - + */ /** \name Accessors Modified: firmware/tuxcore/trunk/fifo.h =================================================================== --- firmware/tuxcore/trunk/fifo.h 2007-05-12 11:57:43 UTC (rev 317) +++ firmware/tuxcore/trunk/fifo.h 2007-05-12 12:08:09 UTC (rev 318) @@ -72,7 +72,7 @@ /* * Adaptive parameters */ -/** \brief UD- Rate at which the adaptation is done. +/** \brief UD- Rate at which the adaptation is done. * * The adaptation function will only be run each 2^FIFO_ADAPT_RATE sample */ #define FIFO_ADAPT_RATE 3 /* adaptation is done each 2^FIFO_ADAPT_RATE sample */ Modified: firmware/tuxcore/trunk/ir.c =================================================================== --- firmware/tuxcore/trunk/ir.c 2007-05-12 11:57:43 UTC (rev 317) +++ firmware/tuxcore/trunk/ir.c 2007-05-12 12:08:09 UTC (rev 318) @@ -268,7 +268,7 @@ irRC5SendData.bit = RC5_BIT_NUMBER; irPulses = 0; /* Start interrupt by loading a bit */ irStatus = 0; /* reset status to send mode */ - /* code: S1 S2 T Address(5b) Command(6b) + /* code: S1 S2 T Address(5b) Command(6b) * S1, S2: start bits (always 1) * T: toggle bit, given with address */ irRC5SendData.code = address | 0xC0; /* Set the 2 start bits */ Modified: firmware/tuxcore/trunk/ir.h =================================================================== --- firmware/tuxcore/trunk/ir.h 2007-05-12 11:57:43 UTC (rev 317) +++ firmware/tuxcore/trunk/ir.h 2007-05-12 12:08:09 UTC (rev 318) @@ -100,7 +100,7 @@ * \param command - xxCCCCCC (C: RC5 6 bits command) * \note Tux can't send and receive IR at the same time because the code sent is also detected by the receiver and also because they share the same timer. So irSendRC5 will disable irGetRC5 when sending data. * - * Send an ir code following the Philips RC-5 Protocol. The RC-5 code from Philips is possibly the most used protocol by hobbyists, probably because of the wide availability of cheap remote controls. + * Send an ir code following the Philips RC-5 Protocol. The RC-5 code from Philips is possibly the most used protocol by hobbyists, probably because of the wide availability of cheap remote controls. * For more information on a couple of protocols, visit http://www.sbprojects.com/knowledge/ir/rc5.htm or google for it :-) */ void irSendRC5(uint8_t address, uint8_t command); Modified: firmware/tuxcore/trunk/motors.c =================================================================== --- firmware/tuxcore/trunk/motors.c 2007-05-12 11:57:43 UTC (rev 317) +++ firmware/tuxcore/trunk/motors.c 2007-05-12 12:08:09 UTC (rev 318) @@ -36,7 +36,7 @@ uint8_t pwmMaskB; /** - \brief Wings position interrupt + \brief Wings position interrupt \ingroup wings This interrupt stops the wings when the desired number of movements have been @@ -91,7 +91,7 @@ } /** - \brief Eyes position interrupt + \brief Eyes position interrupt \ingroup eyes This interrupt stops the eyes when the desired number of movements have been @@ -128,7 +128,7 @@ } /** - \brief Mouth position interrupt + \brief Mouth position interrupt \ingroup moth This interrupt stops the mouth when the desired number of movements have been @@ -170,12 +170,12 @@ } /** - \brief Spin position interrupt + \brief Spin position interrupt \ingroup spin This interrupt stops the spinning motor when the desired number of movements have been executed. - + The switch is pushed each XXX degrees. We set the interrupt in falling edge mode so there's no interrupt generated when the switch is released. */ @@ -234,7 +234,7 @@ MOT_SPIN_DDR |= MOT_SPIN_MK; /* both pins on the same port so we can use this mask */ } -/** +/** \brief Start waving the wings up and down \ingroup wings \param cnt number of movements before the wings will stop @@ -261,7 +261,7 @@ waveWings(2, 5); /* the first movement is to be sure the timer doesn't start counting from any unknown poistion and that the motors are in regime */ } -/** +/** \brief Blink the eyes \ingroup eyes \param cnt number of movements before the wings will stop @@ -277,7 +277,7 @@ runEyes(); } -/** +/** \brief Open the eyes \ingroup eyes @@ -289,7 +289,7 @@ blinkEyes(1); } -/** +/** \brief Close the eyes \ingroup eyes @@ -301,7 +301,7 @@ blinkEyes(1); } -/** +/** \brief Move the mouth \ingroup mouth \note Any eye command is cancelled @@ -317,7 +317,7 @@ runMouth(); } -/** +/** \brief Open the mouth \ingroup mouth @@ -329,7 +329,7 @@ moveMouth(1); } -/** +/** \brief Close the mouth \ingroup mouth Modified: firmware/tuxcore/trunk/motors.h =================================================================== --- firmware/tuxcore/trunk/motors.h 2007-05-12 11:57:43 UTC (rev 317) +++ firmware/tuxcore/trunk/motors.h 2007-05-12 12:08:09 UTC (rev 318) @@ -56,14 +56,14 @@ * Basic movements */ -/** +/** \brief Spin left for the \c angle amount \param angle Angle to turn, in 90 unit \ingroup spin */ void spinLeft(uint8_t angle, uint8_t pwm); -/** +/** \brief Spin right for the \c angle amount \param angle Angle to turn, in 90 unit \ingroup spin Modified: firmware/tuxdefs/commands.h =================================================================== --- firmware/tuxdefs/commands.h 2007-05-12 11:57:43 UTC (rev 317) +++ firmware/tuxdefs/commands.h 2007-05-12 12:08:09 UTC (rev 318) @@ -56,7 +56,7 @@ * - 0b01xxxxxx (0x40-0x7F) for functions requesting 1 parameter * - 0b10xxxxxx (0x80-0xBF) for functions requesting 2 parameters * - 0b11xxxxxx (0xC0-0xFF) for functions requesting 3 parameters - * + * * The same definition of commands are used for all communications between the * computer and Tux. But depending on the communication way, the set of * commands will differ. There will be 3 sets based on Tux's architecture: Modified: firmware/tuxup/trunk/bootloader.c =================================================================== --- firmware/tuxup/trunk/bootloader.c 2007-05-12 11:57:43 UTC (rev 317) +++ firmware/tuxup/trunk/bootloader.c 2007-05-12 12:08:09 UTC (rev 318) @@ -316,8 +316,8 @@ } /** - * Called when a data line is parsed. This routine will, - * in turn, call startSegment(), fillSegment(), and finishSegment() as + * Called when a data line is parsed. This routine will, + * in turn, call startSegment(), fillSegment(), and finishSegment() as * appropriate. * * @return TRUE if parsing should continue, FALSE if it should stop. @@ -474,7 +474,7 @@ if ((unsigned char)(checksumCalc + checksumFound) != 0) { - // Error(parser, "found checksum 0x%02x, expecting 0x%02x", + // Error(parser, "found checksum 0x%02x, expecting 0x%02x", // checksumFound, 0 - checksumCalc); return FALSE; } @@ -493,7 +493,7 @@ case 1: // EOF { ParsedData(parser, TRUE); /* fill the last segment and send it */ - // Flush(parser); /* XXX what to do here? */ + // Flush(parser); /* XXX what to do here? */ break; } Modified: firmware/tuxup/trunk/main.c =================================================================== --- firmware/tuxup/trunk/main.c 2007-05-12 11:57:43 UTC (rev 317) +++ firmware/tuxup/trunk/main.c 2007-05-12 12:08:09 UTC (rev 318) @@ -172,7 +172,7 @@ return nr; } -/* +/* * Check if the hex file is valid and return the CPU number for which it has * been compiled. Fills the version structure with the information extracted * from the hex file and returns 0 if the hex file has a cpu and version Modified: firmware/tuxup/trunk/usb-connection.c =================================================================== --- firmware/tuxup/trunk/usb-connection.c 2007-05-12 11:57:43 UTC (rev 317) +++ firmware/tuxup/trunk/usb-connection.c 2007-05-12 12:08:09 UTC (rev 318) @@ -39,7 +39,7 @@ * @{ */ -/** +/** * \brief Scan all USB busses to find Tux device * \return USB device of Tux */ @@ -66,7 +66,7 @@ return NULL; } -/** +/** * \brief Open USB interface * \param dev USB device * \return dev_h USB device handle @@ -100,7 +100,7 @@ return dev_h; } -/** +/** * \brief Close Tux interface * \param dev_h USB device handle * @@ -112,7 +112,7 @@ usb_close(dev_h); } -/** +/** * \brief Send commands to Tux's dongle * \param dev_h USB device handle * \return USB communication status @@ -144,7 +144,7 @@ return status; } -/** +/** * \brief Get commands from Tux's dongle * \param dev_h USB device handle * \return USB communication status Modified: firmware/tuxup/trunk/usb-connection.h =================================================================== --- firmware/tuxup/trunk/usb-connection.h 2007-05-12 11:57:43 UTC (rev 317) +++ firmware/tuxup/trunk/usb-connection.h 2007-05-12 12:08:09 UTC (rev 318) @@ -57,7 +57,7 @@ // unsigned char URB_CMD[][URB_LENGTH]={ // INIT REGISTER // { 0x8e,0x0a,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x68 }, -// GET STATUS +// GET STATUS // { 0x03,0x02,0x12,0x44,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF1 }, // }; |
From: jaguarondi <c2m...@c2...> - 2007-05-12 11:57:46
|
Author: jaguarondi Date: 2007-05-12 13:57:43 +0200 (Sat, 12 May 2007) New Revision: 317 Modified: api/python/trunk/CHANGES api/python/trunk/tux.py daemon/trunk/CHANGES daemon/trunk/Makefile daemon/trunk/README Log: Removed trailing whitespaces in daemon and api. Modified: api/python/trunk/CHANGES =================================================================== --- api/python/trunk/CHANGES 2007-05-12 09:54:06 UTC (rev 316) +++ api/python/trunk/CHANGES 2007-05-12 11:57:43 UTC (rev 317) @@ -9,21 +9,21 @@ Version 0.2.0: - * The api was completely remade. I Kept the changes made by Neimad lately. - Sorry for this brutal update. - * I have implemented the 'join()' suggestion from Damien for the threads too. - Consequently, this api is not fully compatible with the last one. - * A documentation system based on the docstring has been implemented and you - can build this with the function 'tux.misc.build_documentation'. - See 'tux.misc.doc(tux.misc.build_documentation)'. + * The api was completely remade. I Kept the changes made by Neimad lately. + Sorry for this brutal update. + * I have implemented the 'join()' suggestion from Damien for the threads too. + Consequently, this api is not fully compatible with the last one. + * A documentation system based on the docstring has been implemented and you + can build this with the function 'tux.misc.build_documentation'. + See 'tux.misc.doc(tux.misc.build_documentation)'. See 'tux.misc.doc(tux)' too Version 0.1.2: - * Alsa tux card device name is now constructed by the api for example, + * Alsa tux card device name is now constructed by the api for example, it is used for playing a sound with "aplay" * Fixed a typo in api/python/trunk/tuxapi_class.py - * New boolean variable "print_warnings" has been added for print or not + * New boolean variable "print_warnings" has been added for print or not of the warning messages. * print_api_version() command has been moved. Modified: api/python/trunk/tux.py =================================================================== --- api/python/trunk/tux.py 2007-05-12 09:54:06 UTC (rev 316) +++ api/python/trunk/tux.py 2007-05-12 11:57:43 UTC (rev 317) @@ -21,7 +21,7 @@ def exit(signum,frame): sys.exit(signum) - + def my_exitfunct(): tux.destroy() Modified: daemon/trunk/CHANGES =================================================================== --- daemon/trunk/CHANGES 2007-05-12 09:54:06 UTC (rev 316) +++ daemon/trunk/CHANGES 2007-05-12 11:57:43 UTC (rev 317) @@ -22,7 +22,7 @@ Version 0.1.7: - * Improved stability with mutexes. + * Improved stability with mutexes. * Code cleanup and bug fixes. Version 0.1.6: Modified: daemon/trunk/Makefile =================================================================== --- daemon/trunk/Makefile 2007-05-12 09:54:06 UTC (rev 316) +++ daemon/trunk/Makefile 2007-05-12 11:57:43 UTC (rev 317) @@ -17,23 +17,23 @@ OUTPUT_DIR = . TARGET = tuxdaemon C_INCLUDE_DIRS = -I"/usr/include/glib-2.0" -I"/usr/lib/glib-2.0/include" -I"/usr/local/include" - C_PREPROC = + C_PREPROC = CFLAGS = -pipe -Wall -Werror -g2 -O0 -DUSB_DEBUG LIB_DIRS = -L"/usr/include/glib-2.0" -L"/usr/lib/glib-2.0/include" -L"/usr/local/lib" - LIBS = -lglib-2.0 -lgthread-2.0 -lpthread -lusb + LIBS = -lglib-2.0 -lgthread-2.0 -lpthread -lusb LDFLAGS = -pipe endif ifeq ($(CFG),Release) OBJ_DIR = Release - OUTPUT_DIR = + OUTPUT_DIR = TARGET = USBDaemon - C_INCLUDE_DIRS = - C_PREPROC = - CFLAGS = -pipe -Wall -g0 -O2 - LIB_DIRS = - LIBS = - LDFLAGS = -pipe -s + C_INCLUDE_DIRS = + C_PREPROC = + CFLAGS = -pipe -Wall -g0 -O2 + LIB_DIRS = + LIBS = + LDFLAGS = -pipe -s endif SRC_OBJS = \ Modified: daemon/trunk/README =================================================================== --- daemon/trunk/README 2007-05-12 09:54:06 UTC (rev 316) +++ daemon/trunk/README 2007-05-12 11:57:43 UTC (rev 317) @@ -1,6 +1,6 @@ $Id$ -TUX Daemon is a daemon to control the tuxdroid robot. +TUX Daemon is a daemon to control the tuxdroid robot. usage : tuxdaemon [options] options: |
From: jaguarondi <c2m...@c2...> - 2007-05-12 09:54:08
|
Author: jaguarondi Date: 2007-05-12 11:54:06 +0200 (Sat, 12 May 2007) New Revision: 316 Modified: software/tuxgi/trunk/tuxgi.py Log: - BUG #21: xfce-terminal added to the list and list handling improved by neimad and madjar (Georges Dubus) Modified: software/tuxgi/trunk/tuxgi.py =================================================================== --- software/tuxgi/trunk/tuxgi.py 2007-05-11 22:03:29 UTC (rev 315) +++ software/tuxgi/trunk/tuxgi.py 2007-05-12 09:54:06 UTC (rev 316) @@ -58,14 +58,17 @@ toggled_by_event=False terminal_shells = [ - ('gnome-terminal','gnome-terminal -x python -i /opt/tuxdroid/api/python/tux.py'), # gnome - ('konsole','konsole -e python -i /opt/tuxdroid/api/python/tux.py'), # kde - ('Terminal',' -x python -i /opt/tuxdroid/api/python/tux.py'), # xfce - ('xterm','xterm -e python -i /opt/tuxdroid/api/python/tux.py'), # X + ('gnome-terminal', '-x'), # gnome + ('konsole', '-e'), # kde + ('Terminal', '-x'), # xfce + ('xfce4-terminal', '-x'), # xfce + ('xterm', '-e'), # X ] # list of tuple instead of a dictionary as the order matters + for term in terminal_shells: if not os.popen('type %s'%term[0]).close(): - xterm_cmd = term[1] + xterm_cmd = '%s %s python -i /opt/tuxdroid/api/python/tux.py' \ + % (term[0], term[1]) break #============================================================================== # Main window class |
From: jaguarondi <c2m...@c2...> - 2007-05-11 22:03:30
|
Author: jaguarondi Date: 2007-05-12 00:03:29 +0200 (Sat, 12 May 2007) New Revision: 315 Modified: software/tuxgi/trunk/tuxgi.py Log: - BUG: this is an attempt to solve bug #21 in order to support terminals in gnome, kde, xfce and X Modified: software/tuxgi/trunk/tuxgi.py =================================================================== --- software/tuxgi/trunk/tuxgi.py 2007-05-11 21:04:09 UTC (rev 314) +++ software/tuxgi/trunk/tuxgi.py 2007-05-11 22:03:29 UTC (rev 315) @@ -57,10 +57,16 @@ status_list_changed=False toggled_by_event=False -for term in ["gnome-terminal", "konsole", "Terminal", "xterm"]: - if not os.popen('type %s'%term).close(): - terminal_app=term - break +terminal_shells = [ + ('gnome-terminal','gnome-terminal -x python -i /opt/tuxdroid/api/python/tux.py'), # gnome + ('konsole','konsole -e python -i /opt/tuxdroid/api/python/tux.py'), # kde + ('Terminal',' -x python -i /opt/tuxdroid/api/python/tux.py'), # xfce + ('xterm','xterm -e python -i /opt/tuxdroid/api/python/tux.py'), # X + ] # list of tuple instead of a dictionary as the order matters +for term in terminal_shells: + if not os.popen('type %s'%term[0]).close(): + xterm_cmd = term[1] + break #============================================================================== # Main window class #============================================================================== @@ -379,7 +385,7 @@ # On "Tux Droid shell" button clicked #-------------------------------------------------------------------------- def on_tdshell_bt_clicked(self, widget, *args): - tux.sys.shell_free(terminal_app + ' -e "tuxsh"') + tux.sys.shell_free(xterm_cmd) #-------------------------------------------------------------------------- # On "Get light level" button clicked |
From: jaguarondi <c2m...@c2...> - 2007-05-11 21:04:37
|
Author: jaguarondi Date: 2007-05-11 23:04:09 +0200 (Fri, 11 May 2007) New Revision: 314 Added: software/tuxgi/ software/tuxgi/trunk/tuxgi.py software/tuxgi/trunk/tuxgi2.glade Removed: software/gtdi/ software/tuxgi/trunk/gtdi.py software/tuxgi/trunk/gtdi2.glade Log: Renamed gtdi into tuxgi Copied: software/tuxgi (from rev 313, software/gtdi) Deleted: software/tuxgi/trunk/gtdi.py =================================================================== --- software/gtdi/trunk/gtdi.py 2007-05-11 14:58:11 UTC (rev 313) +++ software/tuxgi/trunk/gtdi.py 2007-05-11 21:04:09 UTC (rev 314) @@ -1,738 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- - -# ----------------------------------------------------------------------------- -# Tux Droid - Graphique Interface -# Copyright (C) 2007 C2ME Sa <rem...@c2...> -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, or (at your option) -# any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. -# ----------------------------------------------------------------------------- -# $Id: $ -# ----------------------------------------------------------------------------- - -# ----------------------------------------------- -# Initalization of modules -# uses objects "tux" and "tss" -# ----------------------------------------------- -import sys -sys.path.append('/opt/tuxdroid/api/python') -from tux import * -# ----------------------------------------------- -# Your script -# ----------------------------------------------- -import os -from version import app_version -import gtk -import gobject -import thread - -from SimpleGladeApp import SimpleGladeApp -from SimpleGladeApp import bindtextdomain - -app_name = "gtdi2" -print "Graphical TuxDroid Interface " + app_version -glade_dir = "" -locale_dir = "" -soundcard = tux.hw.alsa_device - -bindtextdomain(app_name, locale_dir) - -scommand_window=None -onpause=False -onplay=False -status_list_st=[] -status_list_changed=False -toggled_by_event=False - -for term in ["gnome-terminal", "konsole", "Terminal", "xterm"]: - if not os.popen('type %s'%term).close(): - terminal_app=term - break -#============================================================================== -# Main window class -#============================================================================== -class Window1(SimpleGladeApp): - - #-------------------------------------------------------------------------- - # Class init - #-------------------------------------------------------------------------- - def __init__(self, path="gtdi2.glade", - root="window1", - domain=app_name, **kwargs): - path = os.path.join(glade_dir, path) - SimpleGladeApp.__init__(self, path, root, domain, **kwargs) - - #-------------------------------------------------------------------------- - # On new window - #-------------------------------------------------------------------------- - def new(self): - self.get_widget("comboboxentry1").set_active(2) - tux.tts.on_sound_on=self.on_sound_on - tux.tts.on_sound_off=self.on_sound_off - tux.event.on_status=self.on_status - tux.event.on_left_blue_led_on=self.on_right_blue_led_on - tux.event.on_left_blue_led_off=self.on_right_blue_led_off - tux.event.on_right_blue_led_on=self.on_left_blue_led_on - tux.event.on_right_blue_led_off=self.on_left_blue_led_off - tux.event.on_mouth_stop=self.on_mouth_stop - tux.event.on_eyes_stop=self.on_eyes_stop - thread.start_new_thread(self.status_viewer_thread,()) - tux.daemon.auto_connect(True) - tux.tts.auto_connect(True) - - #-------------------------------------------------------------------------- - # On window destroy - #-------------------------------------------------------------------------- - def on_window1_destroy(self, widget, *args): - global toggled_by_event - toggled_by_event=True - tux.destroy() - sys.exit(0) - - #-------------------------------------------------------------------------- - # On left blue led status is on - #-------------------------------------------------------------------------- - def on_left_blue_led_on(self): - global toggled_by_event - toggled_by_event=True - self.get_widget("checkbutton1").set_active(True) - toggled_by_event=False - - #-------------------------------------------------------------------------- - # On left blue led status is off - #-------------------------------------------------------------------------- - def on_left_blue_led_off(self): - global toggled_by_event - toggled_by_event=True - self.get_widget("checkbutton1").set_active(False) - toggled_by_event=False - - #-------------------------------------------------------------------------- - # On right blue led status is on - #-------------------------------------------------------------------------- - def on_right_blue_led_on(self): - global toggled_by_event - toggled_by_event=True - self.get_widget("checkbutton2").set_active(True) - toggled_by_event=False - - #-------------------------------------------------------------------------- - # On right blue led status is off - #-------------------------------------------------------------------------- - def on_right_blue_led_off(self): - global toggled_by_event - toggled_by_event=True - self.get_widget("checkbutton2").set_active(False) - toggled_by_event=False - - #-------------------------------------------------------------------------- - # On mouth stop - #-------------------------------------------------------------------------- - def on_mouth_stop(self): - global toggled_by_event - toggled_by_event=True - if tux.status.get_mouth_open_position()==0: - self.get_widget("radiobutton3").set_active(True) - else: - self.get_widget("radiobutton4").set_active(True) - toggled_by_event=False - - #-------------------------------------------------------------------------- - # On eyes stop - #-------------------------------------------------------------------------- - def on_eyes_stop(self): - global toggled_by_event - toggled_by_event=True - if tux.status.get_eyes_closed_position_switch()==1: - self.get_widget("radiobutton1").set_active(True) - else: - self.get_widget("radiobutton2").set_active(True) - toggled_by_event=False - - #-------------------------------------------------------------------------- - # Event on status - #-------------------------------------------------------------------------- - def on_status(self): - global status_list_st - global status_list_changed - explicite_status=tux.explicit_status() - if explicite_status.find("RF connected->") != 0: - status_list_changed=True - status_list_st.append(explicite_status) - if len(status_list_st)==50: - for i in range(1): - status_list_st.pop(0) - - #-------------------------------------------------------------------------- - # Status viewer refreshing thread - #-------------------------------------------------------------------------- - def status_viewer_thread(self): - global status_list_st - global status_list_changed - global onpause - global onplay - last_tuxdaemon_connect=False - last_tuxttsdaemon_connect=False - last_rf_state=False - while True: - if status_list_changed: - status_list_changed=False - statusview_b=self.get_widget("textview1").get_buffer() - statusview_b.set_text("") - startiter = statusview_b.get_start_iter() - string="" - if self.get_widget("checkbutton3").get_active(): - for i in range(len(status_list_st)): - string=status_list_st[i]+"\n"+string - else: - string=status_list_st[len(status_list_st)-1]+"\n" - statusview_b.insert(startiter,string) - if tux.daemon.connected!=last_tuxdaemon_connect: - last_tuxdaemon_connect=tux.daemon.connected - if tux.daemon.connected: - onpause=False - onplay=False - global toggled_by_event - toggled_by_event=True - global soundcard - tux.hw.alsa_devices_select(0) - soundcard = tux.hw.alsa_device - self.get_widget("togglebutton3").set_active(False) - toggled_by_event=False - self.get_widget("image2").set_from_stock(gtk.STOCK_APPLY\ - ,gtk.ICON_SIZE_BUTTON) - self.on_mouth_stop() - self.on_eyes_stop() - tux.cmd.leds_blink(2,1) - else: - self.get_widget("image2").set_from_stock(gtk.STOCK_CANCEL\ - ,gtk.ICON_SIZE_BUTTON) - tux.status.rf_connected = False - if tux.tts.connected!=last_tuxttsdaemon_connect: - last_tuxttsdaemon_connect=tux.tts.connected - if tux.tts.connected: - self.get_widget("image3").set_from_stock(gtk.STOCK_APPLY\ - ,gtk.ICON_SIZE_BUTTON) - else: - self.get_widget("image3").set_from_stock(gtk.STOCK_CANCEL\ - ,gtk.ICON_SIZE_BUTTON) - if tux.status.rf_state()!=last_rf_state: - last_rf_state = tux.status.rf_connected - if last_rf_state: - self.get_widget("image4").set_from_stock(gtk.STOCK_APPLY\ - ,gtk.ICON_SIZE_BUTTON) - else: - self.get_widget("image4").set_from_stock(gtk.STOCK_CANCEL\ - ,gtk.ICON_SIZE_BUTTON) - tux.sys.wait(0.5) -# ----------------------------------------------------------------------------- -# Tab "main" events -# ----------------------------------------------------------------------------- - - #-------------------------------------------------------------------------- - # On left led checkbox toggled - #-------------------------------------------------------------------------- - def on_ledl_toggled(self, widget, *args): - global toggled_by_event - if toggled_by_event: return - if widget.get_active(): - tux.cmd.ledl_on() - else: - tux.cmd.ledl_off() - - #-------------------------------------------------------------------------- - # On right led checkbox toggled - #-------------------------------------------------------------------------- - def on_ledr_toggled(self, widget, *args): - global toggled_by_event - if toggled_by_event: return - if widget.get_active(): - tux.cmd.ledr_on() - else: - tux.cmd.ledr_off() - - #-------------------------------------------------------------------------- - # On flash leds button clicked - #-------------------------------------------------------------------------- - def on_flash_bt_clicked(self, widget, *args): - def _funct(): - num_sb=self.get_widget("spinbutton1") - tux.cmd.leds_blink(int(num_sb.get_value()),15) - - thread.start_new_thread(_funct,()) - - #-------------------------------------------------------------------------- - # On eyes open radiobutton toggled - #-------------------------------------------------------------------------- - def on_eyes_open_toggled(self, widget, *args): - global toggled_by_event - if toggled_by_event: return - if widget.get_active(): - tux.cmd.eyes_open() - - #-------------------------------------------------------------------------- - # On eyes close radiobutton toggled - #-------------------------------------------------------------------------- - def on_eyes_close_toggled(self, widget, *args): - global toggled_by_event - if toggled_by_event: return - if widget.get_active(): - tux.cmd.eyes_close() - - #-------------------------------------------------------------------------- - # On eyes blink button clicked - #-------------------------------------------------------------------------- - def on_eyes_blink_bt_clicked(self, widget, *args): - num_sb=self.get_widget("spinbutton2") - tux.cmd.eyes_on_free(int(num_sb.get_value())) - - #-------------------------------------------------------------------------- - # On beak open radiobutton toggled - #-------------------------------------------------------------------------- - def on_beak_open_toggled(self, widget, *args): - global toggled_by_event - if toggled_by_event: return - if widget.get_active(): - tux.cmd.mouth_open() - - #-------------------------------------------------------------------------- - # On beak close radiobutton toggled - #-------------------------------------------------------------------------- - def on_rbeak_close_toggled(self, widget, *args): - global toggled_by_event - if toggled_by_event: return - if widget.get_active(): - tux.cmd.mouth_close() - - #-------------------------------------------------------------------------- - # On beak talk button clicked - #-------------------------------------------------------------------------- - def on_beak_talk_bt_clicked(self, widget, *args): - num_sb=self.get_widget("spinbutton3") - tux.cmd.mouth_on_free(int(num_sb.get_value())) - - #-------------------------------------------------------------------------- - # On flippers up radiobutton toggled - #-------------------------------------------------------------------------- - def on_flippers_up_toggled(self, widget, *args): - def _funct(): - global toggled_by_event - if toggled_by_event: return - if widget.get_active(): - tux.cmd.raw(0x31,0,0,0) - tux.event.wait_status(DATAS_STATUS_WINGS_POSITION_COUNTER,0,5) - tux.cmd.wings_on(1) - - thread.start_new_thread(_funct,()) - - #-------------------------------------------------------------------------- - # On flippers down radiobutton toggled - #-------------------------------------------------------------------------- - def on_flippers_down_toggled(self, widget, *args): - def _funct(): - global toggled_by_event - if toggled_by_event: return - if widget.get_active(): - tux.cmd.raw(0x31,0,0,0) - tux.event.wait_status(DATAS_STATUS_WINGS_POSITION_COUNTER,0,5) - - thread.start_new_thread(_funct,()) - - #-------------------------------------------------------------------------- - # On flippers flap button clicked - #-------------------------------------------------------------------------- - def on_flippers_flap_bt_clicked(self, widget, *args): - num_sb=self.get_widget("spinbutton4") - tux.cmd.wings_on_free(int(num_sb.get_value())) - - #-------------------------------------------------------------------------- - # On rotation button clicked - #-------------------------------------------------------------------------- - def on_rotation_spin_bt_clicked(self, widget, *args): - num_sb=self.get_widget("spinbutton5") - if self.get_widget("radiobutton7").get_active(): - tux.cmd.spinl_on_free(int(num_sb.get_value())) - else: - tux.cmd.spinr_on_free(int(num_sb.get_value())) - - - #-------------------------------------------------------------------------- - # On "Send command" button clicked - #-------------------------------------------------------------------------- - def on_scommand_bt_clicked(self, widget, *args): - Window2().run() - - #-------------------------------------------------------------------------- - # On "Tux Droid shell" button clicked - #-------------------------------------------------------------------------- - def on_tdshell_bt_clicked(self, widget, *args): - tux.sys.shell_free(terminal_app + ' -e "tuxsh"') - - #-------------------------------------------------------------------------- - # On "Get light level" button clicked - #-------------------------------------------------------------------------- - def on_cversion_bt_clicked(self, widget, *args): - thread.start_new_thread(tux.status.get_light_level,()) - - #-------------------------------------------------------------------------- - # On "Ping" button clicked - #-------------------------------------------------------------------------- - def on_ping_bt_clicked(self, widget, *args): - thread.start_new_thread(tux.cmd.ping,(200,)) - -# ----------------------------------------------------------------------------- -# Tab "TTS" events -# ----------------------------------------------------------------------------- - - #-------------------------------------------------------------------------- - # On "default" button clicked - #-------------------------------------------------------------------------- - def on_tts_default_bt_clicked(self, widget, *args): - self.get_widget("comboboxentry1").set_active(2) - self.get_widget("spinbutton6").set_value(100) - - #-------------------------------------------------------------------------- - # On "play" button clicked - #-------------------------------------------------------------------------- - def on_tts_play_bt_clicked(self, widget, *args): - global toggled_by_event - if toggled_by_event: return - global onplay - if onplay: - tux.tts.stop() - else: - voice_cb=self.get_widget("comboboxentry1") - pitch_sb=self.get_widget("spinbutton6") - tux.tts.select_voice(voice_cb.get_active()+1,pitch_sb.get_value()) - tux.tts.stop() - textedit=self.get_widget("textview2") - buffer=textedit.get_buffer() - my_text=buffer.get_text(*buffer.get_bounds()) - tux.tts.speak_free(my_text) - - #-------------------------------------------------------------------------- - # On "pause" button clicked - #-------------------------------------------------------------------------- - def on_tts_pause_bt_clicked(self, widget, *args): - global onpause - if onpause: - tux.tts.play() - onpause=False - else: - tux.tts.pause() - onpause=True - - #-------------------------------------------------------------------------- - # On "Clear text" button clicked - #-------------------------------------------------------------------------- - def on_tts_ctext_bt_clicked(self, widget, *args): - textedit=self.get_widget("textview2") - buffer=textedit.get_buffer() - buffer.set_text("") - - #-------------------------------------------------------------------------- - # On TTS sound on event - #-------------------------------------------------------------------------- - def on_sound_on(self): - global onplay - global toggled_by_event - toggled_by_event=True - self.get_widget("togglebutton3").set_active(True) - toggled_by_event=False - onplay=True - tux.cmd.mouth_open() - - #-------------------------------------------------------------------------- - # On TTS sound off event - #-------------------------------------------------------------------------- - def on_sound_off(self): - global onplay - global toggled_by_event - toggled_by_event=True - self.get_widget("togglebutton3").set_active(False) - toggled_by_event=False - onplay=False - tux.cmd.mouth_close() - -# ----------------------------------------------------------------------------- -# Tab "Audio" events -# ----------------------------------------------------------------------------- - - #-------------------------------------------------------------------------- - # On select external wave file event - #-------------------------------------------------------------------------- - def on_wave_external_changed(self, widget, *args): - filename=widget.get_filename() - ext=len(filename)-filename.find(".wav") - if ext != 4 : - widget.unselect_filename(filename) - - #-------------------------------------------------------------------------- - # On "play" external wave file button clicked - #-------------------------------------------------------------------------- - def on_wave_external_play_bt_clicked(self, widget, *args): - if str(self.get_widget("filechooserbutton1").get_filename())=="None": return - tux.sys.shell_free("aplay -D %s %s"% (soundcard,\ - self.get_widget("filechooserbutton1").get_filename())) - - #-------------------------------------------------------------------------- - # On select original sounds - #-------------------------------------------------------------------------- - def on_incl_orig_toggled(self, widget, *args): - st_wav_paths = wavs.wav_paths - if widget.get_active(): - wavs.wav_paths=[] - wavs.wav_sizes=[] - for i in range(9): - wavs.add_wav_path('/opt/tuxdroid/apps/gtdi/sounds/%d.wav'%(i+1)) - for path in st_wav_paths: - wavs.add_wav_path(path) - else: - if len(st_wav_paths) > 9: - for i in range(9): - wavs.wav_sizes.pop(0) - wavs.wav_paths.pop(0) - else: - wavs.wav_paths=[] - wavs.wav_sizes=[] - self.refresh_wav_list() - - #-------------------------------------------------------------------------- - # On select internal wave file event - #-------------------------------------------------------------------------- - def on_wave_internal_changed(self, widget, *args): - filename=widget.get_filename() - ext=len(filename)-filename.find(".wav") - if ext != 4 : - widget.unselect_filename(filename) - - #-------------------------------------------------------------------------- - # On "add" button clicked - #-------------------------------------------------------------------------- - def on_wave_internal_add_bt_clicked(self, widget, *args): - if str(self.get_widget("filechooserbutton2").get_filename())=="None": return - wavs.add_wav_path(self.get_widget("filechooserbutton2").get_filename()) - self.refresh_wav_list() - - #-------------------------------------------------------------------------- - # On "remove" button clicked - #-------------------------------------------------------------------------- - def on_wave_internal_remove_bt_clicked(self, widget, *args): - index=int(self.get_widget("spinbutton8").get_value()) - if index>len(wavs.wav_paths):return - wavs.wav_sizes.pop(index-1) - wavs.wav_paths.pop(index-1) - self.refresh_wav_list() - - #-------------------------------------------------------------------------- - # Refreshing wave list function - #-------------------------------------------------------------------------- - def refresh_wav_list(self): - wav_te=self.get_widget("textview3") - wav_buffer=wav_te.get_buffer() - wav_buffer.set_text("") - i=1 - for wavfile in wavs.wav_paths: - filename=wavfile[wavfile.rfind('/')+1:] - wav_buffer.insert(wav_buffer.get_end_iter(),"%.2d : %s\n" %(i,filename)) - i=i+1 - - #-------------------------------------------------------------------------- - # On "clear" internal wave file list button clicked - #-------------------------------------------------------------------------- - def on_wave_internal_clist_bt_clicked(self, widget, *args): - wavs.wav_sizes=[] - wavs.wav_paths=[] - self.get_widget("checkbutton4").set_active(False) - self.refresh_wav_list() - - #-------------------------------------------------------------------------- - # On "store" button clicked - #-------------------------------------------------------------------------- - def on_wave_internal_store_bt_clicked(self, widget, *args): - thread.start_new_thread(self.sound_storing,()) - - #-------------------------------------------------------------------------- - # Store sound function - #-------------------------------------------------------------------------- - def sound_storing(self): - if tux.status.rf_state() == 0: return - if len(wavs.wav_sizes)==0: return - wav_te=self.get_widget("textview3") - wav_buffer=wav_te.get_buffer() - if not wavs.wavs_merging("merged.wav"): - print wav_buffer.insert(wav_buffer.get_end_iter(),\ - "Sound storing : Error : file merged is too big\n") - return - wav_buffer.insert(wav_buffer.get_end_iter(),\ - "Sound storing : Erase flash\n") - tux.cmd.sound_storing(len(wavs.wav_sizes)) - tux.sys.wait(10) - current_pos=0x0400 - tux.sys.wait(0.1) - wav_buffer.insert(wav_buffer.get_end_iter(),\ - "Sound storing : Indexes\n") - tux.cmd.sound_store_index(0x00,0x04,0x00) - for size in wavs.wav_sizes: - current_pos=current_pos+size - tux.sys.wait(0.1) - tux.cmd.sound_store_index((current_pos & 0xFF0000)>>16,\ - (current_pos & 0x00FF00)>>8,current_pos & 0x0000FF) - wav_buffer.insert(wav_buffer.get_end_iter(),"Sound storing : Record\n") - tux.sys.shell("aplay -D %s merged.wav"%soundcard) - wav_buffer.insert(wav_buffer.get_end_iter(),\ - "Sound storing : Storage done.\n") - tux.sys.wait(0.3) - - #-------------------------------------------------------------------------- - # On "play" flash sound button clicked - #-------------------------------------------------------------------------- - def on_wave_internal_play_bt_clicked(self, widget, *args): - def _funct(): - index=self.get_widget("spinbutton7").get_value() - tux.cmd.sound_play(int(index),0) - - thread.start_new_thread(_funct,()) - - #-------------------------------------------------------------------------- - # On "play flash sound number 1" button clicked - #-------------------------------------------------------------------------- - def on_wave_internal_play1_clicked(self, widget, *args): - thread.start_new_thread(tux.cmd.sound_play,(1,0,)) - - #-------------------------------------------------------------------------- - # On "play flash sound number 2" button clicked - #-------------------------------------------------------------------------- - def on_wave_internal_play2_clicked(self, widget, *args): - thread.start_new_thread(tux.cmd.sound_play,(2,0,)) - - #-------------------------------------------------------------------------- - # On "play flash sound number 3" button clicked - #-------------------------------------------------------------------------- - def on_wave_internal_play3_clicked(self, widget, *args): - thread.start_new_thread(tux.cmd.sound_play,(3,0,)) - - #-------------------------------------------------------------------------- - # On "play flash sound number 4" button clicked - #-------------------------------------------------------------------------- - def on_wave_internat_play4_clicked(self, widget, *args): - thread.start_new_thread(tux.cmd.sound_play,(4,0,)) - - #-------------------------------------------------------------------------- - # On "play flash sound number 5" button clicked - #-------------------------------------------------------------------------- - def on_wave_internal_play5_clicked(self, widget, *args): - thread.start_new_thread(tux.cmd.sound_play,(5,0,)) - - #-------------------------------------------------------------------------- - # On "play flash sound number 6" button clicked - #-------------------------------------------------------------------------- - def on_wave_internal_play6_clicked(self, widget, *args): - thread.start_new_thread(tux.cmd.sound_play,(6,0,)) - - #-------------------------------------------------------------------------- - # On "play flash sound number 7" button clicked - #-------------------------------------------------------------------------- - def on_wave_internal_play7_clicked(self, widget, *args): - thread.start_new_thread(tux.cmd.sound_play,(7,0,)) - - #-------------------------------------------------------------------------- - # On "play flash sound number 8" button clicked - #-------------------------------------------------------------------------- - def on_wave_internal_play8_clicked(self, widget, *args): - thread.start_new_thread(tux.cmd.sound_play,(8,0,)) - - #-------------------------------------------------------------------------- - # On "play flash sound number 9" button clicked - #-------------------------------------------------------------------------- - def on_wave_internal_play9_clicked(self, widget, *args): - thread.start_new_thread(tux.cmd.sound_play,(9,0,)) - - #-------------------------------------------------------------------------- - # On "play flash sound number 10" button clicked - #-------------------------------------------------------------------------- - def on_wave_internal_play10_clicked(self, widget, *args): - thread.start_new_thread(tux.cmd.sound_play,(10,0,)) - - #-------------------------------------------------------------------------- - # On "Play recorded wave file" button clicked - #-------------------------------------------------------------------------- - def on_mic_play_bt_clicked(self, widget, *args): - tux.sys.shell_free("aplay -D %s rec.wav"%soundcard) - - #-------------------------------------------------------------------------- - # On "Record wave file" button clicked - #-------------------------------------------------------------------------- - def on_mic_record_bt_clicked(self, widget, *args): - tux.cmd.mouth_open() - tux.sys.shell("arecord -D %s -d 10 -t wav rec.wav"%soundcard) - tux.cmd.mouth_close() - -#============================================================================== -# Send command window class -#============================================================================== -class Window2(SimpleGladeApp): - - #-------------------------------------------------------------------------- - # Init class - #-------------------------------------------------------------------------- - def __init__(self, path="gtdi2.glade", - root="window2", - domain=app_name, **kwargs): - path = os.path.join(glade_dir, path) - SimpleGladeApp.__init__(self, path, root, domain, **kwargs) - - #-------------------------------------------------------------------------- - # On new window - #-------------------------------------------------------------------------- - def new(self): - print "A new %s has been created" % self.__class__.__name__ - - #-------------------------------------------------------------------------- - # On window destroy - #-------------------------------------------------------------------------- - def on_window2_destroy(self, widget, *args): - print "closed" - - #-------------------------------------------------------------------------- - # On "Send command" button clicked - #-------------------------------------------------------------------------- - def on_sendcommand_bt_clicked(self, widget, *args): - commandst=self.get_widget("entry1").get_text() - commands=commandst.split(" ") - if len(commands)<4: - return - else: - commandp=[0,0,0,0] - for i in range(len(commands)): - if commands[i].find("0x")!=-1: - commandp[i]=int(commands[i][2:],16) - else: - commandp[i]=int(commands[i]) - tux.cmd.raw(int(commandp[0]),int(commandp[1]),int(commandp[2]),\ - int(commandp[3])) - - -#------------------------------------------------------------------------------ -# Main -#------------------------------------------------------------------------------ -def main(): - g_tDI = Window1() - gtk.gdk.threads_init() - g_tDI.run() - -if __name__ == "__main__": - main() Deleted: software/tuxgi/trunk/gtdi2.glade =================================================================== --- software/gtdi/trunk/gtdi2.glade 2007-05-11 14:58:11 UTC (rev 313) +++ software/tuxgi/trunk/gtdi2.glade 2007-05-11 21:04:09 UTC (rev 314) @@ -1,2431 +0,0 @@ -<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*--> -<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd"> - -<glade-interface> - -<widget class="GtkWindow" id="window1"> - <property name="width_request">621</property> - <property name="height_request">403</property> - <property name="visible">True</property> - <property name="title" translatable="yes">Tux Droid Interface</property> - <property name="type">GTK_WINDOW_TOPLEVEL</property> - <property name="window_position">GTK_WIN_POS_NONE</property> - <property name="modal">False</property> - <property name="resizable">False</property> - <property name="destroy_with_parent">False</property> - <property name="decorated">True</property> - <property name="skip_taskbar_hint">False</property> - <property name="skip_pager_hint">False</property> - <property name="type_hint">GDK_WINDOW_TYPE_HINT_NORMAL</property> - <property name="gravity">GDK_GRAVITY_NORTH_WEST</property> - <property name="focus_on_map">True</property> - <property name="urgency_hint">False</property> - <signal name="destroy" handler="on_window1_destroy"/> - - <child> - <widget class="GtkNotebook" id="notebook1"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="show_tabs">True</property> - <property name="show_border">True</property> - <property name="tab_pos">GTK_POS_TOP</property> - <property name="scrollable">False</property> - <property name="enable_popup">False</property> - - <child> - <widget class="GtkVBox" id="vbox1"> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">0</property> - - <child> - <widget class="GtkHBox" id="hbox1"> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">0</property> - - <child> - <widget class="GtkFrame" id="frame1"> - <property name="border_width">2</property> - <property name="visible">True</property> - <property name="label_xalign">0</property> - <property name="label_yalign">0.5</property> - <property name="shadow_type">GTK_SHADOW_OUT</property> - - <child> - <widget class="GtkAlignment" id="alignment1"> - <property name="visible">True</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xscale">1</property> - <property name="yscale">1</property> - <property name="top_padding">0</property> - <property name="bottom_padding">0</property> - <property name="left_padding">12</property> - <property name="right_padding">0</property> - - <child> - <widget class="GtkFixed" id="fixed1"> - <property name="visible">True</property> - - <child> - <widget class="GtkImage" id="image2"> - <property name="width_request">21</property> - <property name="height_request">21</property> - <property name="visible">True</property> - <property name="stock">gtk-cancel</property> - <property name="icon_size">4</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - </widget> - <packing> - <property name="x">192</property> - <property name="y">0</property> - </packing> - </child> - - <child> - <widget class="GtkImage" id="image3"> - <property name="width_request">21</property> - <property name="height_request">21</property> - <property name="visible">True</property> - <property name="stock">gtk-cancel</property> - <property name="icon_size">4</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - </widget> - <packing> - <property name="x">192</property> - <property name="y">24</property> - </packing> - </child> - - <child> - <widget class="GtkImage" id="image4"> - <property name="width_request">21</property> - <property name="height_request">21</property> - <property name="visible">True</property> - <property name="stock">gtk-cancel</property> - <property name="icon_size">4</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - </widget> - <packing> - <property name="x">192</property> - <property name="y">48</property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label27"> - <property name="width_request">166</property> - <property name="height_request">20</property> - <property name="visible">True</property> - <property name="label" translatable="yes">Radio connection</property> - <property name="use_underline">False</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">True</property> - <property name="selectable">False</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> - <property name="width_chars">-1</property> - <property name="single_line_mode">False</property> - <property name="angle">0</property> - </widget> - <packing> - <property name="x">0</property> - <property name="y">48</property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label9"> - <property name="width_request">136</property> - <property name="height_request">20</property> - <property name="visible">True</property> - <property name="label" translatable="yes">Tux Droid daemon</property> - <property name="use_underline">False</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">True</property> - <property name="selectable">False</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> - <property name="width_chars">-1</property> - <property name="single_line_mode">False</property> - <property name="angle">0</property> - </widget> - <packing> - <property name="x">0</property> - <property name="y">0</property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label10"> - <property name="width_request">166</property> - <property name="height_request">20</property> - <property name="visible">True</property> - <property name="label" translatable="yes">Text To Speech daemon</property> - <property name="use_underline">False</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">True</property> - <property name="selectable">False</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> - <property name="width_chars">-1</property> - <property name="single_line_mode">False</property> - <property name="angle">0</property> - </widget> - <packing> - <property name="x">0</property> - <property name="y">24</property> - </packing> - </child> - </widget> - </child> - </widget> - </child> - - <child> - <widget class="GtkLabel" id="label4"> - <property name="visible">True</property> - <property name="label" translatable="yes"><b>Tuxdroid status</b></property> - <property name="use_underline">False</property> - <property name="use_markup">True</property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> - <property name="width_chars">-1</property> - <property name="single_line_mode">False</property> - <property name="angle">0</property> - </widget> - <packing> - <property name="type">label_item</property> - </packing> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">True</property> - <property name="fill">True</property> - </packing> - </child> - - <child> - <widget class="GtkFrame" id="frame2"> - <property name="border_width">2</property> - <property name="visible">True</property> - <property name="label_xalign">0</property> - <property name="label_yalign">0.5</property> - <property name="shadow_type">GTK_SHADOW_OUT</property> - - <child> - <widget class="GtkAlignment" id="alignment2"> - <property name="visible">True</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xscale">1</property> - <property name="yscale">1</property> - <property name="top_padding">0</property> - <property name="bottom_padding">0</property> - <property name="left_padding">12</property> - <property name="right_padding">0</property> - - <child> - <widget class="GtkFixed" id="fixed2"> - <property name="visible">True</property> - - <child> - <widget class="GtkSpinButton" id="spinbutton1"> - <property name="width_request">56</property> - <property name="height_request">27</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="climb_rate">1</property> - <property name="digits">0</property> - <property name="numeric">False</property> - <property name="update_policy">GTK_UPDATE_ALWAYS</property> - <property name="snap_to_ticks">False</property> - <property name="wrap">False</property> - <property name="adjustment">20 1 255 1 10 10</property> - </widget> - <packing> - <property name="x">2</property> - <property name="y">29</property> - </packing> - </child> - - <child> - <widget class="GtkCheckButton" id="checkbutton1"> - <property name="width_request">46</property> - <property name="height_request">22</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="label" translatable="yes">Left</property> - <property name="use_underline">True</property> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="focus_on_click">True</property> - <property name="active">False</property> - <property name="inconsistent">False</property> - <property name="draw_indicator">True</property> - <signal name="toggled" handler="on_ledl_toggled"/> - </widget> - <packing> - <property name="x">0</property> - <property name="y">0</property> - </packing> - </child> - - <child> - <widget class="GtkCheckButton" id="checkbutton2"> - <property name="width_request">56</property> - <property name="height_request">22</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="label" translatable="yes">Right</property> - <property name="use_underline">True</property> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="focus_on_click">True</property> - <property name="active">False</property> - <property name="inconsistent">False</property> - <property name="draw_indicator">True</property> - <signal name="toggled" handler="on_ledr_toggled"/> - </widget> - <packing> - <property name="x">96</property> - <property name="y">0</property> - </packing> - </child> - - <child> - <widget class="GtkButton" id="button3"> - <property name="width_request">72</property> - <property name="height_request">27</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="label" translatable="yes">Flash</property> - <property name="use_underline">True</property> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="focus_on_click">True</property> - <signal name="clicked" handler="on_flash_bt_clicked"/> - </widget> - <packing> - <property name="x">97</property> - <property name="y">30</property> - </packing> - </child> - </widget> - </child> - </widget> - </child> - - <child> - <widget class="GtkLabel" id="label5"> - <property name="visible">True</property> - <property name="label" translatable="yes"><b>LED's</b></property> - <property name="use_underline">False</property> - <property name="use_markup">True</property> - <property name="justify">GTK_JUSTIFY_FILL</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> - <property name="width_chars">-1</property> - <property name="single_line_mode">False</property> - <property name="angle">0</property> - </widget> - <packing> - <property name="type">label_item</property> - </packing> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">True</property> - <property name="fill">True</property> - </packing> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">True</property> - <property name="fill">True</property> - </packing> - </child> - - <child> - <widget class="GtkFrame" id="frame3"> - <property name="border_width">2</property> - <property name="visible">True</property> - <property name="label_xalign">0</property> - <property name="label_yalign">0.5</property> - <property name="shadow_type">GTK_SHADOW_OUT</property> - - <child> - <widget class="GtkAlignment" id="alignment3"> - <property name="visible">True</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xscale">1</property> - <property name="yscale">1</property> - <property name="top_padding">0</property> - <property name="bottom_padding">0</property> - <property name="left_padding">12</property> - <property name="right_padding">0</property> - - <child> - <widget class="GtkHBox" id="hbox3"> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">0</property> - - <child> - <widget class="GtkFixed" id="fixed3"> - <property name="visible">True</property> - - <child> - <widget class="GtkSpinButton" id="spinbutton2"> - <property name="width_request">56</property> - <property name="height_request">27</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="climb_rate">1</property> - <property name="digits">0</property> - <property name="numeric">False</property> - <property name="update_policy">GTK_UPDATE_ALWAYS</property> - <property name="snap_to_ticks">False</property> - <property name="wrap">False</property> - <property name="adjustment">1 0 255 1 10 10</property> - </widget> - <packing> - <property name="x">0</property> - <property name="y">56</property> - </packing> - </child> - - <child> - <widget class="GtkVSeparator" id="vseparator1"> - <property name="width_request">16</property> - <property name="height_request">88</property> - <property name="visible">True</property> - </widget> - <packing> - <property name="x">136</property> - <property name="y">0</property> - </packing> - </child> - - <child> - <widget class="GtkSpinButton" id="spinbutton3"> - <property name="width_request">56</property> - <property name="height_request">27</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="climb_rate">1</property> - <property name="digits">0</property> - <property name="numeric">False</property> - <property name="update_policy">GTK_UPDATE_ALWAYS</property> - <property name="snap_to_ticks">False</property> - <property name="wrap">False</property> - <property name="adjustment">1 0 255 1 10 10</property> - </widget> - <packing> - <property name="x">152</property> - <property name="y">56</property> - </packing> - </child> - - <child> - <widget class="GtkVSeparator" id="vseparator2"> - <property name="width_request">16</property> - <property name="height_request">88</property> - <property name="visible">True</property> - </widget> - <packing> - <property name="x">288</property> - <property name="y">0</property> - </packing> - </child> - - <child> - <widget class="GtkSpinButton" id="spinbutton4"> - <property name="width_request">56</property> - <property name="height_request">27</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="climb_rate">1</property> - <property name="digits">0</property> - <property name="numeric">False</property> - <property name="update_policy">GTK_UPDATE_ALWAYS</property> - <property name="snap_to_ticks">False</property> - <property name="wrap">False</property> - <property name="adjustment">1 0 255 1 10 10</property> - </widget> - <packing> - <property name="x">304</property> - <property name="y">56</property> - </packing> - </child> - - <child> - <widget class="GtkVSeparator" id="vseparator3"> - <property name="width_request">16</property> - <property name="height_request">88</property> - <property name="visible">True</property> - </widget> - <packing> - <property name="x">440</property> - <property name="y">0</property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label13"> - <property name="width_request">136</property> - <property name="height_request">17</property> - <property name="visible">True</property> - <property name="label" translatable="yes">Flippers</property> - <property name="use_underline">False</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> - <property name="width_chars">-1</property> - <property name="single_line_mode">False</property> - <property name="angle">0</property> - </widget> - <packing> - <property name="x">304</property> - <property name="y">0</property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label12"> - <property name="width_request">136</property> - <property name="height_request">17</property> - <property name="visible">True</property> - <property name="label" translatable="yes">Beak</property> - <property name="use_underline">False</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> - <property name="width_chars">-1</property> - <property name="single_line_mode">False</property> - <property name="angle">0</property> - </widget> - <packing> - <property name="x">152</property> - <property name="y">0</property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label11"> - <property name="width_request">136</property> - <property name="height_request">16</property> - <property name="visible">True</property> - <property name="label" translatable="yes">Eyes</property> - <property name="use_underline">False</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> - <property name="width_chars">-1</property> - <property name="single_line_mode">False</property> - <property name="angle">0</property> - </widget> - <packing> - <property name="x">0</property> - <property name="y">0</property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label14"> - <property name="width_request">136</property> - <property name="height_request">17</property> - <property name="visible">True</property> - <property name="label" translatable="yes">Rotation</property> - <property name="use_underline">False</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> - <property name="width_chars">-1</property> - <property name="single_line_mode">False</property> - <property name="angle">0</property> - </widget> - <packing> - <property name="x">456</property> - <property name="y">0</property> - </packing> - </child> - - <child> - <widget class="GtkSpinButton" id="spinbutton5"> - <property name="width_request">56</property> - <property name="height_request">27</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="climb_rate">1</property> - <property name="digits">0</property> - <property name="numeric">False</property> - <property name="update_policy">GTK_UPDATE_ALWAYS</property> - <property name="snap_to_ticks">False</property> - <property name="wrap">False</property> - <property name="adjustment">1 0 100 1 10 10</property> - </widget> - <packing> - <property name="x">456</property> - <property name="y">56</property> - </packing> - </child> - - <child> - <widget class="GtkRadioButton" id="radiobutton1"> - <property name="width_request">58</property> - <property name="height_request">24</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="label" translatable="yes">Open</property> - <property name="use_underline">True</property> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="focus_on_click">True</property> - <property name="active">False</property> - <property name="inconsistent">False</property> - <property name="draw_indicator">True</property> - <signal name="toggled" handler="on_eyes_open_toggled"/> - ... [truncated message content] |
From: neimad <c2m...@c2...> - 2007-05-11 14:58:31
|
Author: neimad Date: 2007-05-11 16:58:11 +0200 (Fri, 11 May 2007) New Revision: 313 Modified: daemon/trunk/libs/USBDaemon_usb_enum.c Log: * Coding style: removed unnecessary curly braces and parentheses, added blank lines to let the code breathe. Modified: daemon/trunk/libs/USBDaemon_usb_enum.c =================================================================== --- daemon/trunk/libs/USBDaemon_usb_enum.c 2007-05-11 14:54:04 UTC (rev 312) +++ daemon/trunk/libs/USBDaemon_usb_enum.c 2007-05-11 14:58:11 UTC (rev 313) @@ -56,16 +56,11 @@ usb_find_devices(); for (bus = usb_busses; bus; bus = bus->next) - { for (tux_dev = bus->devices; tux_dev; tux_dev = tux_dev->next) - { - if ((tux_dev->descriptor.idVendor == TUX_VID) - && (tux_dev->descriptor.idProduct == TUX_PID)) - { + if (tux_dev->descriptor.idVendor == TUX_VID + && tux_dev->descriptor.idProduct == TUX_PID) return tux_dev; - } - } - } + return NULL; } @@ -81,13 +76,16 @@ /* Open usb device */ tux_hdl = usb_open(tux_dev); + setgid(NEWGID); setuid(NEWUID); + if (!tux_hdl) { log_error("Can't open device: %s (%d)", strerror(errno), errno); return NULL; } + /* Claim device interface */ error = usb_claim_interface(tux_hdl, TUX_INTERFACE); if (error != 0) @@ -116,9 +114,8 @@ { tux_device = usb_find_TuxDroid(); if (tux_device == NULL) - { log_error("Tux dongle not found"); - } + sleep(1); } while (!tux_device); @@ -131,7 +128,7 @@ "the firmware to version 1.00 or better.\n" "Check http://www.tuxisalive.com/documentation/how-to/updating-the-firmware\n" "for details."); - return (0); + return 0; } /* Get Device handle */ @@ -139,9 +136,10 @@ if (tux_handle == NULL) { log_error("You must load the daemon in root mode"); - return (0); + return 0; } - return (1); + + return 1; } /************************************************************************ */ @@ -154,10 +152,13 @@ unsigned char dongle_is_present_counter; usleep(50000); + TUX_USB_STATUS = TUX_USB_CONNECTED; + /* Reinit audio channel */ send_usb_dongle_cmd(0x02, 0, 0, 0); current_audio_channel = 0; + /* Read loop */ dongle_is_present_counter = 0; while (tux_handle) @@ -172,6 +173,7 @@ send_daemon_disconnected(); exit(1); } + usb_get_status_TuxDroid(); usleep(50000); } |
From: neimad <c2m...@c2...> - 2007-05-11 14:54:06
|
Author: neimad Date: 2007-05-11 16:54:04 +0200 (Fri, 11 May 2007) New Revision: 312 Modified: daemon/trunk/libs/USBDaemon_usb_enum.c daemon/trunk/libs/USBDaemon_usb_enum.h Log: * Made functions usb_{find,open}_TuxDroid() static. Modified: daemon/trunk/libs/USBDaemon_usb_enum.c =================================================================== --- daemon/trunk/libs/USBDaemon_usb_enum.c 2007-05-11 13:41:39 UTC (rev 311) +++ daemon/trunk/libs/USBDaemon_usb_enum.c 2007-05-11 14:54:04 UTC (rev 312) @@ -46,7 +46,7 @@ /* usb_find_TuxDroid() */ /************************************************************************ */ -struct usb_device *usb_find_TuxDroid() +static struct usb_device *usb_find_TuxDroid() { struct usb_bus *bus; struct usb_device *tux_dev; @@ -74,7 +74,7 @@ /* usb_open_TuxDroid() */ /************************************************************************ */ -struct usb_dev_handle *usb_open_TuxDroid(struct usb_device *tux_dev) +static struct usb_dev_handle *usb_open_TuxDroid(struct usb_device *tux_dev) { usb_dev_handle *tux_hdl; int error; Modified: daemon/trunk/libs/USBDaemon_usb_enum.h =================================================================== --- daemon/trunk/libs/USBDaemon_usb_enum.h 2007-05-11 13:41:39 UTC (rev 311) +++ daemon/trunk/libs/USBDaemon_usb_enum.h 2007-05-11 14:54:04 UTC (rev 312) @@ -42,8 +42,6 @@ extern pthread_mutex_t usb_mutex; /*_____________________ F U N C T I O N S __________________________________*/ -extern struct usb_device *usb_find_TuxDroid(); -extern struct usb_dev_handle *usb_open_TuxDroid(struct usb_device *device); extern void *usb_start_task(void *unused); extern int usb_init_TuxDroid(void); |
From: neimad <c2m...@c2...> - 2007-05-11 13:42:13
|
Author: neimad Date: 2007-05-11 15:41:39 +0200 (Fri, 11 May 2007) New Revision: 311 Modified: software/alarm_clock/tags/0.0.1/tdac.py software/alarm_clock/tags/0.0.2/tdac.py software/alarm_clock/tags/0.0.3/tdac.py software/alarm_clock/tags/0.0.4/tdac.py software/alarm_clock/trunk/tdac.py software/email_alert/tags/0.0.1/tdema.py software/email_alert/tags/0.0.2/tdema.py software/email_alert/tags/0.0.3/tdema.py software/email_alert/tags/0.0.4/tdema.py software/email_alert/trunk/tdema.py software/gtdi/tags/0.0.1/gtdi.py software/gtdi/tags/0.0.2/gtdi.py software/gtdi/tags/0.1.0/gtdi.py software/gtdi/tags/0.2.0/gtdi.py software/gtdi/tags/0.2.1/gtdi.py software/gtdi/trunk/gtdi.py Log: * Fixed Emacs coding tag: replaced invalid "UTF8" with "utf-8". Modified: software/alarm_clock/tags/0.0.1/tdac.py =================================================================== --- software/alarm_clock/tags/0.0.1/tdac.py 2007-05-11 09:04:35 UTC (rev 310) +++ software/alarm_clock/tags/0.0.1/tdac.py 2007-05-11 13:41:39 UTC (rev 311) @@ -1,5 +1,5 @@ #!/usr/bin/env python -# -*- coding: UTF8 -*- +# -*- coding: utf-8 -*- # -------------------------------------------------------------------- # Tux Droid - Alarm Clock Modified: software/alarm_clock/tags/0.0.2/tdac.py =================================================================== --- software/alarm_clock/tags/0.0.2/tdac.py 2007-05-11 09:04:35 UTC (rev 310) +++ software/alarm_clock/tags/0.0.2/tdac.py 2007-05-11 13:41:39 UTC (rev 311) @@ -1,5 +1,5 @@ #!/usr/bin/env python -# -*- coding: UTF8 -*- +# -*- coding: utf-8 -*- # -------------------------------------------------------------------- # Tux Droid - Alarm Clock Modified: software/alarm_clock/tags/0.0.3/tdac.py =================================================================== --- software/alarm_clock/tags/0.0.3/tdac.py 2007-05-11 09:04:35 UTC (rev 310) +++ software/alarm_clock/tags/0.0.3/tdac.py 2007-05-11 13:41:39 UTC (rev 311) @@ -1,5 +1,5 @@ #!/usr/bin/env python -# -*- coding: UTF8 -*- +# -*- coding: utf-8 -*- # -------------------------------------------------------------------- # Tux Droid - Alarm Clock Modified: software/alarm_clock/tags/0.0.4/tdac.py =================================================================== --- software/alarm_clock/tags/0.0.4/tdac.py 2007-05-11 09:04:35 UTC (rev 310) +++ software/alarm_clock/tags/0.0.4/tdac.py 2007-05-11 13:41:39 UTC (rev 311) @@ -1,5 +1,5 @@ #!/usr/bin/env python -# -*- coding: UTF8 -*- +# -*- coding: utf-8 -*- # -------------------------------------------------------------------- # Tux Droid - Alarm Clock Modified: software/alarm_clock/trunk/tdac.py =================================================================== --- software/alarm_clock/trunk/tdac.py 2007-05-11 09:04:35 UTC (rev 310) +++ software/alarm_clock/trunk/tdac.py 2007-05-11 13:41:39 UTC (rev 311) @@ -1,5 +1,5 @@ #!/usr/bin/env python -# -*- coding: UTF8 -*- +# -*- coding: utf-8 -*- # -------------------------------------------------------------------- # Tux Droid - Alarm Clock Modified: software/email_alert/tags/0.0.1/tdema.py =================================================================== --- software/email_alert/tags/0.0.1/tdema.py 2007-05-11 09:04:35 UTC (rev 310) +++ software/email_alert/tags/0.0.1/tdema.py 2007-05-11 13:41:39 UTC (rev 311) @@ -1,5 +1,5 @@ #!/usr/bin/env python -# -*- coding: UTF8 -*- +# -*- coding: utf-8 -*- # -------------------------------------------------------------------- # Tux Droid - E-Mail Alert Modified: software/email_alert/tags/0.0.2/tdema.py =================================================================== --- software/email_alert/tags/0.0.2/tdema.py 2007-05-11 09:04:35 UTC (rev 310) +++ software/email_alert/tags/0.0.2/tdema.py 2007-05-11 13:41:39 UTC (rev 311) @@ -1,5 +1,5 @@ #!/usr/bin/env python -# -*- coding: UTF8 -*- +# -*- coding: utf-8 -*- # -------------------------------------------------------------------- # Tux Droid - E-Mail Alert Modified: software/email_alert/tags/0.0.3/tdema.py =================================================================== --- software/email_alert/tags/0.0.3/tdema.py 2007-05-11 09:04:35 UTC (rev 310) +++ software/email_alert/tags/0.0.3/tdema.py 2007-05-11 13:41:39 UTC (rev 311) @@ -1,5 +1,5 @@ #!/usr/bin/env python -# -*- coding: UTF8 -*- +# -*- coding: utf-8 -*- # -------------------------------------------------------------------- # Tux Droid - E-Mail Alert Modified: software/email_alert/tags/0.0.4/tdema.py =================================================================== --- software/email_alert/tags/0.0.4/tdema.py 2007-05-11 09:04:35 UTC (rev 310) +++ software/email_alert/tags/0.0.4/tdema.py 2007-05-11 13:41:39 UTC (rev 311) @@ -1,5 +1,5 @@ #!/usr/bin/env python -# -*- coding: UTF8 -*- +# -*- coding: utf-8 -*- # -------------------------------------------------------------------- # Tux Droid - E-Mail Alert Modified: software/email_alert/trunk/tdema.py =================================================================== --- software/email_alert/trunk/tdema.py 2007-05-11 09:04:35 UTC (rev 310) +++ software/email_alert/trunk/tdema.py 2007-05-11 13:41:39 UTC (rev 311) @@ -1,5 +1,5 @@ #!/usr/bin/env python -# -*- coding: UTF8 -*- +# -*- coding: utf-8 -*- # -------------------------------------------------------------------- # Tux Droid - E-Mail Alert Modified: software/gtdi/tags/0.0.1/gtdi.py =================================================================== --- software/gtdi/tags/0.0.1/gtdi.py 2007-05-11 09:04:35 UTC (rev 310) +++ software/gtdi/tags/0.0.1/gtdi.py 2007-05-11 13:41:39 UTC (rev 311) @@ -1,5 +1,5 @@ #!/usr/bin/env python -# -*- coding: UTF8 -*- +# -*- coding: utf-8 -*- # -------------------------------------------------------------------- # Tux Droid - Graphique Interface Modified: software/gtdi/tags/0.0.2/gtdi.py =================================================================== --- software/gtdi/tags/0.0.2/gtdi.py 2007-05-11 09:04:35 UTC (rev 310) +++ software/gtdi/tags/0.0.2/gtdi.py 2007-05-11 13:41:39 UTC (rev 311) @@ -1,5 +1,5 @@ #!/usr/bin/env python -# -*- coding: UTF8 -*- +# -*- coding: utf-8 -*- # -------------------------------------------------------------------- # Tux Droid - Graphique Interface Modified: software/gtdi/tags/0.1.0/gtdi.py =================================================================== --- software/gtdi/tags/0.1.0/gtdi.py 2007-05-11 09:04:35 UTC (rev 310) +++ software/gtdi/tags/0.1.0/gtdi.py 2007-05-11 13:41:39 UTC (rev 311) @@ -1,5 +1,5 @@ #!/usr/bin/env python -# -*- coding: UTF8 -*- +# -*- coding: utf-8 -*- # ----------------------------------------------------------------------------- # Tux Droid - Graphique Interface Modified: software/gtdi/tags/0.2.0/gtdi.py =================================================================== --- software/gtdi/tags/0.2.0/gtdi.py 2007-05-11 09:04:35 UTC (rev 310) +++ software/gtdi/tags/0.2.0/gtdi.py 2007-05-11 13:41:39 UTC (rev 311) @@ -1,5 +1,5 @@ #!/usr/bin/env python -# -*- coding: UTF8 -*- +# -*- coding: utf-8 -*- # ----------------------------------------------------------------------------- # Tux Droid - Graphique Interface Modified: software/gtdi/tags/0.2.1/gtdi.py =================================================================== --- software/gtdi/tags/0.2.1/gtdi.py 2007-05-11 09:04:35 UTC (rev 310) +++ software/gtdi/tags/0.2.1/gtdi.py 2007-05-11 13:41:39 UTC (rev 311) @@ -1,5 +1,5 @@ #!/usr/bin/env python -# -*- coding: UTF8 -*- +# -*- coding: utf-8 -*- # ----------------------------------------------------------------------------- # Tux Droid - Graphique Interface Modified: software/gtdi/trunk/gtdi.py =================================================================== --- software/gtdi/trunk/gtdi.py 2007-05-11 09:04:35 UTC (rev 310) +++ software/gtdi/trunk/gtdi.py 2007-05-11 13:41:39 UTC (rev 311) @@ -1,5 +1,5 @@ #!/usr/bin/env python -# -*- coding: UTF8 -*- +# -*- coding: utf-8 -*- # ----------------------------------------------------------------------------- # Tux Droid - Graphique Interface |
From: neimad <c2m...@c2...> - 2007-05-11 09:04:38
|
Author: neimad Date: 2007-05-11 11:04:35 +0200 (Fri, 11 May 2007) New Revision: 310 Modified: software/gtdi/trunk/gtdi.py Log: * Added XFCE's "Terminal" to the list of terminals checked for at start. Modified: software/gtdi/trunk/gtdi.py =================================================================== --- software/gtdi/trunk/gtdi.py 2007-05-10 16:44:53 UTC (rev 309) +++ software/gtdi/trunk/gtdi.py 2007-05-11 09:04:35 UTC (rev 310) @@ -57,7 +57,7 @@ status_list_changed=False toggled_by_event=False -for term in ["gnome-terminal","konsole","xterm"]: +for term in ["gnome-terminal", "konsole", "Terminal", "xterm"]: if not os.popen('type %s'%term).close(): terminal_app=term break |
From: jaguarondi <c2m...@c2...> - 2007-05-10 16:44:54
|
Author: jaguarondi Date: 2007-05-10 18:44:53 +0200 (Thu, 10 May 2007) New Revision: 309 Modified: firmware/tuxaudio/trunk/main.c Log: - BUG: SLEEP_ACK_CMD was not set correctly. Modified: firmware/tuxaudio/trunk/main.c =================================================================== --- firmware/tuxaudio/trunk/main.c 2007-05-10 16:41:08 UTC (rev 308) +++ firmware/tuxaudio/trunk/main.c 2007-05-10 16:44:53 UTC (rev 309) @@ -137,9 +137,9 @@ else if (audioBuf[0] == SLEEP_CMD) { sleep_flg = 1; /* handle sleep in its own function */ - audioBuf[0] |= SLEEP_ACK_CMD; /* go to sleep mode and acknowledge it */ - audioBuf[2] |= SLEEP_ACK_MK; /* go to sleep mode and acknowledge it */ /* Forwards the command to the rf CPU */ + audioBuf[0] = SLEEP_ACK_CMD; /* go to sleep mode and acknowledge it */ + audioBuf[2] |= SLEEP_ACK_MK; cli(); i2cSlaveReceiveService(4, audioBuf); sei(); |
From: jaguarondi <c2m...@c2...> - 2007-05-10 16:41:09
|
Author: jaguarondi Date: 2007-05-10 18:41:08 +0200 (Thu, 10 May 2007) New Revision: 308 Modified: daemon/trunk/libs/USBDaemon_globals.h daemon/trunk/main.c Log: - UPD: renamed on_close_daemon into quit_handler - CHG: libusb debuglevel set at 0 as those messages are annoying and not necessary when not debugging the USB anyway. Modified: daemon/trunk/libs/USBDaemon_globals.h =================================================================== --- daemon/trunk/libs/USBDaemon_globals.h 2007-05-10 16:37:21 UTC (rev 307) +++ daemon/trunk/libs/USBDaemon_globals.h 2007-05-10 16:41:08 UTC (rev 308) @@ -42,7 +42,7 @@ #define TUX_READ_EP 0x84 #define TUX_WRITE_TIMEOUT 5000 #define TUX_READ_TIMEOUT 5000 -#define LIBUSB_DEBUG_LEVEL 1 +#define LIBUSB_DEBUG_LEVEL 0 #define NEWUID 65534 #define NEWGID 65534 Modified: daemon/trunk/main.c =================================================================== --- daemon/trunk/main.c 2007-05-10 16:37:21 UTC (rev 307) +++ daemon/trunk/main.c 2007-05-10 16:41:08 UTC (rev 308) @@ -125,6 +125,11 @@ /** * \brief Called when exiting. Performs cleanup. + * + * This function is registered with atexit() to be called whenever we quit the + * daemon normally with exit(). + * + * It disconnects all TCP/IP clients before exiting. */ static void terminate(void) { @@ -138,6 +143,18 @@ } /** + * \brief Performs a clean exit of the daemon. + * + * \param[in] sig Signal (unused) + * + * Used to catch signals to exit properly. + */ +static void quit_handler(int sig) +{ + exit(0); +} + +/** * \brief Toggle debugging mode on/off. * * \param[in] sig Signal (unused) @@ -231,16 +248,6 @@ /************************************************************************ */ -/* On_close_daemon */ - -/************************************************************************ */ -static void on_close_daemon(int sig) -{ - exit(0); -} - -/************************************************************************ */ - /* Show usages of tux daemon */ /************************************************************************ */ @@ -277,7 +284,7 @@ unsigned char daemonized = 0; /* On exiting */ - signal(SIGINT, on_close_daemon); + signal(SIGINT, quit_handler); /* Program arguments */ for (i = 1; i < argc; i++) |