Add missing import.
[openwrt/svn-archive/feeds.git] / phone / fso-frameworkd / patches / 020-fix-paths.patch
1 diff --git a/framework/subsystems/odeviced/powercontrol_neo.py b/framework/subsystems/odeviced/powercontrol_neo.py
2 index 6d5959f..a3a9a93 100644
3 --- a/framework/subsystems/odeviced/powercontrol_neo.py
4 +++ b/framework/subsystems/odeviced/powercontrol_neo.py
5 @@ -49,7 +49,10 @@ class NeoUsbHostPowerControl( GenericPowerControl ):
6 # mode switching
7 self.modenode = "%s/%s" % ( node, "usb_mode" )
8 # node to provide 5V/100mA to USB gadgets, only present on Neo FreeRunner
9 - self.powernode = "%s/neo1973-pm-host.0/hostmode" % os.path.dirname( node )
10 + for dev in ["gta02-pm-host.0", "neo1973-pm-host.0"]:
11 + path = "%s/%s/hostmode" % (os.path.dirname ( node ), dev)
12 + if os.path.exists(path):
13 + self.powernode = path
14
15 def setPower( self, power ):
16 if power:
17 @@ -88,6 +91,8 @@ def factory( prefix, controller ):
18
19 if "neo1973-pm-bt.0" in devices:
20 objects.append( NeoBluetoothPowerControl( bus, "%s/%s" % ( DEVICE_DIR, "neo1973-pm-bt.0" ) ) )
21 + if "gta02-pm-bt.0" in devices:
22 + objects.append( NeoBluetoothPowerControl( bus, "%s/%s" % ( DEVICE_DIR, "gta02-pm-bt.0" ) ) )
23
24 if "s3c-ohci" in devices:
25 objects.append( NeoUsbHostPowerControl( bus, "%s/%s" % ( DEVICE_DIR, "s3c-ohci" ) ) )
26 diff --git a/framework/subsystems/oeventsd/fso_actions.py b/framework/subsystems/oeventsd/fso_actions.py
27 index d46fbfc..651125a 100644
28 --- a/framework/subsystems/oeventsd/fso_actions.py
29 +++ b/framework/subsystems/oeventsd/fso_actions.py
30 @@ -152,7 +152,7 @@ class VibratorAction(Action):
31 """
32 function_name = 'Vibration'
33 # FIXME: device specific, needs to go away from here / made generic (parametric? just take the first?)
34 - def __init__(self, target = 'neo1973_vibrator', mode = "continuous"):
35 + def __init__(self, target = 'gta02_vibrator', mode = "continuous"):
36 self.mode = mode
37 self.target = target
38
39 diff --git a/framework/subsystems/ogsmd/modems/ti_calypso/modem.py b/framework/subsystems/ogsmd/modems/ti_calypso/modem.py
40 index dfe40ef..20bb36f 100644
41 --- a/framework/subsystems/ogsmd/modems/ti_calypso/modem.py
42 +++ b/framework/subsystems/ogsmd/modems/ti_calypso/modem.py
43 @@ -14,10 +14,17 @@ Module: modem
44 __version__ = "0.9.9.10"
45 MODULE_NAME = "ogsmd.modems.ti_calypso"
46 +
47 +import os.path
48
49 +if os.path.exists("/sys/bus/platform/devices/gta02-pm-gsm.0"):
50 + SYSFS_DEVICE = "gta02-pm-gsm.0"
51 +else:
52 + SYSFS_DEVICE = "neo1973-pm-gsm.0"
53 +
54 DEVICE_CALYPSO_PATH = "/dev/ttySAC0"
55 -SYSFS_CALYPSO_POWER_PATH = "/sys/bus/platform/devices/neo1973-pm-gsm.0/power_on"
56 -SYSFS_CALYPSO_RESET_PATH = "/sys/bus/platform/devices/neo1973-pm-gsm.0/reset"
57 -SYSFS_CALYPSO_FLOW_CONTROL_PATH = "/sys/bus/platform/devices/neo1973-pm-gsm.0/flowcontrolled"
58 +SYSFS_CALYPSO_POWER_PATH = "/sys/bus/platform/devices/%s/power_on" % SYSFS_DEVICE
59 +SYSFS_CALYPSO_RESET_PATH = "/sys/bus/platform/devices/%s/reset" % SYSFS_DEVICE
60 +SYSFS_CALYPSO_FLOW_CONTROL_PATH = "/sys/bus/platform/devices/%s/flowcontrolled" % SYSFS_DEVICE
61
62 import mediator
63
64 diff --git a/framework/subsystems/ogpsd/om.py b/framework/subsystems/ogpsd/om.py
65 --- a/framework/subsystems/ogpsd/om.py
66 +++ b/framework/subsystems/ogpsd/om.py
67 @@ -12,8 +12,8 @@ GPLv2 or later
68 __version__ = "0.9.9.4"
69 MODULE_NAME = "ogpsd"
70
71 -DEVICE_POWER_PATH_OLD = "/sys/bus/platform/devices/neo1973-pm-gps.0/pwron"
72 -DEVICE_POWER_PATH_NEW = "/sys/bus/platform/devices/neo1973-pm-gps.0/power_on"
73 +DEVICE_POWER_PATHS = ["/sys/bus/platform/devices/gta02-pm-gps.0/power_on",
74 + "/sys/bus/platform/devices/neo1973-pm-gps.0/power_on"]
75
76 from ubx import UBXDevice
77 from ubx import CLIDPAIR
78 @@ -33,12 +33,17 @@ class GTA02Device( UBXDevice ):
79
80 def __init__( self, bus, channel ):
81
82 - # Make sure the GPS is off
83 - helpers.writeToFile( DEVICE_POWER_PATH_OLD, "1" )
84 - helpers.writeToFile( DEVICE_POWER_PATH_NEW, "1" )
85 - time.sleep( 0.5 )
86 - helpers.writeToFile( DEVICE_POWER_PATH_OLD, "0" )
87 - helpers.writeToFile( DEVICE_POWER_PATH_NEW, "0" )
88 + self.device_path = None
89 + for path in DEVICE_POWER_PATHS:
90 + if os.path.exists(path):
91 + self.device_path = path
92 + break
93 +
94 + if self.device_path:
95 + # Make sure the GPS is off
96 + helpers.writeToFile( self.device_path, "1" )
97 + time.sleep( 0.5 )
98 + helpers.writeToFile( self.device_path, "0" )
99
100 self.aidingData = persist.get( "ogpsd", "aidingdata" )
101 if self.aidingData is None:
102 @@ -49,8 +54,8 @@ class GTA02Device( UBXDevice ):
103 super( GTA02Device, self ).__init__( bus, channel )
104
105 def initializeDevice( self ):
106 - helpers.writeToFile( DEVICE_POWER_PATH_OLD, "1" )
107 - helpers.writeToFile( DEVICE_POWER_PATH_NEW, "1" )
108 + if self.device_path:
109 + helpers.writeToFile( self.device_path, "1" )
110
111 # Wait for the device to be powered up
112 time.sleep(0.5)
113 @@ -81,9 +86,8 @@ class GTA02Device( UBXDevice ):
114 self.huiTimeout = None
115
116 super( GTA02Device, self ).shutdownDevice()
117 -
118 - helpers.writeToFile( DEVICE_POWER_PATH_OLD, "0" )
119 - helpers.writeToFile( DEVICE_POWER_PATH_NEW, "0" )
120 + if self.device_path:
121 + helpers.writeToFile( self.device_path, "0" )
122
123 # Save collected aiding data
124 persist.set( "ogpsd", "aidingdata", self.aidingData )