[tuxdroid-svn] r5330 - in software_suite_v2/tuxware/tuxdriver/trunk: src unix win32
Status: Beta
Brought to you by:
ks156
|
From: remi <c2m...@c2...> - 2009-09-04 11:18:25
|
Author: remi
Date: 2009-09-04 13:18:09 +0200 (Fri, 04 Sep 2009)
New Revision: 5330
Removed:
software_suite_v2/tuxware/tuxdriver/trunk/src/tux_wifi_avoid.c
software_suite_v2/tuxware/tuxdriver/trunk/src/tux_wifi_avoid.h
Modified:
software_suite_v2/tuxware/tuxdriver/trunk/src/tux_cmd_parser.c
software_suite_v2/tuxware/tuxdriver/trunk/src/tux_descriptor.c
software_suite_v2/tuxware/tuxdriver/trunk/src/tux_driver.c
software_suite_v2/tuxware/tuxdriver/trunk/src/tux_types.h
software_suite_v2/tuxware/tuxdriver/trunk/src/version.h
software_suite_v2/tuxware/tuxdriver/trunk/unix/Makefile
software_suite_v2/tuxware/tuxdriver/trunk/win32/Makefile
Log:
* Removed wifi avoidance functions
* Automatic Wake up of Tux Droid on dongle plug and radio connection On.
* Updated makefiles
* Updated version
Modified: software_suite_v2/tuxware/tuxdriver/trunk/src/tux_cmd_parser.c
===================================================================
--- software_suite_v2/tuxware/tuxdriver/trunk/src/tux_cmd_parser.c 2009-09-04 11:14:05 UTC (rev 5329)
+++ software_suite_v2/tuxware/tuxdriver/trunk/src/tux_cmd_parser.c 2009-09-04 11:18:09 UTC (rev 5330)
@@ -47,7 +47,6 @@
#include "tux_usb.h"
#include "tux_user_inputs.h"
#include "tux_flippers.h"
-#include "tux_wifi_avoid.h"
#define NRCMDS 512
@@ -644,29 +643,6 @@
}
/**
- * \brief Parse a WiFi avoidance command [Level 2]
- * \param tokens Command tokens.
- * \param cmd Cmd structure.
- * \return The error result.
- */
-static TuxDrvError
-parse_tux_wifi_command(tokens_t tokens, delay_cmd_t *cmd)
-{
- TuxDrvError ret = E_TUXDRV_INVALIDCOMMAND;
-
- if (strcmp(tokens[2], "AVOID_CHANNEL") == 0)
- {
- cmd->sub_command = AVOID_CHANNEL;
- if (str_to_uint8(tokens[3],
- &cmd->wifi_avoid_channel_parameters.channel))
- {
- ret = E_TUXDRV_NOERROR;
- }
- }
- return ret;
-}
-
-/**
* \brief Parse a Tux command [Level 1]
* \param tokens Command tokens.
* \param cmd Cmd structure.
@@ -717,11 +693,6 @@
cmd->command = FLIPPERS;
ret = parse_tux_flippers_command(tokens, cmd);
}
- else if (strcmp(tokens[1], "WIFI") == 0)
- {
- cmd->command = WIFI;
- ret = parse_tux_wifi_command(tokens, cmd);
- }
return ret;
}
@@ -1042,23 +1013,6 @@
}
/**
- * \brief Execute a WiFi avoidance command.
- * \param cmd Command to execute.
- */
-static void
-execute_wifi_command (delay_cmd_t *cmd)
-{
- switch (cmd->sub_command) {
- case AVOID_CHANNEL:
- tux_wifi_avoid_channel(
- cmd->wifi_avoid_channel_parameters.channel);
- break;
- default: /* should not occur */
- log_error("execute invalid flippers command");
- }
-}
-
-/**
* \brief Execute a RAW command.
* \param cmd Command to execute.
*/
@@ -1102,9 +1056,6 @@
case FLIPPERS:
execute_flippers_command(cmd);
break;
- case WIFI:
- execute_wifi_command(cmd);
- break;
}
}
else
Modified: software_suite_v2/tuxware/tuxdriver/trunk/src/tux_descriptor.c
===================================================================
--- software_suite_v2/tuxware/tuxdriver/trunk/src/tux_descriptor.c 2009-09-04 11:14:05 UTC (rev 5329)
+++ software_suite_v2/tuxware/tuxdriver/trunk/src/tux_descriptor.c 2009-09-04 11:18:09 UTC (rev 5330)
@@ -65,7 +65,7 @@
{
char descriptor[4096];
char *p; /* points to the end of the string */
- FILE *desc_file;
+ /* FILE *desc_file; */
p = descriptor;
strcpy(p, "Tux droid descriptor\n--------------------\n\n");
Modified: software_suite_v2/tuxware/tuxdriver/trunk/src/tux_driver.c
===================================================================
--- software_suite_v2/tuxware/tuxdriver/trunk/src/tux_driver.c 2009-09-04 11:14:05 UTC (rev 5329)
+++ software_suite_v2/tuxware/tuxdriver/trunk/src/tux_driver.c 2009-09-04 11:18:09 UTC (rev 5330)
@@ -40,7 +40,7 @@
#include "tux_spinning.h"
#include "tux_usb.h"
#include "tux_flippers.h"
-#include "tux_wifi_avoid.h"
+#include "tux_types.h"
#include "version.h"
static bool driver_started = false;
@@ -226,8 +226,6 @@
tux_user_inputs_init();
/* Reset the body state */
TuxDrv_ResetPositions();
- /* Wifi avoidance */
- tux_wifi_auto_avoidance("");
}
}
@@ -237,14 +235,16 @@
static void
on_usb_connect(void)
{
+ data_frame wakeup_frame = {0xB6, 0xFF, 0x01, 0x00};
+
tux_descriptor_init();
tux_hw_status_init();
tux_sw_status_init();
tux_user_inputs_init();
tux_cmd_parser_init();
- /* Wifi avoidance */
- tux_wifi_auto_avoidance("");
tux_sw_status_set_intvalue(SW_ID_DONGLE_PLUG, true, true);
+ /* Waking up Tux Droid */
+ tux_usb_send_to_tux(wakeup_frame);
if (dongle_connected_funct)
{
dongle_connected_funct();
Modified: software_suite_v2/tuxware/tuxdriver/trunk/src/tux_types.h
===================================================================
--- software_suite_v2/tuxware/tuxdriver/trunk/src/tux_types.h 2009-09-04 11:14:05 UTC (rev 5329)
+++ software_suite_v2/tuxware/tuxdriver/trunk/src/tux_types.h 2009-09-04 11:18:09 UTC (rev 5330)
@@ -46,8 +46,7 @@
MOUTH,
SOUND_FLASH,
SPINNING,
- FLIPPERS,
- WIFI
+ FLIPPERS
} tux_command_t;
/* subcommands */
@@ -71,8 +70,7 @@
SEND,
SET,
SPEED,
- UP,
- AVOID_CHANNEL
+ UP
} tux_sub_command_t;
/*
Deleted: software_suite_v2/tuxware/tuxdriver/trunk/src/tux_wifi_avoid.c
===================================================================
--- software_suite_v2/tuxware/tuxdriver/trunk/src/tux_wifi_avoid.c 2009-09-04 11:14:05 UTC (rev 5329)
+++ software_suite_v2/tuxware/tuxdriver/trunk/src/tux_wifi_avoid.c 2009-09-04 11:18:09 UTC (rev 5330)
@@ -1,120 +0,0 @@
-/*
- * Tux Droid - WIFI avoidance
- * Copyright (C) 2008 C2ME Sa <Acness : 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.
- */
-
-#include <string.h>
-#include <stdio.h>
-
-#include "tux_hw_cmd.h"
-#include "tux_misc.h"
-#include "tux_types.h"
-#include "tux_usb.h"
-
-/**
- * \brief Configure the RF module to avoid a given wifi channel.
- *
- * This sets the frequencies to avoid in the dongle. These settings only take
- * effect when a connection is initiated with a tux. This function should
- * be called before conneting to a tux or you have to disconnect and reconnect
- * to change it on the go.
- *
- * Channels from 1 to 14 are valid wifi channels. Set the wifi channel to 0 to
- * disable channel avoidance and use the complete range of frequencies.
- *
- * \param wifi_channel Channel to avoid.
- * \return true if successful, false otherwise.
- */
-LIBLOCAL bool
-tux_wifi_avoid_channel(unsigned char wifi_channel)
-{
- /*
- * Conversion of the lower and higher frequencies of a wifi channel into
- * ATR2406 channel numbers.
- * Channels can be from 1 to 14. The channel bandwidth is 22MHz (11MHz from
- * center frequency) and we take an extra margin of 11MHz away from min and
- * max frequencies.
- * Channel 0 disables the function.
- *
- * According to ATR2406 datasheet, p.10, ATR channel 0 (C0) is 2401.056MHz
- * and channels are distant from 0.864MHz.
- * C0 2401.056
- * C1 2401.920
- * ..
- * C93 2481.408
- * C94 2482.272
- *
- * Wifi channels are:
- * W1 2412
- * W2 2417
- * W3 2422
- * W4 2427
- * W5 2432
- * W6 2437
- * W7 2442
- * W8 2447
- * W9 2452
- * W10 2457
- * W11 2462
- * W12 2467
- * W13 2472
- * W14 2484
- *
- * We can now get the following table.
- */
- static const unsigned char lower_ATR_channel[15] =
- {0, 0, 0, 0, 0, 0, 6, 12, 18, 24, 29, 35, 41, 47, 60};
- /* The ATR has only 94 channels so limit there */
- static const unsigned char higher_ATR_channel[15] =
- {1, 28, 34, 40, 46, 51, 57, 63, 69, 75, 80, 86, 92, 94, 94};
-
- if ((wifi_channel >= 15) || (wifi_channel < 1))
- {
- return false;
- }
-
- data_frame frame = { WIRELESS_FREQ_BOUNDARIES_CMD,
- lower_ATR_channel[wifi_channel],
- higher_ATR_channel[wifi_channel], 0};
-
- return tux_usb_send_to_tux(frame);
-}
-
-/**
- * \brief Load the "tux_wifi_channel" to retrieve the current used wifi
- * channel to avoid it in the Tuxdroid radio connexion.
- * \param prior_SSID To avoiding a specifique wifi network channel.
- */
-LIBLOCAL void
-tux_wifi_auto_avoidance(const char *prior_SSID)
-{
- char cmd[256];
- int ret = -1;
-
- sprintf(cmd, "tux_wifi_channel %s", (char *)prior_SSID);
- ret = system(cmd);
-
- /* If no wifi network found or "tux_wifi_channel" not present then
- * avoid the channel number 6 */
- if (ret <= 0)
- {
- ret = 6;
- }
-
- tux_wifi_avoid_channel((unsigned char)ret);
-}
Deleted: software_suite_v2/tuxware/tuxdriver/trunk/src/tux_wifi_avoid.h
===================================================================
--- software_suite_v2/tuxware/tuxdriver/trunk/src/tux_wifi_avoid.h 2009-09-04 11:14:05 UTC (rev 5329)
+++ software_suite_v2/tuxware/tuxdriver/trunk/src/tux_wifi_avoid.h 2009-09-04 11:18:09 UTC (rev 5330)
@@ -1,27 +0,0 @@
-/*
- * Tux Droid - WIFI avoidance
- * Copyright (C) 2008 C2ME Sa <Acness : 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.
- */
-
-#ifndef _TUX_WIFI_AVOID_H_
-#define _TUX_WIFI_AVOID_H_
-
-extern bool tux_wifi_avoid_channel(unsigned char wifi_channel);
-extern void tux_wifi_auto_avoidance(const char *prior_SSID);
-
-#endif /* _TUX_WIFI_AVOID_H_ */
Modified: software_suite_v2/tuxware/tuxdriver/trunk/src/version.h
===================================================================
--- software_suite_v2/tuxware/tuxdriver/trunk/src/version.h 2009-09-04 11:14:05 UTC (rev 5329)
+++ software_suite_v2/tuxware/tuxdriver/trunk/src/version.h 2009-09-04 11:18:09 UTC (rev 5330)
@@ -26,7 +26,7 @@
#define VER_MAJOR 0
#define VER_MINOR 0
-#define VER_UPDATE 4
+#define VER_UPDATE 5
#define VER_REVISION SVN_REV
#define VER_DATE SVN_REVDATE
#define VER_STATE " "
Modified: software_suite_v2/tuxware/tuxdriver/trunk/unix/Makefile
===================================================================
--- software_suite_v2/tuxware/tuxdriver/trunk/unix/Makefile 2009-09-04 11:14:05 UTC (rev 5329)
+++ software_suite_v2/tuxware/tuxdriver/trunk/unix/Makefile 2009-09-04 11:18:09 UTC (rev 5330)
@@ -38,7 +38,6 @@
$(OBJ_DIR)/tux_usb.o \
$(OBJ_DIR)/tux_user_inputs.o \
$(OBJ_DIR)/tux_flippers.o \
- $(OBJ_DIR)/tux_wifi_avoid.o \
$(OBJ_DIR)/log.o
.PHONY: make clean
@@ -70,7 +69,6 @@
$(CC) -c $(CFLAGS) $(SRC_DIR)/tux_usb.c $(C_INCLUDE_DIRS) -o $(OBJ_DIR)/tux_usb.o
$(CC) -c $(CFLAGS) $(SRC_DIR)/tux_user_inputs.c $(C_INCLUDE_DIRS) -o $(OBJ_DIR)/tux_user_inputs.o
$(CC) -c $(CFLAGS) $(SRC_DIR)/tux_flippers.c $(C_INCLUDE_DIRS) -o $(OBJ_DIR)/tux_flippers.o
- $(CC) -c $(CFLAGS) $(SRC_DIR)/tux_wifi_avoid.c $(C_INCLUDE_DIRS) -o $(OBJ_DIR)/tux_wifi_avoid.o
$(CC) -c $(CFLAGS) $(SRC_DIR)/log.c $(C_INCLUDE_DIRS) -o $(OBJ_DIR)/log.o
$(CC) -o "$(OUTPUT_DIR)$(TARGET)" $(SRC_OBJS) $(LIB_DIRS) $(LIBS) $(LDFLAGS)
-@ar rcs $(OUTPUT_DIR)/libtuxdriver.a $(SRC_OBJS)
Modified: software_suite_v2/tuxware/tuxdriver/trunk/win32/Makefile
===================================================================
--- software_suite_v2/tuxware/tuxdriver/trunk/win32/Makefile 2009-09-04 11:14:05 UTC (rev 5329)
+++ software_suite_v2/tuxware/tuxdriver/trunk/win32/Makefile 2009-09-04 11:18:09 UTC (rev 5330)
@@ -43,7 +43,6 @@
$(OBJ_DIR)/tux_usb.o \
$(OBJ_DIR)/tux_user_inputs.o \
$(OBJ_DIR)/tux_flippers.o \
- $(OBJ_DIR)/tux_wifi_avoid.o \
$(OBJ_DIR)/log.o
.PHONY: make clean
@@ -75,7 +74,6 @@
$(CC) -c $(CFLAGS) $(SRC_DIR)/tux_usb.c $(C_INCLUDE_DIRS) -o $(OBJ_DIR)/tux_usb.o
$(CC) -c $(CFLAGS) $(SRC_DIR)/tux_user_inputs.c $(C_INCLUDE_DIRS) -o $(OBJ_DIR)/tux_user_inputs.o
$(CC) -c $(CFLAGS) $(SRC_DIR)/tux_flippers.c $(C_INCLUDE_DIRS) -o $(OBJ_DIR)/tux_flippers.o
- $(CC) -c $(CFLAGS) $(SRC_DIR)/tux_wifi_avoid.c $(C_INCLUDE_DIRS) -o $(OBJ_DIR)/tux_wifi_avoid.o
$(CC) -c $(CFLAGS) $(SRC_DIR)/log.c $(C_INCLUDE_DIRS) -o $(OBJ_DIR)/log.o
$(CC) -o "$(OUTPUT_DIR)\$(TARGET)" $(SRC_OBJS) $(LIB_DIRS) $(LIBS) $(LDFLAGS)
-@rm -fR $(OBJ_DIR)/*.o
|