Issues Installing NetBSD on a PineBook Pro
#11
Oh you're not the first to have that dream! Smile
  Reply
#12
I had some spare time today (!) and made a simple script that you might find interesting.

Code:
$ cat ~/s/ModBright

#!/bin/sh

level=`cat ~/.backlightlevel`
level=$(( $level + $1 ))

if [ "$level" -lt "0" ]; then
level=0
fi

if [ "$level" -gt "255" ]; then
level=255
fi

echo $level > ~/.backlightlevel
sudo sysctl -w hw.pwmbacklight0.level=$level

It requires 'sudo' unfortunately. But if you pass a value, it will dim or brighten the backlight. Passing "10" will increase the parameter by 10, passing "-15" will decrease the parameter by 15. I used xbindkeys and bound this script to the Alt comma and Alt period keys:

Code:
$ cat ~/.xbindkeysrc

#Mod4 is the Pine key

"konsole"
Mod4 + F1

"firefox78"
Mod4 + F2

"sh ~/s/ModBright -10"
Alt + comma

"sh ~/s/ModBright 10"
Alt + period

You might prefer to use Mod4 + F1 and Mod4 + F2 (which is Pine + F1 and Pine + F2). As you can see, I did not because I have those in use already. We cannot use Fn + F1 and Fn + F2 because the keyboard firmware returns both keys as the same single key.

I run this as a script at KDE startup, but you could put it in .xinitrc:

Code:
sysctl -n hw.pwmbacklight0.level > ~/.backlightlevel
xbindkeys

Surely there is a better way to do this, but until we get support for whatever the keyboard firmware does, it works. I'm not any kind of Unix guru, and I barely know how to make shell scripts work.
  Reply
#13
(01-24-2021, 12:09 PM)KC9UDX Wrote: Oh you're not the first to have that dream! Smile

Looking forward on the BSD PinePhone Wink
  Reply
#14
@KC9UDX , thanks for sharing that script. It reminds me somewhat of a similar hack I've done with Fluxbox to control MPD and take screenshots using ImageMagick. Though this uses 'aplay' on Linux, it could easily be tweaked to use mixerctl on NetBSD.

With regards to your script requiring sudo, it ought to be possible to edit /etc/sudoers by running 'visudo' on NetBSD and allow NOPASSWD for 'sysctl'. I typically also allow my login to run poweroff/reboot with NOPASSWD too. I haven't yet tried NOPASSWD on BSD but I'd make a high bet it works the same way.
there will be no peace when they release the geese

my homepage
  Reply
#15
I have never tried such a thing, but it seems like that would require the sudo package as well, if it works.
  Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  2nd NetBSD boot goes dark donn 6 1,346 02-22-2024, 03:59 AM
Last Post: KC9UDX
  NetBSD 1.0 runs down battery donn 13 1,111 11-15-2023, 04:05 PM
Last Post: KC9UDX
  Booting NetBSD untitled 12 5,647 08-30-2022, 01:23 AM
Last Post: untitled
  NetBSD on the Pinebook Pro in August 2022 - or not? KC9UDX 6 3,498 08-24-2022, 01:49 AM
Last Post: KC9UDX
  NetBSD and pinebook keyboard/trackpad firmware updater mrgtwentythree 5 9,709 05-16-2021, 07:37 PM
Last Post: mrgtwentythree
  NetBSD Der Geist der Maschine 76 107,819 05-16-2021, 02:43 PM
Last Post: mrgtwentythree
Question OpenBSD 6.7 on Pinebook Pro SKG 27 48,500 05-07-2021, 04:03 PM
Last Post: bigtreeman
Music NetBSD and USB "sound cards" KC9UDX 2 5,176 05-07-2021, 12:11 PM
Last Post: elimark1
  OpenBSD on the pinebook pro e-minguez 5 10,948 04-27-2021, 04:06 AM
Last Post: dreamer_
  PINEBOOK Pro USB-C Docking Deck on FreeBSD S199pWa1k9r 2 4,403 03-04-2021, 01:53 PM
Last Post: Arwen

Forum Jump:


Users browsing this thread: 2 Guest(s)