d0f2bb6c098a14b6ddf95ad58b20122a35513f67
[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,15 @@ Module: modem
44 __version__ = "0.9.9.10"
45 MODULE_NAME = "ogsmd.modems.ti_calypso"
46
47 +if os.path.exists("/sys/bus/platform/devices/gta02-pm-gps.0"):
48 + SYSFS_DEVICE = "gta02-pm-gps.0"
49 +else:
50 + SYSFS_DEVICE = "neo1973-pm-gps.0"
51 +
52 DEVICE_CALYPSO_PATH = "/dev/ttySAC0"
53 -SYSFS_CALYPSO_POWER_PATH = "/sys/bus/platform/devices/neo1973-pm-gsm.0/power_on"
54 -SYSFS_CALYPSO_RESET_PATH = "/sys/bus/platform/devices/neo1973-pm-gsm.0/reset"
55 -SYSFS_CALYPSO_FLOW_CONTROL_PATH = "/sys/bus/platform/devices/neo1973-pm-gsm.0/flowcontrolled"
56 +SYSFS_CALYPSO_POWER_PATH = "/sys/bus/platform/devices/%s/power_on" % SYSFS_DEVICE
57 +SYSFS_CALYPSO_RESET_PATH = "/sys/bus/platform/devices/%s/reset" % SYSFS_DEVICE
58 +SYSFS_CALYPSO_FLOW_CONTROL_PATH = "/sys/bus/platform/devices/%s/flowcontrolled" % SYSFS_DEVICE
59
60 import mediator
61
62 diff --git a/framework/subsystems/ogpsd/om.py b/framework/subsystems/ogpsd/om.py
63 --- a/framework/subsystems/ogpsd/om.py
64 +++ b/framework/subsystems/ogpsd/om.py
65 @@ -12,8 +12,8 @@ GPLv2 or later
66 __version__ = "0.9.9.4"
67 MODULE_NAME = "ogpsd"
68
69 -DEVICE_POWER_PATH_OLD = "/sys/bus/platform/devices/neo1973-pm-gps.0/pwron"
70 -DEVICE_POWER_PATH_NEW = "/sys/bus/platform/devices/neo1973-pm-gps.0/power_on"
71 +DEVICE_POWER_PATHS = ["/sys/bus/platform/devices/gta02-pm-gps.0/power_on",
72 + "/sys/bus/platform/devices/neo1973-pm-gps.0/power_on"]
73
74 from ubx import UBXDevice
75 from ubx import CLIDPAIR
76 @@ -33,12 +33,17 @@ class GTA02Device( UBXDevice ):
77
78 def __init__( self, bus, channel ):
79
80 - # Make sure the GPS is off
81 - helpers.writeToFile( DEVICE_POWER_PATH_OLD, "1" )
82 - helpers.writeToFile( DEVICE_POWER_PATH_NEW, "1" )
83 - time.sleep( 0.5 )
84 - helpers.writeToFile( DEVICE_POWER_PATH_OLD, "0" )
85 - helpers.writeToFile( DEVICE_POWER_PATH_NEW, "0" )
86 + self.device_path = None
87 + for path in DEVICE_POWER_PATHS:
88 + if os.path.exists(path):
89 + self.device_path = path
90 + break
91 +
92 + if self.device_path:
93 + # Make sure the GPS is off
94 + helpers.writeToFile( self.device_path, "1" )
95 + time.sleep( 0.5 )
96 + helpers.writeToFile( self.device_path, "0" )
97
98 self.aidingData = persist.get( "ogpsd", "aidingdata" )
99 if self.aidingData is None:
100 @@ -49,8 +54,8 @@ class GTA02Device( UBXDevice ):
101 super( GTA02Device, self ).__init__( bus, channel )
102
103 def initializeDevice( self ):
104 - helpers.writeToFile( DEVICE_POWER_PATH_OLD, "1" )
105 - helpers.writeToFile( DEVICE_POWER_PATH_NEW, "1" )
106 + if self.device_path:
107 + helpers.writeToFile( self.device_path, "1" )
108
109 # Wait for the device to be powered up
110 time.sleep(0.5)
111 @@ -81,9 +86,8 @@ class GTA02Device( UBXDevice ):
112 self.huiTimeout = None
113
114 super( GTA02Device, self ).shutdownDevice()
115 -
116 - helpers.writeToFile( DEVICE_POWER_PATH_OLD, "0" )
117 - helpers.writeToFile( DEVICE_POWER_PATH_NEW, "0" )
118 + if self.device_path:
119 + helpers.writeToFile( self.device_path, "0" )
120
121 # Save collected aiding data
122 persist.set( "ogpsd", "aidingdata", self.aidingData )