mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2023-10-10 13:36:59 +02:00
Fix LED Devices (Lightpack, Atmo/Karate, Hue) (#1337)
* Fix that lighpack cores when lack of permissions * Atmo/Karate - Fix LedCount constraint handling * Hue updates - Have EntertainmentAPI as default, disable hardwareledcount as cacultated * Have Gamma per default 2.2
This commit is contained in:
parent
af24e6d623
commit
f269268def
@ -750,6 +750,8 @@ $(document).ready(function () {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case "philipshue":
|
case "philipshue":
|
||||||
|
conf_editor.getEditor("root.generalOptions").disable();
|
||||||
|
|
||||||
var lights = conf_editor.getEditor("root.specificOptions.lightIds").getValue();
|
var lights = conf_editor.getEditor("root.specificOptions.lightIds").getValue();
|
||||||
hwLedCountDefault = lights.length;
|
hwLedCountDefault = lights.length;
|
||||||
colorOrderDefault = "rgb";
|
colorOrderDefault = "rgb";
|
||||||
@ -757,6 +759,7 @@ $(document).ready(function () {
|
|||||||
|
|
||||||
case "yeelight":
|
case "yeelight":
|
||||||
conf_editor.getEditor("root.generalOptions").disable();
|
conf_editor.getEditor("root.generalOptions").disable();
|
||||||
|
|
||||||
var lights = conf_editor.getEditor("root.specificOptions.lights").getValue();
|
var lights = conf_editor.getEditor("root.specificOptions.lights").getValue();
|
||||||
hwLedCountDefault = lights.length;
|
hwLedCountDefault = lights.length;
|
||||||
colorOrderDefault = "rgb";
|
colorOrderDefault = "rgb";
|
||||||
@ -1070,6 +1073,13 @@ $(document).ready(function () {
|
|||||||
hwLedCount.setValue(lights.length);
|
hwLedCount.setValue(lights.length);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
//Handle Hardware Led Count constraint list
|
||||||
|
conf_editor.watch('root.generalOptions.hardwareLedCountList', () => {
|
||||||
|
var hwLedCountSelected = conf_editor.getEditor("root.generalOptions.hardwareLedCountList").getValue();
|
||||||
|
conf_editor.getEditor("root.generalOptions.hardwareLedCount").setValue(Number(hwLedCountSelected));
|
||||||
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
//philipshueentertainment backward fix
|
//philipshueentertainment backward fix
|
||||||
@ -1648,7 +1658,9 @@ function updateElements(ledType, key) {
|
|||||||
if (ledProperties && ledProperties.ledCount) {
|
if (ledProperties && ledProperties.ledCount) {
|
||||||
if (ledProperties.ledCount.length > 0) {
|
if (ledProperties.ledCount.length > 0) {
|
||||||
var configuredLedCount = window.serverConfig.device.hardwareLedCount;
|
var configuredLedCount = window.serverConfig.device.hardwareLedCount;
|
||||||
updateJsonEditorSelection(conf_editor, 'root.generalOptions', "hardwareLedCount", {}, ledProperties.ledCount, [], configuredLedCount);
|
showInputOptionForItem(conf_editor, 'generalOptions', "hardwareLedCount", false);
|
||||||
|
updateJsonEditorSelection(conf_editor, 'root.generalOptions', "hardwareLedCountList", {"title": "edt_dev_general_hardwareLedCount_title"},
|
||||||
|
ledProperties.ledCount.map(String), [], configuredLedCount);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -37,9 +37,9 @@
|
|||||||
"cyan" : [0,255,255],
|
"cyan" : [0,255,255],
|
||||||
"magenta" : [255,0,255],
|
"magenta" : [255,0,255],
|
||||||
"yellow" : [255,255,0],
|
"yellow" : [255,255,0],
|
||||||
"gammaRed" : 1.5,
|
"gammaRed" : 2.2,
|
||||||
"gammaGreen" : 1.5,
|
"gammaGreen" : 2.2,
|
||||||
"gammaBlue" : 1.5,
|
"gammaBlue" : 2.2,
|
||||||
"backlightThreshold" : 0,
|
"backlightThreshold" : 0,
|
||||||
"backlightColored" : false,
|
"backlightColored" : false,
|
||||||
"brightness" : 100,
|
"brightness" : 100,
|
||||||
|
@ -206,7 +206,7 @@
|
|||||||
"required" : true,
|
"required" : true,
|
||||||
"minimum" : 0.1,
|
"minimum" : 0.1,
|
||||||
"maximum": 100.0,
|
"maximum": 100.0,
|
||||||
"default" : 1.5,
|
"default" : 2.2,
|
||||||
"step" : 0.1,
|
"step" : 0.1,
|
||||||
"propertyOrder" : 15
|
"propertyOrder" : 15
|
||||||
},
|
},
|
||||||
@ -217,7 +217,7 @@
|
|||||||
"required" : true,
|
"required" : true,
|
||||||
"minimum" : 0.1,
|
"minimum" : 0.1,
|
||||||
"maximum": 100.0,
|
"maximum": 100.0,
|
||||||
"default" : 1.5,
|
"default" : 2.2,
|
||||||
"step" : 0.1,
|
"step" : 0.1,
|
||||||
"propertyOrder" : 16
|
"propertyOrder" : 16
|
||||||
},
|
},
|
||||||
@ -228,7 +228,7 @@
|
|||||||
"required" : true,
|
"required" : true,
|
||||||
"minimum" : 0.1,
|
"minimum" : 0.1,
|
||||||
"maximum": 100.0,
|
"maximum": 100.0,
|
||||||
"default" : 1.5,
|
"default" : 2.2,
|
||||||
"step" : 0.1,
|
"step" : 0.1,
|
||||||
"propertyOrder" : 17
|
"propertyOrder" : 17
|
||||||
}
|
}
|
||||||
|
@ -118,11 +118,11 @@ bool LedDeviceLightpack::init(const QJsonObject &deviceConfig)
|
|||||||
QString errortext;
|
QString errortext;
|
||||||
if (_serialNumber.isEmpty())
|
if (_serialNumber.isEmpty())
|
||||||
{
|
{
|
||||||
errortext = QString ("No Lightpack devices were found");
|
errortext = QString ("No working Lightpack devices were found");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
errortext = QString ("No Lightpack device found with serial %1").arg( _serialNumber);
|
errortext = QString ("No working Lightpack device found with serial %1").arg( _serialNumber);
|
||||||
}
|
}
|
||||||
this->setInError( errortext );
|
this->setInError( errortext );
|
||||||
}
|
}
|
||||||
@ -197,9 +197,6 @@ bool LedDeviceLightpack::searchDevice(libusb_device * device, const QString & re
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define UNO_VENDOR_ID 0x2341
|
|
||||||
#define UNO_PRODUCT_ID 0x43
|
|
||||||
|
|
||||||
if ((deviceDescriptor.idVendor == USB_VENDOR_ID && deviceDescriptor.idProduct == USB_PRODUCT_ID) ||
|
if ((deviceDescriptor.idVendor == USB_VENDOR_ID && deviceDescriptor.idProduct == USB_PRODUCT_ID) ||
|
||||||
(deviceDescriptor.idVendor == USB_OLD_VENDOR_ID && deviceDescriptor.idProduct == USB_OLD_PRODUCT_ID))
|
(deviceDescriptor.idVendor == USB_OLD_VENDOR_ID && deviceDescriptor.idProduct == USB_OLD_PRODUCT_ID))
|
||||||
{
|
{
|
||||||
@ -375,28 +372,30 @@ int LedDeviceLightpack::openDevice(libusb_device *device, libusb_device_handle *
|
|||||||
Error(_log, "unable to open device(%d): %s", error, libusb_error_name(error));
|
Error(_log, "unable to open device(%d): %s", error, libusb_error_name(error));
|
||||||
rc = -1;
|
rc = -1;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
// detach kernel driver if it is active
|
|
||||||
if (libusb_kernel_driver_active(handle, LIGHTPACK_INTERFACE) == 1)
|
|
||||||
{
|
{
|
||||||
error = libusb_detach_kernel_driver(handle, LIGHTPACK_INTERFACE);
|
// detach kernel driver if it is active
|
||||||
|
if (libusb_kernel_driver_active(handle, LIGHTPACK_INTERFACE) == 1)
|
||||||
|
{
|
||||||
|
error = libusb_detach_kernel_driver(handle, LIGHTPACK_INTERFACE);
|
||||||
|
if (error != LIBUSB_SUCCESS)
|
||||||
|
{
|
||||||
|
Error(_log, "unable to detach kernel driver(%d): %s", error, libusb_error_name(error));
|
||||||
|
libusb_close(handle);
|
||||||
|
rc = -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
error = libusb_claim_interface(handle, LIGHTPACK_INTERFACE);
|
||||||
if (error != LIBUSB_SUCCESS)
|
if (error != LIBUSB_SUCCESS)
|
||||||
{
|
{
|
||||||
Error(_log, "unable to detach kernel driver(%d): %s", error, libusb_error_name(error));
|
Error(_log, "unable to claim interface(%d): %s", error, libusb_error_name(error));
|
||||||
|
libusb_attach_kernel_driver(handle, LIGHTPACK_INTERFACE);
|
||||||
libusb_close(handle);
|
libusb_close(handle);
|
||||||
rc = -1;
|
rc = -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
error = libusb_claim_interface(handle, LIGHTPACK_INTERFACE);
|
|
||||||
if (error != LIBUSB_SUCCESS)
|
|
||||||
{
|
|
||||||
Error(_log, "unable to claim interface(%d): %s", error, libusb_error_name(error));
|
|
||||||
libusb_attach_kernel_driver(handle, LIGHTPACK_INTERFACE);
|
|
||||||
libusb_close(handle);
|
|
||||||
rc = -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
*deviceHandle = handle;
|
*deviceHandle = handle;
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
"useEntertainmentAPI": {
|
"useEntertainmentAPI": {
|
||||||
"type": "boolean",
|
"type": "boolean",
|
||||||
"title": "edt_dev_spec_useEntertainmentAPI_title",
|
"title": "edt_dev_spec_useEntertainmentAPI_title",
|
||||||
"default": false,
|
"default": true,
|
||||||
"propertyOrder": 4
|
"propertyOrder": 4
|
||||||
},
|
},
|
||||||
"transitiontime": {
|
"transitiontime": {
|
||||||
|
Loading…
Reference in New Issue
Block a user