Author: remi
Date: 2008-12-18 01:35:55 +0100 (Thu, 18 Dec 2008)
New Revision: 3154

Modified:
   software_suite_v2/tuxware/tuxhttpserver/trunk/src/tuxhttpserver.py
Log:
* fixed a critical bug in the way to launch Tuxosl

Modified: software_suite_v2/tuxware/tuxhttpserver/trunk/src/tuxhttpserver.py
===================================================================
--- software_suite_v2/tuxware/tuxhttpserver/trunk/src/tuxhttpserver.py  
2008-12-17 22:42:16 UTC (rev 3153)
+++ software_suite_v2/tuxware/tuxhttpserver/trunk/src/tuxhttpserver.py  
2008-12-18 00:35:55 UTC (rev 3154)
@@ -175,8 +175,6 @@
         self.__tuxDrv.SetLogTarget(LOG_TARGET_TUX)
         self.__tuxDrv.SetStatusCallback(self.__onStatusEvent)
         self.__tuxOSL.SetStatusCallback(self.__onStatusEvent)
-        self.__tuxDrv.SetDongleConnectedCallback(self.__onDongleConnected)
-        
self.__tuxDrv.SetDongleDisconnectedCallback(self.__onDongleDisconnected)
         Glb_ServerLog.logInfo("Tuxosl and tuxdriver initialized")
         # Create the HTTP server
         self.__httpServer = TDHTTPServer(port = self.__port)
@@ -226,6 +224,14 @@
         """
         # Parse the structure of the status
         statusStruct =  self.__tuxDrv.GetStatusStruct(status)
+        # Log the status
+        Glb_ServerLog.logDebug("Status : [%s]" % status)
+        # Dongle connection disconnection
+        if statusStruct['name'] == "dongle_plug":
+            if statusStruct['value'] == True:
+                self.__onDongleConnected()
+            else:
+                self.__onDongleDisconnected()
         # Log the "symbolic version" of the firmwares
         if str(statusStruct['name']).find("symbolic_version") != -1:
             Glb_ServerLog.logInfo("%s|%s" % (str(statusStruct['name']),
@@ -250,18 +256,22 @@
         global Glb_DonglePresent
 
         # Start the osl library
-        err = self.__tuxOSL.Start("Acapela")
-        if err != E_TUXOSL_NOERROR:
-            print self.__tuxOSL.StrError(err)
+        Glb_ServerLog.logInfo("Start Tuxosl")
+        for i in range(15):
+            time.sleep(2.5)
+            err = self.__tuxOSL.Start("Acapela")
+            if err == E_TUXOSL_NOERROR:
+                break
+        Glb_ServerLog.logInfo("Tuxosl started")
         Glb_DonglePresent = True
 
     def __onDongleDisconnected(self):
         """Callback function when the dongle is disconnected
         """
-        global Glb_DonglePresent
-
         # Stop the osl library
+        Glb_ServerLog.logInfo("Stop Tuxosl")
         self.__tuxOSL.Stop()
+        Glb_ServerLog.logInfo("Tuxosl stopped")
         Glb_DonglePresent = False
 
     def __loadResources(self):


------------------------------------------------------------------------------
SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada.
The future of the web can't happen without you.  Join us at MIX09 to help
pave the way to the Next Web now. Learn more and register at
http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/
_______________________________________________
Tux-droid-svn mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tux-droid-svn

Reply via email to