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
  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
  PINEBOOK Pro USB-C Docking Deck on FreeBSD S199pWa1k9r 0 43 Yesterday, 02:07 AM
Last Post: S199pWa1k9r
  NetBSD and pinebook keyboard/trackpad firmware updater mrgtwentythree 4 1,828 01-19-2021, 06:02 PM
Last Post: KC9UDX
  NetBSD -Current binaries BronzeBeard 8 1,030 12-31-2020, 08:38 PM
Last Post: BronzeBeard
Thumbs Up My NetBSD on Pinebook Pro journey KC9UDX 11 4,967 12-06-2020, 08:26 PM
Last Post: KC9UDX
  NetBSD Der Geist der Maschine 75 31,521 12-06-2020, 03:02 AM
Last Post: KC9UDX
Music NetBSD and USB "sound cards" KC9UDX 0 655 10-24-2020, 04:04 AM
Last Post: KC9UDX
Question OpenBSD 6.7 on Pinebook Pro SKG 26 15,137 07-04-2020, 12:49 AM
Last Post: tdc
  OpenBSD on the pinebook pro e-minguez 4 3,445 03-21-2020, 05:07 PM
Last Post: nohandlebars

Forum Jump:


Users browsing this thread: 1 Guest(s)