-
-
Notifications
You must be signed in to change notification settings - Fork 5
/
index.js
26 lines (21 loc) · 832 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
/**
* Copyright 2018-present Samsung Electronics Co., Ltd. and other contributors
* index.js - Loads the Generic Sensors adapter.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.*
*/
'use strict';
const fs = require('fs');
function maybeLoadGenericSensorsAdapter(addonManager, manifest, errorCallback) {
try {
fs.accessSync('/dev/i2c-1', fs.constants.W_OK);
} catch (err) {
errorCallback(manifest.name, 'No permissions for I2C resources');
return;
}
const loadGenericSensorsAdapter = require('./generic-sensors-adapter');
return loadGenericSensorsAdapter(addonManager, manifest, errorCallback);
}
module.exports = maybeLoadGenericSensorsAdapter;