Advice for adding monitor brightness controls to Kodi menus
#16
OK, that's not a proper debug log.  You need to put Kodi into debug mode ( settings -> system settings -> logging ) then quit and restart Kodi (it will remember the setting) and reproduce the error and logfile.  Just from the non-debug log though, it looks as if kodi is trying to open an external player.  A full debug log though will contain a lot more info and show the key/remote presses etc.
Learning Linux the hard way !!
Reply
#17
You might also want a look at this thread: https://forum.kodi.tv/showthread.php?tid=346358

If it turns out to be the command line arguments that are causing your problem, you could make yourself a separate dim.sh and a brighten.sh bash script that can be called without the need for a parameter to be passed from Kodi?
Reply
#18
Ah, sorry, I hope this one is adequate.

https://paste.kodi.tv/zewoyenegu

I pushed the brightness up button at 20:20.
Reply
#19
(2019-11-01, 22:18)Fergus Wrote: You might also want a look at this thread: https://forum.kodi.tv/showthread.php?tid=346358

If it turns out to be the command line arguments that are causing your problem, you could make yourself a separate dim.sh and a brighten.sh bash script that can be called without the need for a parameter to be passed from Kodi?

Thanks for the tip, that sounded very promising, I created scripts and changed the xml file accordingly, but sadly it still fails with the same mysterious messages about the audio system in the log. I even tried commenting the ddcutil commands in the scripts and replacing them with harmless 'echo' commands, but still get the same symptoms.
Reply
#20
Holy cow I made some progress... Scripts plus single quotes around the calls in the keymap file means the keyboard shortcuts now control brightness as intended! Keymap now looks like this:

xml:
<keymap>
  <global>
    <keyboard>
      <key id="61500">System.Exec('/home/osmc/brightnessdn.sh')</key>
      <key id="61502">System.Exec('/home/osmc/brightnessup.sh')</key>
    </keyboard>
  </global>
</keymap>

and each script like this (brightnessup.sh):

Code:
#!/bin/bash
/usr/bin/ddcutil setvcp 10 + 5

However... It's slow, taking half a second or so from button click to action, and ignores button clicks if they are too close together; not ideal for shifting brightness up and down. But this is no different to using ddcutil from the command line so I'm probably stuck with it.

Worryingly each click still dumps dozens of lines of audio information into the log file, so something ugly is obviously happening behind the scenes, but I guess this can be considered a different problem since it occurs regardless of the content of the script. Is this likely to be a problem with OSMC or Kodi? I'm not sure how to pursue it further.
Reply
#21
The garbage with audio in the log seems Kodi problem. Having it too
Reply
#22
Maybe that big delays between button click to action cause by that audio problem in the log.
In that case, maybe the problem would gone if that Exec occurred in python code. For that, we would gonna make an addon.
Only if someone would try to make it..
We already have addon regulating hw parameters, e.g - Audio Mixer. It can be used as reference.
Reply
#23
I doubt I can help much from here on in (out of my depth now), but I'm glad to hear you've made some good progress.  If you want someone more clued up than me to comment on the log file entries however, I'd suggest a fresh log where you enter debug mode before restarting Kodi (your previous log looks show a richer set of debug info only when Debug mode was enabled after Kodi had completed a lot of start-up activities).

As for the laggy nature of the brightness changes, I never really understood whether you wanted fine grained control over the brightness (requiring multiple presses of a brighten/dim button) or simply need to toggle between a couple of known brightness levels for fixed scenarios (e.g. day versus night, room lights on versus room lights off, live TV versus movies, etc.).  Setting the brightness to an absolute value (i.e. without the '+' or '-' argument for relative values) would obviously be smoother than multiple presses on your brighten-it-just-a-little-bit-more button.

Best of luck,

Fergus.
Reply
#24
The lag seems to be coming from the ddcutil code, since it's just as bad when ddcutil is called from the command line. Upping the step from +/-5 to 15 makes it less irritating. The logged audio garbage is troubling, but it doesn't seem to be the culprit in this case. If anyone can add any knowledge of when else these audio dumps occur, maybe I'll raise an issue about it.

In future, perhaps I/someone could create a background python script to decouple the receiving of button clicks and the sending of screen brightness commands, doing each at the maximum rate possible. This would also allow for the brightness steps to be non-linear, which would be handy since +5 at low brightness is a much bigger change than +5 at high brightness, on my monitor at least.

Anyway, that's for a distant parallel future in which I have time to work on stuff like that! Thank you for your help everyone.
Reply
#25
(2019-11-03, 14:08)paulr Wrote: create a background python script to decouple the receiving of button clicks

I think it's a job for addon - not every remote has spare buttons to map these things to, considering it's not required too often.
So same kind of widgets as used for video brightness/contrast would be fine here.
If needed, the addon could provide actions for binding to keys (probably).
Reply
#26
Worth checking if the system is quite as unresponsive when executing the ddcutil command in the background?


/usr/bin/ddcutil setvcp 10 + 15 &
Reply
#27
(2019-11-03, 21:00)Fergus Wrote: Worth checking if the system is quite as unresponsive when executing the ddcutil command in the background?


/usr/bin/ddcutil setvcp 10 + 15 &

No increase in speed, and pressing the button in quick succession a few times caused my monitor to go black for a few nerve-racking minutes until I powered everything down and up again.

I think enabling multiple concurrent calls of ddcutil can cause bad data to be sent over i2c, and is a bad idea, I won't be trying it again!
Reply
#28
The same control as Kodi has for variable seek could help here, I think.
Reply

Logout Mark Read Team Forum Stats Members Help
Advice for adding monitor brightness controls to Kodi menus0