kootenpv / brightml

Convenient Machine-Learned Auto Brightness (Linux)
MIT License
120 stars 4 forks source link

Not reading brightness #13

Closed newtonsart closed 4 years ago

newtonsart commented 4 years ago

It's not reading brightness in ArchLinux + i3. The file you can read the brightness is /sys/class/backlight/intel_backlight/actual_brightness The lowest brightness is 631, and the highest 4882 My laptop is an Asus A53S i5(if you need to know my hardware) Btw, amazing project!!

kootenpv commented 4 years ago

Hey thanks a lot! I am also using arch and i3 - this one should be hardware dependent :)

Does it print an empty list on startup, or do you see it print a BrightnessAdapter?

newtonsart commented 4 years ago

@kootenpv this is the output when I start the program. [BrightnessAdapter(path='/sys/class/backlight/intel_backlight/'), BrightnessAdapter(path='/sys/class/backlight/acpi_video1/'), BrightnessAdapter(path='/sys/class/backlight/acpi_video0/')] OK

newtonsart commented 4 years ago

This is the output when I'm moving from window to window, i keep changing the brightness but it still says that I need to change the brightness

{
    "ambient_light": NaN,
    "battery": 95.95981188542112,
    "datetime_date": "2019-10-10",
    "datetime_full": "2019-10-10 16:04:51+02:00",
    "datetime_hour": 16,
    "datetime_timezone": "UTC+02:00",
    "display_pixel_mean": 6.3073391315799965,
    "display_window_class": "kitty kitty",
    "display_window_name": "lolart@LolArch:~",
    "whereami": "room"
}
Change your brightness to create your first data sample (there is no data found).
{
    "ambient_light": NaN,
    "battery": 95.83155194527576,
    "datetime_date": "2019-10-10",
    "datetime_full": "2019-10-10 16:05:03+02:00",
    "datetime_hour": 16,
    "datetime_timezone": "UTC+02:00",
    "display_pixel_mean": 20.94043193991727,
    "display_window_class": "kitty kitty",
    "display_window_name": "lolart@LolArch:~",
    "whereami": "room"
}
Change your brightness to create your first data sample (there is no data found).
newtonsart commented 4 years ago

If you need this...

[lolart@LolArch]: ~>$ xrandr -q
Screen 0: minimum 320 x 200, current 1366 x 768, maximum 8192 x 8192
LVDS-1 connected primary 1366x768+0+0 (normal left inverted right x axis y axis) 344mm x 194mm
   1366x768      60.00*+
   1280x720      60.00    59.99    59.86    59.74  
   1024x768      60.04    60.00  
   960x720       60.00  
   928x696       60.05  
   896x672       60.01  
   1024x576      59.95    59.96    59.90    59.82  
   960x600       59.93    60.00  
   960x540       59.96    59.99    59.63    59.82  
   800x600       60.00    60.32    56.25  
   840x525       60.01    59.88  
   864x486       59.92    59.57  
   700x525       59.98  
   800x450       59.95    59.82  
   640x512       60.02  
   700x450       59.96    59.88  
   640x480       60.00    59.94  
   720x405       59.51    58.99  
   684x384       59.88    59.85  
   640x400       59.88    59.98  
   640x360       59.86    59.83    59.84    59.32  
   512x384       60.00  
   512x288       60.00    59.92  
   480x270       59.63    59.82  
   400x300       60.32    56.34  
   432x243       59.92    59.57  
   320x240       60.05  
   360x202       59.51    59.13  
   320x180       59.84    59.32  
VGA-1 disconnected (normal left inverted right x axis y axis)
HDMI-1 disconnected (normal left inverted right x axis y axis)
DP-1 disconnected (normal left inverted right x axis y axis)
VGA-1-2 connected (normal left inverted right x axis y axis)
   1024x768      60.00  
   800x600       60.32    56.25  
   848x480       60.00  
   640x480       59.94  
  1024x768 (0x63) 65.000MHz -HSync -VSync
        h: width  1024 start 1048 end 1184 total 1344 skew    0 clock  48.36KHz
        v: height  768 start  771 end  777 total  806           clock  60.00Hz
  800x600 (0x64) 40.000MHz +HSync +VSync
        h: width   800 start  840 end  968 total 1056 skew    0 clock  37.88KHz
        v: height  600 start  601 end  605 total  628           clock  60.32Hz
  800x600 (0x65) 36.000MHz +HSync +VSync
        h: width   800 start  824 end  896 total 1024 skew    0 clock  35.16KHz
        v: height  600 start  601 end  603 total  625           clock  56.25Hz
  640x480 (0x67) 25.175MHz -HSync -VSync
        h: width   640 start  656 end  752 total  800 skew    0 clock  31.47KHz
        v: height  480 start  490 end  492 total  525           clock  59.94Hz
kootenpv commented 4 years ago

Very odd... let's try some debugging.

I am wondering what command your keys are doing (in your i3 config perhaps)?

If your brightness is changed through xrandr then I am pretty sure it will not work.

Do you have the xbacklight command available?

Also can you try the following commands and tell me if they show numbers:

cat /sys/class/backlight/intel_backlight/brightness
cat /sys/class/backlight/acpi_video1/brightness
newtonsart commented 4 years ago
[lolart@LolArch]: ~>$ cat /sys/class/backlight/intel_backlight/brightness
4882
[lolart@LolArch]: ~>$ cat /sys/class/backlight/acpi_video1/brightness
9

I just found out that if i change my brightness using the keyboard, it isnt detecting the change, but it works doing

 echo 10 > /sys/class/backlight/acpi_video0/brightness
kootenpv commented 4 years ago

Yea, I am actually very curious what your button presses are actually doing (since it doesn't affect the files). I think maybe it is using xrandr or something.

So, one thing you could do is rebind the keys (that is not an official solution I think, but I do not understand how to properly fix this)

In my case, in i3, these are my bindings:

bindsym XF86MonBrightnessUp exec "/usr/bin/gmux_backlight +20"
bindsym XF86MonBrightnessDown exec "/usr/bin/gmux_backlight -20"
newtonsart commented 4 years ago

So xbacklight cant work on my laptop because of some kernel issues. I just made some bash scripts to let me change the brightness.

current_brightness=`cat /sys/class/backlight/acpi_video0/brightness`;echo $(($current_brightness-1)) > /sys/class/backlight/acpi_video0/brightness
current_brightness=`cat /sys/class/backlight/acpi_video0/brightness`;echo $(($current_brightness+1)) > /sys/class/backlight/acpi_video0/brightness

Adding this to my i3 config file, and with some custom keys helps me fix this. Sorry for bother you So this fixes my issue.