|
Lines 45-50
except ImportError:
Link Here
|
| 45 |
sys.exit(1) |
45 |
sys.exit(1) |
| 46 |
|
46 |
|
| 47 |
|
47 |
|
|
|
48 |
def has_ssc_service(): |
| 49 |
"""Check if Qualcomm SSC service is available via QRTR.""" |
| 50 |
try: |
| 51 |
import ctypes |
| 52 |
lib = ctypes.util.find_library('ssc') |
| 53 |
if not lib: |
| 54 |
return False |
| 55 |
ssc = ctypes.CDLL(lib) |
| 56 |
func = ssc.ssc_sensor_compass_new_sync |
| 57 |
func.restype = ctypes.c_void_p |
| 58 |
func.argtypes = [ctypes.c_void_p, ctypes.c_void_p] |
| 59 |
sensor = func(None, None) |
| 60 |
if sensor: |
| 61 |
close = ssc.ssc_sensor_compass_close_sync |
| 62 |
close.restype = ctypes.c_int |
| 63 |
close.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p] |
| 64 |
close(sensor, None, None) |
| 65 |
return True |
| 66 |
return False |
| 67 |
except Exception: |
| 68 |
return False |
| 69 |
|
| 70 |
|
| 48 |
SP = 'net.hadess.SensorProxy' |
71 |
SP = 'net.hadess.SensorProxy' |
| 49 |
SP_PATH = '/net/hadess/SensorProxy' |
72 |
SP_PATH = '/net/hadess/SensorProxy' |
| 50 |
SP_COMPASS = 'net.hadess.SensorProxy.Compass' |
73 |
SP_COMPASS = 'net.hadess.SensorProxy.Compass' |
|
Lines 312-317
class Tests(dbusmock.DBusTestCase):
Link Here
|
| 312 |
|
335 |
|
| 313 |
self.stop_daemon() |
336 |
self.stop_daemon() |
| 314 |
|
337 |
|
|
|
338 |
@unittest.skipIf(not has_ssc_service(), 'SSC service not available via QRTR') |
| 315 |
def test_ssc_light(self): |
339 |
def test_ssc_light(self): |
| 316 |
'''SSC light''' |
340 |
'''SSC light''' |
| 317 |
prox = self.testbed.add_device('misc', 'ssc-light', None, |
341 |
prox = self.testbed.add_device('misc', 'ssc-light', None, |
|
Lines 336-341
class Tests(dbusmock.DBusTestCase):
Link Here
|
| 336 |
|
360 |
|
| 337 |
self.stop_daemon() |
361 |
self.stop_daemon() |
| 338 |
|
362 |
|
|
|
363 |
@unittest.skipIf(not has_ssc_service(), 'SSC service not available via QRTR') |
| 339 |
def test_ssc_compass(self): |
364 |
def test_ssc_compass(self): |
| 340 |
'''SSC compass''' |
365 |
'''SSC compass''' |
| 341 |
prox = self.testbed.add_device('misc', 'ssc-compass', None, |
366 |
prox = self.testbed.add_device('misc', 'ssc-compass', None, |
| 342 |
- |
|
|