https://iandouglasscott.com/2024/12/23/netbsd-pinebook-pro
I guess I can call this blog post done. If nothing else it should be a useful reference for myself in the future.
I wonder how people normally deal with screen brightness on #NetBSD. I assume not *everyone* writes their own small utility in C for it, though that is an appropriately UNIX way of doing things.
Looking at https://github.com/NetBSD/src/commits/trunk/sys/dev/i2c/es8316ac.c, I guess this audio driver hasn't really seen any development since it was added, so it's not really surprising if it doesn't support some things.
The Linux driver has jack detection code that reports to https://www.kernel.org/doc/html//v5.14/sound/soc/jack.html, reading from `ES8316_GPIO_FLAG`. Not sure exactly how it's handled on NetBSD, but the NetBSD HD Audio driver does look like it has jack detection code.
@ids1024 using the brightness keys on your keyboard is the real unix way. Do not reinvent the wheel.
@extrowerk Typically you need to bind the brightness keys for them to do anything. Of course, a full-featuted desktop enviornment has something that does that by default (if it works on NetBSD).
@ids1024 i installed NetBSD onto a pinebook pro by booting from an SD card and then copying the data to the eMMC. i had the same problem you did -- no matter whether i chose eMMC or SD from tow-boot it seemed random which disk would get booted.
what i figured out was that the eMMC and the SD were using the same name for their disklables, and the netbsd bootloader seemed to be using that name when looking for the disk to boot. when i made sure to use a non-default disklabel name in the installer the non-determinism seemed to disappear.
thanks for this write-up. i didn't really investigate the screen brightness so it's useful to see your code. the big feature i'd like to have is some kind of suspend (but given how fast the system boots it's still usable as-is)
@d6 I thought that might be the disk label, though I couldn't figure out exactly how it decided which boot drive to default to.
I guess I forgot to check the UEFI system partition. `/boot/cmdline.txt` has `root=NAME=netbsd-root console=fb`. So yeah, I guess it boots whatever drive it enumerates first with that label.
@ids1024 right, exactly. i forgot that i had looked there but that was what gave me the idea to try changing it.