diff --git a/.vscode/settings.json b/.vscode/settings.json index 9e489bb6..95fb225a 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,6 +1,5 @@ { "files.associations": { - "tuxedo_ec_io.h": "c", "array": "c", "string": "c", "string_view": "c", diff --git a/binding.gyp b/binding.gyp index 21214596..7ef04966 100644 --- a/binding.gyp +++ b/binding.gyp @@ -1,13 +1,5 @@ { "targets": [ - { - "target_name": "TuxedoECAPI", - "sources": [ "src/native-lib/tuxedo_ec_napi.cc" ], - "libraries": [ "../src/native-lib/tuxedo_ec_lib/libs/tuxedo_ec_lib.a" ], - "include_dirs": [ " { ], extraResources: [ distSrc + '/data/service/tccd', - distSrc + '/data/service/TuxedoECAPI.node', distSrc + '/data/service/TuxedoWMIAPI.node', distSrc + '/data/CHANGELOG.md', distSrc + '/data/dist-data/tccd.service', @@ -103,7 +102,6 @@ async function buildSuseRpm(): Promise { ], extraResources: [ distSrc + '/data/service/tccd', - distSrc + '/data/service/TuxedoECAPI.node', distSrc + '/data/service/TuxedoWMIAPI.node', distSrc + '/data/dist-data/tccd.service', distSrc + '/data/dist-data/tccd-sleep.service', @@ -161,7 +159,6 @@ async function buildAppImage(): Promise { ], extraResources: [ distSrc + '/data/service/tccd', - distSrc + '/data/service/TuxedoECAPI.node', distSrc + '/data/service/TuxedoWMIAPI.node', distSrc + '/data/dist-data/tccd.service', distSrc + '/data/dist-data/tccd-sleep.service', diff --git a/package.json b/package.json index c6461dff..3a32ff10 100644 --- a/package.json +++ b/package.json @@ -24,7 +24,7 @@ "bundle-service": "pkg --target node10-linux-x64 --output ./dist/tuxedo-control-center/data/service/tccd ./dist/tuxedo-control-center/service-app/package.json", "build-native": "node-gyp configure && node-gyp rebuild", "copy-files": "run-s copy-package-json copy-dist-files copy-native", - "copy-native": "mkdir -p ./dist/tuxedo-control-center/service-app/native-lib && cp ./build/Release/TuxedoECAPI.node ./dist/tuxedo-control-center/data/service && cp ./build/Release/TuxedoWMIAPI.node ./dist/tuxedo-control-center/data/service", + "copy-native": "mkdir -p ./dist/tuxedo-control-center/service-app/native-lib && cp ./build/Release/TuxedoWMIAPI.node ./dist/tuxedo-control-center/data/service", "copy-package-json": "cp ./src/package.json ./dist/tuxedo-control-center/package.json", "copy-dist-files": "cp -r ./src/dist-data ./dist/tuxedo-control-center/data", "copy-changelog": "cp CHANGELOG.md ./src/ng-app/assets/", diff --git a/src/native-lib/TuxedoECAPI.ts b/src/native-lib/TuxedoECAPI.ts deleted file mode 100644 index 5dc8ff54..00000000 --- a/src/native-lib/TuxedoECAPI.ts +++ /dev/null @@ -1,53 +0,0 @@ -/*! - * Copyright (c) 2019 TUXEDO Computers GmbH - * - * This file is part of TUXEDO Control Center. - * - * TUXEDO Control Center is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * TUXEDO Control Center is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with TUXEDO Control Center. If not, see . - */ -export interface ITuxedoECAPI { - /** - * Connect webcam - * @returns True if successful, false otherwise - */ - webcamOn(): boolean; - /** - * Disconnect webcam - * @returns True if successful, false otherwise - */ - webcamOff(): boolean; - - /** - * Set standard auto fan control for specified fan - * @returns True if successful, false otherwise - */ - setFanAuto(fanNumber: number): boolean; - /** - * Set speed of specified fan in percent - * @returns True if successful, false otherwise - */ - setFanSpeedPercent(fanNumber: number, setFanSpeedPercent: number): boolean; - /** - * Get speed of specified fan in percent - * @returns The percentage or -1 on error - */ - getFanSpeedPercent(fanNumber: number): number; - /** - * Get temperature of sensor for specified fan - * @returns Temperature in celcius or -1 on error - */ - getFanTemperature(fanNumber: number): number; -} - -export const TuxedoECAPI: ITuxedoECAPI = require('TuxedoECAPI'); diff --git a/src/native-lib/tuxedo_ec_lib/headers/tuxedo_ec_io.h b/src/native-lib/tuxedo_ec_lib/headers/tuxedo_ec_io.h deleted file mode 100644 index 5f01a7c5..00000000 --- a/src/native-lib/tuxedo_ec_lib/headers/tuxedo_ec_io.h +++ /dev/null @@ -1,98 +0,0 @@ -/*! - * Copyright (c) 2019 TUXEDO Computers GmbH - * - * This file is part of TUXEDO Control Center. - * - * TUXEDO Control Center is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * TUXEDO Control Center is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with TUXEDO Control Center. If not, see . - */ -#ifndef TUXEDO_EC_IO_H -#define TUXEDO_EC_IO_H - -#include -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -#define EC_SUCCESS 1 -#define EC_ERROR 0 - -/** - * "Call Or Return" macro - * If the expression fails, return failure - */ -#define CALL(expression) if ((expression) != EC_SUCCESS) return EC_ERROR; - -/** - * Initialize ports by attempting to get port permissions - * - * @returns 0 on success or ioperm return code on error - */ -int init_ports(); - -/** - * Gives back permissions requested by init_ports() - * - * @returns 0 on success or ioperm return code on error - */ -int close_ports(); - -/** - * Writes specified command code to the command port - * - * 1. Waits until command port signals "ready to write" - * 2. Writes to the command port - * - * Returns EC_SUCCESS if successful, EC_ERROR in case of timeout - */ -int write_command(uint8_t); - -/** - * Writes the specified data to the data port - * - * 1. Waits until the command ports signals "ready to write" - * 2. Writes to the data port - * - * Returns EC_SUCCESS if succesful, EC_ERROR in case of timeout - */ -int write_data(uint8_t); - -/** - * Reads one byte from the data port - * - * Returns the read value on success, -1 on failure - */ -int read_data_byte(); - -/** - * Reads specified EC register - * - * Returns the read value on success, -1 on failure - */ -int read_register_byte(uint8_t); - -/** - * Writes specified EC register - * - * Returns EC_SUCCESS on success, otherwise EC_ERROR - */ -int write_register_byte(uint8_t, uint8_t); - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/src/native-lib/tuxedo_ec_lib/headers/tuxedo_fan_api.h b/src/native-lib/tuxedo_ec_lib/headers/tuxedo_fan_api.h deleted file mode 100644 index bd23a7fd..00000000 --- a/src/native-lib/tuxedo_ec_lib/headers/tuxedo_fan_api.h +++ /dev/null @@ -1,76 +0,0 @@ -/*! - * Copyright (c) 2019 TUXEDO Computers GmbH - * - * This file is part of TUXEDO Control Center. - * - * TUXEDO Control Center is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * TUXEDO Control Center is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with TUXEDO Control Center. If not, see . - */ - -/** - * TUXEDO Fan API - */ -#ifndef TUXEDO_FAN_API -#define TUXEDO_FAN_API - -#include -#include "tuxedo_ec_io.h" - -#define FAN_CPU 1 -#define FAN_GPU1 2 -#define FAN_GPU2 3 - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * Set auto fan control for specified fan - * - * Returns EC_SUCCESS on success, otherwise EC_ERROR - */ -int set_fan_auto(int __fan_number); - -/** - * Set fan control speed for specified fan - * - * Returns EC_SUCCESS on success, otherwise EC_ERROR - */ -int set_fan_speed(int __fan_number, int __fan_speed); - -/** - * Get temperature of sensor for specified fan - * - * Returns the temperature - */ -int get_fan_temperature(int __fan_number); - -/** - * Get speed for specified fan in percent - * - * Returns the speed in percent - */ -int get_fan_speed_percent(int __fan_number); - -/** - * Get speed for specified fan in rpm - * - * Returns the speed in percent - */ -int get_fan_speed_rpm(int __fan_number); - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/src/native-lib/tuxedo_ec_lib/headers/tuxedo_webcam_api.h b/src/native-lib/tuxedo_ec_lib/headers/tuxedo_webcam_api.h deleted file mode 100644 index 8cc39c53..00000000 --- a/src/native-lib/tuxedo_ec_lib/headers/tuxedo_webcam_api.h +++ /dev/null @@ -1,42 +0,0 @@ -/*! - * Copyright (c) 2019 TUXEDO Computers GmbH - * - * This file is part of TUXEDO Control Center. - * - * TUXEDO Control Center is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * TUXEDO Control Center is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with TUXEDO Control Center. If not, see . - */ -#ifndef TUXEDO_WEBCAM_API -#define TUXEDO_WEBCAM_API - -#include "tuxedo_ec_io.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * Virtually connect webcam - */ -int webcam_on(); - -/** - * Virtually disconnect webcam - */ -int webcam_off(); - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/src/native-lib/tuxedo_ec_lib/libs/tuxedo_ec_lib.a b/src/native-lib/tuxedo_ec_lib/libs/tuxedo_ec_lib.a deleted file mode 100644 index c9666e3e..00000000 Binary files a/src/native-lib/tuxedo_ec_lib/libs/tuxedo_ec_lib.a and /dev/null differ diff --git a/src/native-lib/tuxedo_ec_napi.cc b/src/native-lib/tuxedo_ec_napi.cc deleted file mode 100644 index 1d3ae8ba..00000000 --- a/src/native-lib/tuxedo_ec_napi.cc +++ /dev/null @@ -1,94 +0,0 @@ -/*! - * Copyright (c) 2019-2020 TUXEDO Computers GmbH - * - * This file is part of TUXEDO Control Center. - * - * TUXEDO Control Center is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * TUXEDO Control Center is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with TUXEDO Control Center. If not, see . - */ -#include -#include "tuxedo_ec_lib/headers/tuxedo_webcam_api.h" -#include "tuxedo_ec_lib/headers/tuxedo_fan_api.h" - - -using namespace Napi; - -Boolean webcamOn(const CallbackInfo &info) { - int result; - result = webcam_on(); - return Boolean::New(info.Env(), result == EC_SUCCESS); -} - -Boolean webcamOff(const CallbackInfo &info) { - int result; - result = webcam_off(); - return Boolean::New(info.Env(), result == EC_SUCCESS); -} - -Boolean setFanAuto(const CallbackInfo &info) { - if (info.Length() != 1 || !info[0].IsNumber()) return Boolean::New(info.Env(), false); - int fanNumber = info[0].As(); - if (fanNumber < 1 || fanNumber > 4) return Boolean::New(info.Env(), false); - - int result = set_fan_auto(fanNumber); - - return Boolean::New(info.Env(), result == EC_SUCCESS); -} - -Boolean setFanSpeedPercent(const CallbackInfo &info) { - if (info.Length() != 2 || !info[0].IsNumber() || !info[1].IsNumber()) return Boolean::New(info.Env(), false); - int fanNumber = info[0].As(); - int speedPercent = info[1].As(); - if (fanNumber < 1 || fanNumber > 4) return Boolean::New(info.Env(), false); - if (speedPercent < 0 || speedPercent > 100) return Boolean::New(info.Env(), false); - - int result = set_fan_speed(fanNumber, speedPercent); - - return Boolean::New(info.Env(), result == EC_SUCCESS); -} - -Number getFanSpeedPercent(const CallbackInfo &info) { - if (info.Length() != 1 || !info[0].IsNumber()) return Number::New(info.Env(), -1); - int fanNumber = info[0].As(); - if (fanNumber < 1 || fanNumber > 4) return Number::New(info.Env(), -1); - - int fanSpeedPercent = get_fan_speed_percent(fanNumber); - - return Number::New(info.Env(), fanSpeedPercent); -} - -Number getFanTemperature(const CallbackInfo &info) { - if (info.Length() != 1 || !info[0].IsNumber()) return Number::New(info.Env(), -1); - int fanNumber = info[0].As(); - if (fanNumber < 1 || fanNumber > 4) return Number::New(info.Env(), -1); - - int fanTemperature = get_fan_temperature(fanNumber); - - return Number::New(info.Env(), fanTemperature); -} - -Object Init(Env env, Object exports) { - // Webcam - exports.Set(String::New(env, "webcamOn"), Function::New(env, webcamOn)); - exports.Set(String::New(env, "webcamOff"), Function::New(env, webcamOff)); - - // Fan control - exports.Set(String::New(env, "setFanAuto"), Function::New(env, setFanAuto)); - exports.Set(String::New(env, "setFanSpeedPercent"), Function::New(env, setFanSpeedPercent)); - exports.Set(String::New(env, "getFanSpeedPercent"), Function::New(env, getFanSpeedPercent)); - exports.Set(String::New(env, "getFanTemperature"), Function::New(env, getFanTemperature)); - - return exports; -} - -NODE_API_MODULE(TuxedoECAPI, Init);