Skip to content

Commit f269268

Browse files
authored
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
1 parent af24e6d commit f269268

File tree

5 files changed

+38
-27
lines changed

5 files changed

+38
-27
lines changed

assets/webconfig/js/content_leds.js

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -750,13 +750,16 @@ $(document).ready(function () {
750750
break;
751751

752752
case "philipshue":
753+
conf_editor.getEditor("root.generalOptions").disable();
754+
753755
var lights = conf_editor.getEditor("root.specificOptions.lightIds").getValue();
754756
hwLedCountDefault = lights.length;
755757
colorOrderDefault = "rgb";
756758
break;
757759

758760
case "yeelight":
759761
conf_editor.getEditor("root.generalOptions").disable();
762+
760763
var lights = conf_editor.getEditor("root.specificOptions.lights").getValue();
761764
hwLedCountDefault = lights.length;
762765
colorOrderDefault = "rgb";
@@ -1070,6 +1073,13 @@ $(document).ready(function () {
10701073
hwLedCount.setValue(lights.length);
10711074
}
10721075
});
1076+
1077+
//Handle Hardware Led Count constraint list
1078+
conf_editor.watch('root.generalOptions.hardwareLedCountList', () => {
1079+
var hwLedCountSelected = conf_editor.getEditor("root.generalOptions.hardwareLedCountList").getValue();
1080+
conf_editor.getEditor("root.generalOptions.hardwareLedCount").setValue(Number(hwLedCountSelected));
1081+
});
1082+
10731083
});
10741084

10751085
//philipshueentertainment backward fix
@@ -1648,7 +1658,9 @@ function updateElements(ledType, key) {
16481658
if (ledProperties && ledProperties.ledCount) {
16491659
if (ledProperties.ledCount.length > 0) {
16501660
var configuredLedCount = window.serverConfig.device.hardwareLedCount;
1651-
updateJsonEditorSelection(conf_editor, 'root.generalOptions', "hardwareLedCount", {}, ledProperties.ledCount, [], configuredLedCount);
1661+
showInputOptionForItem(conf_editor, 'generalOptions', "hardwareLedCount", false);
1662+
updateJsonEditorSelection(conf_editor, 'root.generalOptions', "hardwareLedCountList", {"title": "edt_dev_general_hardwareLedCount_title"},
1663+
ledProperties.ledCount.map(String), [], configuredLedCount);
16521664
}
16531665
}
16541666
break;

config/hyperion.config.json.default

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,9 @@
3737
"cyan" : [0,255,255],
3838
"magenta" : [255,0,255],
3939
"yellow" : [255,255,0],
40-
"gammaRed" : 1.5,
41-
"gammaGreen" : 1.5,
42-
"gammaBlue" : 1.5,
40+
"gammaRed" : 2.2,
41+
"gammaGreen" : 2.2,
42+
"gammaBlue" : 2.2,
4343
"backlightThreshold" : 0,
4444
"backlightColored" : false,
4545
"brightness" : 100,

libsrc/hyperion/schema/schema-color.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@
206206
"required" : true,
207207
"minimum" : 0.1,
208208
"maximum": 100.0,
209-
"default" : 1.5,
209+
"default" : 2.2,
210210
"step" : 0.1,
211211
"propertyOrder" : 15
212212
},
@@ -217,7 +217,7 @@
217217
"required" : true,
218218
"minimum" : 0.1,
219219
"maximum": 100.0,
220-
"default" : 1.5,
220+
"default" : 2.2,
221221
"step" : 0.1,
222222
"propertyOrder" : 16
223223
},
@@ -228,7 +228,7 @@
228228
"required" : true,
229229
"minimum" : 0.1,
230230
"maximum": 100.0,
231-
"default" : 1.5,
231+
"default" : 2.2,
232232
"step" : 0.1,
233233
"propertyOrder" : 17
234234
}

libsrc/leddevice/dev_hid/LedDeviceLightpack.cpp

Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -118,11 +118,11 @@ bool LedDeviceLightpack::init(const QJsonObject &deviceConfig)
118118
QString errortext;
119119
if (_serialNumber.isEmpty())
120120
{
121-
errortext = QString ("No Lightpack devices were found");
121+
errortext = QString ("No working Lightpack devices were found");
122122
}
123123
else
124124
{
125-
errortext = QString ("No Lightpack device found with serial %1").arg( _serialNumber);
125+
errortext = QString ("No working Lightpack device found with serial %1").arg( _serialNumber);
126126
}
127127
this->setInError( errortext );
128128
}
@@ -197,9 +197,6 @@ bool LedDeviceLightpack::searchDevice(libusb_device * device, const QString & re
197197
return false;
198198
}
199199

200-
#define UNO_VENDOR_ID 0x2341
201-
#define UNO_PRODUCT_ID 0x43
202-
203200
if ((deviceDescriptor.idVendor == USB_VENDOR_ID && deviceDescriptor.idProduct == USB_PRODUCT_ID) ||
204201
(deviceDescriptor.idVendor == USB_OLD_VENDOR_ID && deviceDescriptor.idProduct == USB_OLD_PRODUCT_ID))
205202
{
@@ -375,28 +372,30 @@ int LedDeviceLightpack::openDevice(libusb_device *device, libusb_device_handle *
375372
Error(_log, "unable to open device(%d): %s", error, libusb_error_name(error));
376373
rc = -1;
377374
}
378-
379-
// detach kernel driver if it is active
380-
if (libusb_kernel_driver_active(handle, LIGHTPACK_INTERFACE) == 1)
375+
else
381376
{
382-
error = libusb_detach_kernel_driver(handle, LIGHTPACK_INTERFACE);
377+
// detach kernel driver if it is active
378+
if (libusb_kernel_driver_active(handle, LIGHTPACK_INTERFACE) == 1)
379+
{
380+
error = libusb_detach_kernel_driver(handle, LIGHTPACK_INTERFACE);
381+
if (error != LIBUSB_SUCCESS)
382+
{
383+
Error(_log, "unable to detach kernel driver(%d): %s", error, libusb_error_name(error));
384+
libusb_close(handle);
385+
rc = -1;
386+
}
387+
}
388+
389+
error = libusb_claim_interface(handle, LIGHTPACK_INTERFACE);
383390
if (error != LIBUSB_SUCCESS)
384391
{
385-
Error(_log, "unable to detach kernel driver(%d): %s", error, libusb_error_name(error));
392+
Error(_log, "unable to claim interface(%d): %s", error, libusb_error_name(error));
393+
libusb_attach_kernel_driver(handle, LIGHTPACK_INTERFACE);
386394
libusb_close(handle);
387395
rc = -1;
388396
}
389397
}
390398

391-
error = libusb_claim_interface(handle, LIGHTPACK_INTERFACE);
392-
if (error != LIBUSB_SUCCESS)
393-
{
394-
Error(_log, "unable to claim interface(%d): %s", error, libusb_error_name(error));
395-
libusb_attach_kernel_driver(handle, LIGHTPACK_INTERFACE);
396-
libusb_close(handle);
397-
rc = -1;
398-
}
399-
400399
*deviceHandle = handle;
401400
return rc;
402401
}

libsrc/leddevice/schemas/schema-philipshue.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
"useEntertainmentAPI": {
2929
"type": "boolean",
3030
"title": "edt_dev_spec_useEntertainmentAPI_title",
31-
"default": false,
31+
"default": true,
3232
"propertyOrder": 4
3333
},
3434
"transitiontime": {

0 commit comments

Comments
 (0)