Author: Paul_R
Date: 2008-09-17 15:14:25 +0200 (Wed, 17 Sep 2008)
New Revision: 1874

Removed:
   firmware/tuxup/trunk/tux_hid_win32.c
   firmware/tuxup/trunk/tux_hid_win32.h
   firmware/tuxup/trunk/tux_misc.c
   firmware/tuxup/trunk/tux_misc.h
Modified:
   firmware/tuxup/trunk/Makefile
   firmware/tuxup/trunk/bootloader.c
   firmware/tuxup/trunk/bootloader.h
   firmware/tuxup/trunk/main.c
   firmware/tuxup/trunk/tux_hid_unix.c
   firmware/tuxup/trunk/tux_hid_unix.h
Log:
* Removed the compatibility with Windows.


Modified: firmware/tuxup/trunk/Makefile
===================================================================
--- firmware/tuxup/trunk/Makefile       2008-09-17 13:03:17 UTC (rev 1873)
+++ firmware/tuxup/trunk/Makefile       2008-09-17 13:14:25 UTC (rev 1874)
@@ -3,78 +3,34 @@
 #####################################################
 
 ## General Flags
-ifdef windir
-       CC = "gcc.exe"
-       DEFS = -DWIN32
-       C_INCLUDE_DIRS = -I"C:\bin\MinGWStudio\MinGW\include\ddk"
-       CFLAGS = -pipe -Wall -funsigned-char -g2 -O0
-       LIBS = -lwinmm -lhid -lsetupapi -lhidparse 
-else
-       CC = gcc
-       DEFS = 
-       CFLAGS = -g -Wall $(DEFS)
-       LIBS = -lusb
-endif
+CC = gcc
+DEFS = 
+CFLAGS = -g -Wall $(DEFS)
+LIBS = -lusb
 TARGET = tuxup
+FILES=main.c \
+      bootloader.c \
+      bootloader.h \
+      usb-connection.c \
+      usb-connection.h \
+      tux_hid_unix.c \
+      tux_hid_unix.h \
+      tux-api.h \
+      version.h \
+      common/commands.h \
+      log.c \
+      log.h
+OBJECTS=main.c \
+       bootloader.c \
+       usb-connection.c \
+       tux_hid_unix.c \
+       log.c
 
-## Libraries
 
-## Objects that must be built in order to link
-FILES = main.c usb-connection.c bootloader.c tux_hid_win32.c tux_misc.c log.c
 
-## Compile and link
-ifdef windir
-       SRC_OBJS = main.o bootloader.o tux_hid_win32.o tux_misc.o
-
-define build_target
[EMAIL PROTECTED] Linking...
[EMAIL PROTECTED](CC) -o "$(TARGET)" $(SRC_OBJS) $(LIB_DIRS) $(LIBS) $(LDFLAGS)
-endef
-
-define compile_source
[EMAIL PROTECTED] Compiling $<
[EMAIL PROTECTED](CC) $(CFLAGS) $(C_PREPROC) $(C_INCLUDE_DIRS) -c "$<" -o "$@"
-endef
-
-.PHONY: print_header
-$(TARGET): print_header $(SRC_OBJS)
-       $(build_target)
-       
-print_header:
-       @echo Start compiling
-
-main.o: main.c \
-tux-api.h \
-bootloader.h \
-version.h \
-tux_misc.h \
-error.h \
-tux_hid_win32.h
-       $(compile_source)
-
-bootloader.o: bootloader.c \
-tux_misc.h \
-tux_hid_win32.h \
-error.h \
-tux-api.h
-       $(compile_source)
-
-tux_hid_win32.o: tux_hid_win32.c \
-tux_hid_win32.h        \
-tux_misc.h
-       $(compile_source)
-
-tux_misc.o: tux_misc.c \
-tux_misc.h
-       $(compile_source)
- 
-else
 all: $(TARGET)
-tuxup: main.c bootloader.c bootloader.h usb-connection.c usb-connection.h \
-    tux_hid_unix.c tux_hid_unix.h tux_misc.c tux_misc.h tux-api.h version.h \
-    common/commands.h log.c log.h
-       ${CC} ${LIBS} ${CFLAGS} ${C_INCLUDE_DIRS} ${DEFS} -o tuxup \
-           main.c bootloader.c usb-connection.c tux_hid_unix.c tux_misc.c log.c
-endif
+tuxup: $(FILES) 
+       ${CC} ${LIBS} ${CFLAGS} ${C_INCLUDE_DIRS} ${DEFS} -o tuxup ${OBJECTS} 
+           
 clean :
        -rm -f $(TARGET) *.o

Modified: firmware/tuxup/trunk/bootloader.c
===================================================================
--- firmware/tuxup/trunk/bootloader.c   2008-09-17 13:03:17 UTC (rev 1873)
+++ firmware/tuxup/trunk/bootloader.c   2008-09-17 13:14:25 UTC (rev 1874)
@@ -32,14 +32,8 @@
 #include <stdlib.h>
 #include <time.h>
 #include <string.h>
-#ifdef WIN32
-#   include "tux_misc.h"
-#   include "tux_hid_win32.h"
-#   include <windows.h>
-#else
-#   include "usb-connection.h"
-#   include "tux_hid_unix.h"
-#endif
+#include "usb-connection.h"
+#include "tux_hid_unix.h"
 #include "tux-api.h"
 #include "error.h"
 #include "log.h"
@@ -68,9 +62,7 @@
 #define BOOT_FILLPAGE 2
 #define BOOT_EXIT 3
 
-#ifndef WIN32
 static bool wait_status(unsigned char value, int timeout);
-#endif
 static void compute_progress_bar(const char *filename);
 typedef uint32_t FILE_Addr_t;
 typedef uint32_t FILE_SegmentLen_t;
@@ -101,9 +93,7 @@
     FILE_Addr_t currAddr;       /* Current address in memory being processed */
     uint8_t *segmentData;       /* Complete segment data */
     int segmentDataIdx;         /* Index used for filling in the segment data 
*/
-#ifndef WIN32
     usb_dev_handle *dev_handle; /* USB device handle for sending parsed data */
-#endif
 } Parser_t;
 
 /**
@@ -319,12 +309,10 @@
     {
         ret = tux_hid_write(36, data_buffer);
     }
-#ifndef WIN32
     else
     {
         ret = usb_send_commands(parser->dev_handle, data_buffer, 36);
     }
-#endif
 #if (PRINT_DATA)
     printf("Status of the first packet sent: %d\n", ret);
 #endif
@@ -349,12 +337,10 @@
     {
         ret = tux_hid_write(34, data_buffer);
     }
-#ifndef WIN32
     else
     {
         ret = usb_send_commands(parser->dev_handle, data_buffer, 34);
     }
-#endif
 #if (PRINT_DATA)
     printf("Status of the second packet sent: %d\n", ret);
 #endif
@@ -376,21 +362,14 @@
      */
     if (HID)
     {
-#ifdef WIN32
-        ret = tux_hid_read(5, data_buffer);
-        counter ++;
-#else
         ret = (wait_status(++counter, USB_TIMEOUT));
         ret = tux_hid_read(5, data_buffer);
-#endif
     }
-#ifndef WIN32
     else
     {
         ret = usb_get_commands(parser->dev_handle, data_buffer, 64);
         counter ++;
     }
-#endif
 #if (PRINT_DATA)
     printf("Status of feedback from bootloader: %x\n", ret);
 #endif
@@ -638,11 +617,7 @@
 /**
  *   Parses an intel hex file, calling the appropriate callbacks along the way
  */
-#ifdef WIN32
-static int FILE_ParseFile(const char *fileName)
-#else
 static int FILE_ParseFile(usb_dev_handle * dev_h, const char *fileName)
-#endif
 {
     FILE *fs = NULL;
     Parser_t parser;
@@ -655,9 +630,7 @@
     parser.segLen = 0x40;
     /* XXX this is not a good way to pass the handle up to
        finishSegment, any better idea? */
-#ifndef WIN32
     parser.dev_handle = dev_h;
-#endif
 
     if ((parser.segmentData = malloc(parser.segLen + 2)) == NULL)
     {
@@ -701,12 +674,8 @@
 /**
  *   Bootloads a CPU with the provided hex file
  */
-#ifdef WIN32
-int bootload(uint8_t cpu_address, uint8_t mem_t, const char *filename)
-#else
 int bootload(usb_dev_handle * dev_h, uint8_t cpu_address, uint8_t mem_t,
              const char *filename)
-#endif
 {
     int rc = FALSE;
     unsigned char data_buffer[64];
@@ -718,7 +687,6 @@
     /* Set global variable mem_type to the memory type */
     mem_type = mem_t;
 
-#ifndef WIN32
     /* For *nix system, display the memory type and prepare the progress bar.
      * ex : FLASH   [                                              ]
      */
@@ -727,7 +695,6 @@
         printf("EEPROM [\033[s\033[61C]\033[u\033[1B"); 
     else
         printf("FLASH  [\033[s\033[61C]\033[u\033[1B"); 
-#endif
     /* Bootloader initialization */
     data_buffer[0] = HID_I2C_HEADER;
     data_buffer[1] = BOOT_INIT;
@@ -745,7 +712,6 @@
         ret = tux_hid_write(5, data_buffer);
         sleep(1);
     }
-#ifndef WIN32
     else
     { 
         /* Send the command to active the bootloader */
@@ -753,15 +719,6 @@
         /* ... and read the status to be ure that it's correctly initialized */
         ret = usb_get_commands(dev_h, data_buffer, 64);
     }
-#endif
-#ifdef WIN32
-    tux_hid_read(5, data_buffer);
-    if (data_buffer[2] != BOOT_INIT_ACK)
-    {
-        log_error("\nInitialisazation failed \n");
-    }
-    
-#else
     if (HID)
     {
         if (!wait_status(BOOT_INIT_ACK, USB_TIMEOUT) || !ret)
@@ -781,14 +738,9 @@
             return FALSE;
         }
     }
-#endif
 
     /* Bootloader: parse hex file and send data */
-#ifdef WIN32
-    if (FILE_ParseFile(filename))
-#else
     if (FILE_ParseFile(dev_h, filename))
-#endif
     {
         rc = TRUE;
     }
@@ -805,27 +757,18 @@
     if (HID)
     {  
         tux_hid_write(5, data_buffer);
-#ifdef WIN32
-        sleep(1);
-#endif
         tux_hid_read(5, data_buffer);
-#ifdef WIN32
-        if (data_buffer[2] != BOOT_EXIT_ACK)
-#else
         if (!wait_status(BOOT_EXIT_ACK, USB_TIMEOUT))
-#endif
         {
             log_error("\nBootloader exit failed \n");
             return FALSE;
         }
     }
-#ifndef WIN32
     else
     {
         ret = usb_send_commands(dev_h, data_buffer, 5);
         ret = usb_get_commands(dev_h, data_buffer, 64);
     }
-#endif
     return rc;
 }
 
@@ -834,7 +777,6 @@
  * This function wait for a specific value of the second parameter of the
  * bootloader ACK.
  */
-#ifndef WIN32
 static bool wait_status(unsigned char value, int timeout)
 {
     unsigned char data_buffer[64];
@@ -854,7 +796,6 @@
     }
     return 1;
 }
-#endif
 
 /**
  * \brief Compute the progress bar depending of the number of line in the 
file. 

Modified: firmware/tuxup/trunk/bootloader.h
===================================================================
--- firmware/tuxup/trunk/bootloader.h   2008-09-17 13:03:17 UTC (rev 1873)
+++ firmware/tuxup/trunk/bootloader.h   2008-09-17 13:14:25 UTC (rev 1874)
@@ -22,14 +22,8 @@
 #ifndef bootloader_h
 #define bootloader_h
 #include <stdbool.h>
-#ifndef WIN32
 #include "usb-connection.h"
-#endif
 extern bool HID;
-#ifdef WIN32
-int bootload(uint8_t cpu_address, uint8_t mem_type, const char *filename);
-#else
 int bootload(usb_dev_handle * dev_h, uint8_t cpu_address, uint8_t mem_type,
              const char *filename);
 #endif
-#endif

Modified: firmware/tuxup/trunk/main.c
===================================================================
--- firmware/tuxup/trunk/main.c 2008-09-17 13:03:17 UTC (rev 1873)
+++ firmware/tuxup/trunk/main.c 2008-09-17 13:14:25 UTC (rev 1874)
@@ -31,24 +31,13 @@
 #include "bootloader.h"
 #include "version.h"
 #include "common/defines.h"
-#include "tux_misc.h"
 #include "error.h"
 #include "log.h"
-#ifdef WIN32
-#   include "tux_hid_win32.h"
-#   include <windows.h>
-#else
-#   include "usb-connection.h"
-#   include "tux_hid_unix.h"
-#endif
+#include "usb-connection.h"
+#include "tux_hid_unix.h"
 #define countof(X) ( (size_t) ( sizeof(X)/sizeof*(X) ) )
 
-#ifdef WIN32
-#define PATH_MAX 100
-#endif
-
 /* Messages. */
-#ifndef WIN32
 static char const *msg_old_fuxusb =
     "\nERROR: Your dongle firmware is too old to use this version of Tuxup"
     "\n       Please update your dongle firmware with a version of fuxusb.hex"
@@ -68,7 +57,7 @@
     " you want to use).\n"
     "\nCheck 
http://www.tuxisalive.com/documentation/how-to/updating-the-firmware";
     "\nfor more details.\n";
-#endif
+
 static char const *msg_dfu_programmer_not_installed =
     "\nERROR: dfu-programmer is not installed or is not in your path, tuxup 
uses"
     "\nit to reprogram the USB cpu so installing dfu-programmer is 
mandatory.\n";
@@ -89,10 +78,8 @@
 static int pretend = 0;
 
 /* USB handle */
-#ifndef WIN32
 static struct usb_device *device;
 static struct usb_dev_handle *dev_h;
-#endif
 static int usb_connected = 0;          /* Flag for usb connection status */
 
 /*
@@ -167,16 +154,13 @@
 
 static void fux_connect(void)
 {
-#ifndef WIN32
     int wait = 5;
-#endif
     if (usb_connected)
         return;
 
     /* First, try to found a HID device */
-    if (!(tux_hid_capture(TUX_VID, TUX_PID))) 
+    if (!(tux_hid_capture(TUX_VENDOR_ID, TUX_PRODUCT_ID))) 
     {
-#ifndef WIN32
         /* Unable to capture the device, try with the libusb */
         for (;;)
         {
@@ -198,10 +182,6 @@
             /* The dongle is a libusb device */
             HID = 0;
         }
-#else
-            log_error("The dongle was not found, now exiting.\n");
-            exit(E_TUXUP_DONGLENOTFOUND);
-#endif 
     }
     else
     {
@@ -217,7 +197,6 @@
     /* Check if we have the old firmware that requires entering
      * bootloader mode manually, exits with a message that explains what
      * to do in such a case. */
-#ifndef WIN32
     if (!HID)
     {
         if (device->descriptor.bcdDevice < 0x030)
@@ -233,8 +212,7 @@
             exit(E_TUXUP_USBERROR);
         }
     }
-#endif
-        log_info("Interface configured \n");
+    log_info("Interface configured \n");
     usb_connected = 1;
 }
 
@@ -248,13 +226,11 @@
     {
         tux_hid_release();
     }
-#ifndef WIN32
     else
     {
         usb_release_interface(dev_h, USB_COMMAND);
         usb_close(dev_h);
     }
-#endif
     log_info("     ... interface closed \n");
     usb_connected = 0;
 }
@@ -360,26 +336,14 @@
 
     if (pretend)
         return E_TUXUP_NOERROR;
-#ifdef WIN32
-    if (bootload(cpu_i2c_addr, FLASH, filename))
-#else
     if (bootload(dev_h, cpu_i2c_addr, FLASH, filename))
-#endif
     { 
-#ifdef WIN32
-       printf(" OK \n");
-#else 
        printf("\033[2C[ \033[01;32mOK\033[00m ]\n");
-#endif
-        return E_TUXUP_NOERROR;
+       return E_TUXUP_NOERROR;
     }
     else
     {
-#ifdef WIN32
-        log_notice(" FAIL \n");
-#else
         log_notice("\033[2C[\033[01;31mFAIL\033[00m]\n");
-#endif
     }
     return E_TUXUP_PROGRAMMINGFAILED;
 }
@@ -416,26 +380,14 @@
 
     if (pretend)
         return E_TUXUP_NOERROR;
-#ifdef WIN32
-    if (bootload(cpu_i2c_addr, EEPROM, filename))
-#else
     if (bootload(dev_h, cpu_i2c_addr, EEPROM, filename))
-#endif
     {
-#ifdef WIN32
-        printf("OK\n");
-#else
         printf("\033[2C[ \033[01;32mOK\033[00m ]\n");
-#endif
         return E_TUXUP_NOERROR;
     }
     else
     {
-#ifdef WIN32
-        log_notice("Fail \n");
-#else
         log_notice("\033[2C[\033[01;31mFAIL\033[00m]\n");
-#endif
     }
         return E_TUXUP_PROGRAMMINGFAILED;
 }
@@ -498,7 +450,6 @@
              * device */
             sleep(5);
         }
-#ifndef WIN32
         else
         {
             ret = usb_send_commands(dev_h, send_data, 5);
@@ -515,7 +466,6 @@
                 return E_TUXUP_BOOTLOADINGFAILED;
             }
         }
-#endif
     }
     else
     {

Modified: firmware/tuxup/trunk/tux_hid_unix.c
===================================================================
--- firmware/tuxup/trunk/tux_hid_unix.c 2008-09-17 13:03:17 UTC (rev 1873)
+++ firmware/tuxup/trunk/tux_hid_unix.c 2008-09-17 13:14:25 UTC (rev 1874)
@@ -33,7 +33,6 @@
 #include <dirent.h>
 
 #include "tux_hid_unix.h"
-#include "tux_misc.h"
 
 static int tux_device_hdl = -1;
 static char tux_device_path[256] = "";

Modified: firmware/tuxup/trunk/tux_hid_unix.h
===================================================================
--- firmware/tuxup/trunk/tux_hid_unix.h 2008-09-17 13:03:17 UTC (rev 1873)
+++ firmware/tuxup/trunk/tux_hid_unix.h 2008-09-17 13:14:25 UTC (rev 1874)
@@ -17,9 +17,6 @@
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
  * 02111-1307, USA.
  */
-
-#ifndef WIN32
-
 #ifndef _TUX_HID_H_
 #define _TUX_HID_H_
 
@@ -27,6 +24,8 @@
 #include <stdio.h>
 
 #define HID_RW_TIMEOUT                  1000
+#define LIBEXPORT    __attribute__ ((visibility ("default")))
+#define LIBLOCAL     __attribute__ ((visibility ("hidden")))
 
 extern bool tux_hid_capture(int vendor_id, int product_id);
 extern void tux_hid_release(void);
@@ -34,6 +33,3 @@
 extern bool tux_hid_read(int size, unsigned char *buffer);
 
 #endif /* _TUX_HID_H_ */
-
-#endif /* Not WIN32 */
-

Deleted: firmware/tuxup/trunk/tux_hid_win32.c
===================================================================
--- firmware/tuxup/trunk/tux_hid_win32.c        2008-09-17 13:03:17 UTC (rev 
1873)
+++ firmware/tuxup/trunk/tux_hid_win32.c        2008-09-17 13:14:25 UTC (rev 
1874)
@@ -1,224 +0,0 @@
-/*
- * Tux Droid - Hid interface (only for windows)
- * Copyright (C) 2008 C2ME Sa
- *
- * 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.
- */
- 
-#ifdef WIN32
- 
-#include <windows.h>
-#include <hidsdi.h>
-#include <setupapi.h>
-#include <dbt.h>
-#include <stdbool.h>
-#include <stdio.h>
-
-#include "tux_hid_win32.h"
-#include "tux_misc.h"
-
-static char device_symbolic_name[256] = "";
-static HANDLE tux_device_hdl = NULL;
-static COMMTIMEOUTS timeout;
-/**
- * \brief Open the device.
- * \param vendor_id The vendor ID constant of the device.
- * \param product_id The product ID of the device.
- * This function search for a specified device and try to open the
- * communication.
- * \return True if the device has been correctly opened.
- */
-bool LIBLOCAL
-tux_hid_capture(int vendor_id, int product_id)
-{
-    GUID hid_guid;
-    HANDLE h_dev_info;
-    SP_DEVICE_INTERFACE_DATA dev_info_data;
-    PSP_DEVICE_INTERFACE_DETAIL_DATA detail_data = NULL;
-    int member_index = 0;
-    bool last_device = false;
-    long result;
-    unsigned long length = 0;
-    ULONG required;
-    HANDLE device_hdl = NULL;
-    HIDD_ATTRIBUTES attributes;
-    bool tux_found = false;;
-    
-    if (tux_device_hdl != NULL)
-    {
-        return false;
-    }
-    HidD_GetHidGuid(&hid_guid);
-    
-    h_dev_info = SetupDiGetClassDevs(&hid_guid, \
-        NULL, NULL, DIGCF_PRESENT | DIGCF_INTERFACEDEVICE);
-    
-    dev_info_data.cbSize = sizeof(dev_info_data);
-    
-    member_index = 0;
-    
-    do 
-    {
-        result = SetupDiEnumDeviceInterfaces(h_dev_info, 0,
-            &hid_guid, member_index, &dev_info_data);
-            
-        if (result != 0)
-        {
-            result = SetupDiGetDeviceInterfaceDetail(h_dev_info,
-                &dev_info_data, NULL, 0, &length, NULL);
-                
-            detail_data = (PSP_DEVICE_INTERFACE_DETAIL_DATA)malloc(length);
-            detail_data->cbSize = sizeof(SP_DEVICE_INTERFACE_DETAIL_DATA);
-            
-            result = SetupDiGetDeviceInterfaceDetail(h_dev_info, 
-                               &dev_info_data, detail_data, length, &required, 
NULL);
-                
-            device_hdl = CreateFile(detail_data->DevicePath, 0, 
-                               FILE_SHARE_READ|FILE_SHARE_WRITE, 
(LPSECURITY_ATTRIBUTES)NULL,
-                               OPEN_EXISTING, 0, NULL);
-                
-            attributes.Size = sizeof(attributes);
-                       result = HidD_GetAttributes(device_hdl, &attributes);
-            
-            if ((attributes.VendorID == vendor_id) && 
-                (attributes.ProductID == product_id))
-            {
-                printf(device_symbolic_name, "%s", detail_data->DevicePath);
-
-                CloseHandle(device_hdl);
-                
-                tux_device_hdl = CreateFile(detail_data->DevicePath, 
-                    GENERIC_WRITE|GENERIC_READ, 
-                    FILE_SHARE_READ|FILE_SHARE_WRITE, 
-                    (LPSECURITY_ATTRIBUTES)NULL,
-                    OPEN_EXISTING, 0, NULL);
-                    
-                timeout.ReadTotalTimeoutConstant = HID_RW_TIMEOUT;
-                timeout.WriteTotalTimeoutConstant = HID_RW_TIMEOUT;
-                SetCommTimeouts(tux_device_hdl, &timeout);
-                               
-                               tux_found = true;
-                               
-                break;
-            }
-            
-            CloseHandle(device_hdl);
-            free(detail_data);
-        }
-        else
-        {
-            last_device = true;
-        }
-        
-        member_index++;
-        
-    } 
-    while (last_device == false);
-    
-    if (tux_found)
-    {
-        return true;
-    }
-    else
-    {
-        return false;
-    }
-}
-/**
- * \brief Release the actual device.
- * This function close the device.
- */
-void LIBLOCAL
-tux_hid_release(void)
-{
-    if (tux_device_hdl != NULL)
-    {
-        CloseHandle(tux_device_hdl);
-        tux_device_hdl = NULL;
-    }
-}
-
-/**
- * \brief Write a frame on the USB bus.
- * \param size The number of byte to write.
- * \param buffer A pointer to a buffer containing the data.
- * \return True if no error has been detected.
- * Write a frame buffer on the USB device.
- * For Tux, we don't use the report ID, so it's always null.
- */
-bool LIBLOCAL
-tux_hid_write(int size, const unsigned char *buffer)
-{
-    long wrt_count;
-    char report[65] = { [0 ... 64] = 0 };
-    long result;
-    
-    if (tux_device_hdl == NULL)
-    {
-        return false;
-    }
-    
-    report[0] = 0;
-    memcpy(&report[1], buffer, size);
-    
-    result = WriteFile(tux_device_hdl, report, 65, &wrt_count, NULL);
-
-    if (!result)
-    {
-        return false;
-    }
-    else
-    {
-        return true;
-    }
-}
-
-/**
- * \brief Read a byte on the USB bus.
- * \param size The number of data to read.
- * \param buffer Pointer to a buffer to write received data.
- * \return True if no error has been detected.
- * This function read 'size' bytes on the USB device. 
- * For Tux, we don't use the report ID, so the first byte of the received frame
- * is always ignored.
- * /!\ The report buffer size must be the same than the report of the device. 
- */
-bool LIBLOCAL
-tux_hid_read(int size, unsigned char *buffer)
-{
-    long rd_count;
-    char report[65];
-    long result;
-    
-    if (tux_device_hdl == NULL)
-    {
-        return false;
-    }
-
-    result = ReadFile(tux_device_hdl, report, 65, &rd_count, NULL);
-    memcpy(buffer, &report[1], size);
-    
-    if (!result)
-    {
-        return false;
-    }
-    else
-    {
-        return true;
-    }
-}
- 
-#endif /* WIN32 */

Deleted: firmware/tuxup/trunk/tux_hid_win32.h
===================================================================
--- firmware/tuxup/trunk/tux_hid_win32.h        2008-09-17 13:03:17 UTC (rev 
1873)
+++ firmware/tuxup/trunk/tux_hid_win32.h        2008-09-17 13:14:25 UTC (rev 
1874)
@@ -1,34 +0,0 @@
-/*
- * Tux Droid - Hid interface (only for windows)
- * Copyright (C) 2008 C2ME Sa
- *
- * 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.
- */
-#ifdef WIN32
-
-#ifndef _TUX_HID_H_
-#define _TUX_HID_H_
-
-#define HID_RW_TIMEOUT                  1000
-
-extern bool tux_hid_capture(int vendor_id, int product_id);
-extern void tux_hid_release(void);
-extern bool tux_hid_write(int size, const unsigned char *buffer);
-extern bool tux_hid_read(int size, unsigned char *buffer);
-
-#endif /* _TUX_HID_H_ */
-
-#endif /* WIN32 */

Deleted: firmware/tuxup/trunk/tux_misc.c
===================================================================
--- firmware/tuxup/trunk/tux_misc.c     2008-09-17 13:03:17 UTC (rev 1873)
+++ firmware/tuxup/trunk/tux_misc.c     2008-09-17 13:14:25 UTC (rev 1874)
@@ -1,211 +0,0 @@
-/*
- * Tux Droid - Misc
- * Copyright (C) 2008 C2ME Sa
- *
- * 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 <stdio.h>
-#include <string.h>
-
-#include "tux_misc.h"
-
-#ifdef WIN32
-#   include <time.h>
-#   include <windows.h>
-#else
-#   include <sys/time.h>
-#endif
-
-#ifdef WIN32
-#if defined(_MSC_VER) || defined(_MSC_EXTENSIONS)
-#   define DELTA_EPOCH_IN_MICROSECS  11644473600000000Ui64
-#else
-#   define DELTA_EPOCH_IN_MICROSECS  11644473600000000ULL
-#endif
-
-struct timezone 
-{
-    int  tz_minuteswest; /* minutes W of Greenwich */
-    int  tz_dsttime;     /* type of dst correction */
-};
-
-/**
- *
- */
-static int
-gettimeofday(struct timeval *tv, struct timezone *tz)
-{
-    FILETIME ft;
-    unsigned __int64 tmpres = 0;
-    static int tzflag;
-
-    if (NULL != tv)
-    {
-        GetSystemTimeAsFileTime(&ft);
-
-        tmpres |= ft.dwHighDateTime;
-        tmpres <<= 32;
-        tmpres |= ft.dwLowDateTime;
-
-        /*converting file time to unix epoch*/
-        tmpres -= DELTA_EPOCH_IN_MICROSECS; 
-        tmpres /= 10;  /*convert into microseconds*/
-        tv->tv_sec = (long)(tmpres / 1000000UL);
-        tv->tv_usec = (long)(tmpres % 1000000UL);
-    }
-
-    if (NULL != tz)
-    {
-        if (!tzflag)
-        {
-            _tzset();
-            tzflag++;
-        }
-        tz->tz_minuteswest = _timezone / 60;
-        tz->tz_dsttime = _daylight;
-    }
-
-    return 0;
-}
-#endif /* WIN32 */
-
-/**
- *
- */
-LIBEXPORT double
-get_time(void)
-{
-    double result;
-    struct timeval tv;
-    struct timezone tz;
-    
-    gettimeofday(&tv, &tz);
-    result = ((double)tv.tv_usec / 1000000) + (double)tv.tv_sec;
-    
-    return result;
-}
-
-LIBLOCAL bool
-str_to_uint8(const char *str, unsigned char *dest)
-{
-    int r, val;
-    
-    r = sscanf(str, "%d", &val);
-    
-    if (r == 1)
-    {
-        if ((val >= 0) && (val <= 255))
-        {
-            *dest = val;
-            return true;
-        }
-    }
-    
-    return false;
-}
-
-LIBLOCAL bool
-str_to_int8(const char *str, char *dest)
-{
-    int r, val;
-    
-    r = sscanf(str, "%d", &val);
-    
-    if (r == 1)
-    {
-        if ((val >= -128) && (val <= 127))
-        {
-            *dest = val;
-            return true;
-        }
-    }
-    
-    return false;
-}
-
-LIBLOCAL bool
-str_to_int(const char *str, int *dest)
-{
-    int r, val;
-    
-    r = sscanf(str, "%d", &val);
-    
-    if (r == 1)
-    {
-        *dest = val;
-        return true;
-    }
-    
-    return false;
-}
-
-LIBLOCAL bool
-str_to_bool(const char *str, bool *dest)
-{
-    if (!strcmp(str, "True"))
-    {
-        *dest = true;
-        return true;
-    }
-    else
-    {
-        if (!strcmp(str, "False"))
-        {
-            *dest = false;
-            return true;
-        }
-    }
-    
-    return false;
-}
-
-LIBLOCAL bool
-str_to_float(const char *str, float *dest)
-{
-    int r;
-    float val;
-    
-    r = sscanf(str, "%f", &val);
-    
-    if (r == 1)
-    {
-        *dest = val;
-        return true;
-    }
-    
-    return false;
-}
-
-LIBLOCAL bool
-hex_to_uint8(const char *str, unsigned char *dest)
-{
-    int r;
-    int val;
-    
-    r = sscanf(str, "0x%2x", &val);
-    
-    if (r == 1)
-    {
-        if ((val >= 0) && (val <= 255))
-        {
-            *dest = val;
-            return true;
-        }
-    }
-    
-    return false;
-}

Deleted: firmware/tuxup/trunk/tux_misc.h
===================================================================
--- firmware/tuxup/trunk/tux_misc.h     2008-09-17 13:03:17 UTC (rev 1873)
+++ firmware/tuxup/trunk/tux_misc.h     2008-09-17 13:14:25 UTC (rev 1874)
@@ -1,57 +0,0 @@
-/*
- * Tux Droid - Misc
- * Copyright (C) 2008 C2ME Sa
- *
- * 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_MISC_H_
-#define _TUX_MISC_H_
-
-#include <stdbool.h>
-#include <stdint.h>
-
-#define FW_MAIN_LOOP_DELAY          0.004
-
-#define TUX_VID 0x03eb // Atmel VID
-#define TUX_PID 0xFF07 // Tux PID
-
-#ifdef WIN32
-#   include <windows.h>
-#   include <mmsystem.h>
-#   define sleep(sec)   Sleep(sec * 1000)
-#   define usleep(usec) Sleep(usec / 1000)
-#   define LIBEXPORT    __declspec(dllexport)
-#   define LIBLOCAL
-#else
-#   define LIBEXPORT    __attribute__ ((visibility ("default")))
-#   define LIBLOCAL     __attribute__ ((visibility ("hidden")))
-#endif
-
-
-/**
- *      Callback function prototype for simple event
- */
-typedef void(*simple_callback_t)(void);
-
-extern double get_time(void);
-extern bool str_to_uint8(const char *str, unsigned char *dest);
-extern bool str_to_int8(const char *str, char *dest);
-extern bool str_to_int(const char *str, int *dest);
-extern bool str_to_bool(const char *str, bool *dest);
-extern bool str_to_float(const char *str, float *dest);
-extern bool hex_to_uint8(const char *str, unsigned char *dest);
-#endif /* _TUX_MISC_H_ */


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Tux-droid-svn mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tux-droid-svn

Reply via email to