Hello Misc. TL;DR: usbhidaction(1) is unveil(2)ed too strictly to run programs.
I'm running: kern.version=OpenBSD 7.1 (GENERIC.MP) #3: Sun May 15 10:27:01 MDT 2022 r...@syspatch-71-amd64.openbsd.org:/usr/src/sys/arch/amd64/compile/GENERIC.MP Complete dmesg at the bottom. I use usbhidaction to make some global mappings for mpd. My usbhidaction.conf looks something like this: /etc/usbhidaction.conf: Consumer:Volume_Increment 1 sndioctl output.level=+0.05 Consumer:Volume_Decrement 1 sndioctl output.level=-0.05 Consumer:Mute 1 sndioctl output.mute=! Consumer:Play/Pause 1 mpc -q toggle Consumer:Scan_Previous_Track 1 mpc -q prev Consumer:Scan_Next_Track 1 mpc -q next Consumer:Random_Play 1 mpc -q random Consumer:Stop 1 mpc -q stop Consumer:Fast_Forward 1 mpc -q seek +10 Consumer:Rewind 1 mpc -q seek -10 ---- The reason for using usbhidaction (as opposed to regular X binds) is that i'm not always running X. My GPU freezes every now and then (amdgpu), so most of the time I'm running X-less. I like those binds to be consistent whether I'm running X or not, basically. On 7.0, ucc(4) was introduced. This driver works for my usb thinkpad kb but not with a home-made with custom firmware. Both work with usbhidaction. 7.0, if I remember correctly, added unveil to usbhidaction, which does its job flawlessly, as in completely blocking access to anything other than its config file, but it also blocks access to any programs configured in it, I think, defeating the point of usbhidaction. The question is then: what's the best approach to solve this? Completely removing usbhidaction's unveil call will decrease security, so I'm sure this is not an option. Unveiling each of the programs named in the config file. This will work for initial setup, but if usbhidaction gets a SIGHUP it won't be able to unveil new programs named in the config file. This in turn forces a restart of the service, defeating the point of reloading. However, it's still an improvement over it not working. Fix my custom kb so it works with ucc. This I will do, as there's obviously something wrong in how I report the keys, but I don't know if there's a way to tell ucc what to do on keypresses. If I have mpd and mpv running, which one should react to it? Can I map this out of X as well? Or, I'm using usbhidaction wrong and I should fix my setup. In which case I'd like some pointers on how to do so. For the time being, I disable ucc on boot and I patched the unveil calls out of usbhidaction. It's working fine and I don't mind a few patches, but I suspect there's a better way to deal with this. Regards. HV ------------------ OpenBSD 7.1 (GENERIC.MP) #3: Sun May 15 10:27:01 MDT 2022 r...@syspatch-71-amd64.openbsd.org:/usr/src/sys/arch/amd64/compile/GENERIC.MP real mem = 8532971520 (8137MB) avail mem = 8257073152 (7874MB) random: good seed from bootblocks mpath0 at root scsibus0 at mpath0: 256 targets mainbus0 at root bios0 at mainbus0: SMBIOS rev. 2.7 @ 0xed530 (58 entries) bios0: vendor American Megatrends Inc. version "F3" date 04/01/2015 bios0: Gigabyte Technology Co., Ltd. 990FXA-UD5 R5 acpi0 at bios0: ACPI 4.0 acpi0: sleep states S0 S3 S4 S5 acpi0: tables DSDT FACP APIC FPDT MCFG HPET SSDT acpi0: wakeup devices SBAZ(S4) P0PC(S4) GEC_(S4) UHC1(S4) UHC2(S4) USB3(S4) UHC4(S4) USB5(S4) UHC6(S4) UHC7(S4) PE20(S4) GBE_(S4) PE21(S4) PE22(S4) PE23(S4) PC02(S4) [...] acpitimer0 at acpi0: 3579545 Hz, 32 bits acpimadt0 at acpi0 addr 0xfee00000: PC-AT compat cpu0 at mainbus0: apid 16 (boot processor) cpu0: AMD FX(tm)-4170 Quad-Core Processor, 4219.97 MHz, 15-01-02 cpu0: FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,MMX,FXSR,SSE,SSE2,HTT,SSE3,PCLMUL,MWAIT,SSSE3,CX16,SSE4.1,SSE4.2,POPCNT,AES,XSAVE,AVX,NXE,MMXX,FFXSR,PAGE1GB,RDTSCP,LONG,LAHF,CMPLEG,SVM,EAPICSP,AMCR8,ABM,SSE4A,MASSE,3DNOWP,OSVW,IBS,XOP,SKINIT,WDT,FMA4,NODEID,TOPEXT,CPCTR,ITSC cpu0: 64KB 64b/line 2-way I-cache, 16KB 64b/line 4-way D-cache, 2MB 64b/line 16-way L2 cache cpu0: ITLB 48 4KB entries fully associative, 24 4MB entries fully associative cpu0: DTLB 32 4KB entries fully associative, 32 4MB entries fully associative cpu0: smt 0, core 0, package 0 mtrr: Pentium Pro MTRR support, 8 var ranges, 88 fixed ranges cpu0: apic clock running at 200MHz cpu0: mwait min=64, max=64, IBE cpu1 at mainbus0: apid 17 (application processor) cpu1: AMD FX(tm)-4170 Quad-Core Processor, 421.85 MHz, 15-01-02 cpu1: FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,MMX,FXSR,SSE,SSE2,HTT,SSE3,PCLMUL,MWAIT,SSSE3,CX16,SSE4.1,SSE4.2,POPCNT,AES,XSAVE,AVX,NXE,MMXX,FFXSR,PAGE1GB,RDTSCP,LONG,LAHF,CMPLEG,SVM,EAPICSP,AMCR8,ABM,SSE4A,MASSE,3DNOWP,OSVW,IBS,XOP,SKINIT,WDT,FMA4,NODEID,TOPEXT,CPCTR,ITSC cpu1: 64KB 64b/line 2-way I-cache, 16KB 64b/line 4-way D-cache, 2MB 64b/line 16-way L2 cache cpu1: ITLB 48 4KB entries fully associative, 24 4MB entries fully associative cpu1: DTLB 32 4KB entries fully associative, 32 4MB entries fully associative cpu1: disabling user TSC (skew=157) cpu1: smt 1, core 0, package 0 cpu2 at mainbus0: apid 18 (application processor) cpu2: AMD FX(tm)-4170 Quad-Core Processor, 421.85 MHz, 15-01-02 cpu2: FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,MMX,FXSR,SSE,SSE2,HTT,SSE3,PCLMUL,MWAIT,SSSE3,CX16,SSE4.1,SSE4.2,POPCNT,AES,XSAVE,AVX,NXE,MMXX,FFXSR,PAGE1GB,RDTSCP,LONG,LAHF,CMPLEG,SVM,EAPICSP,AMCR8,ABM,SSE4A,MASSE,3DNOWP,OSVW,IBS,XOP,SKINIT,WDT,FMA4,NODEID,TOPEXT,CPCTR,ITSC cpu2: 64KB 64b/line 2-way I-cache, 16KB 64b/line 4-way D-cache, 2MB 64b/line 16-way L2 cache cpu2: ITLB 48 4KB entries fully associative, 24 4MB entries fully associative cpu2: DTLB 32 4KB entries fully associative, 32 4MB entries fully associative cpu2: smt 0, core 1, package 0 cpu3 at mainbus0: apid 19 (application processor) cpu3: AMD FX(tm)-4170 Quad-Core Processor, 421.85 MHz, 15-01-02 cpu3: FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,MMX,FXSR,SSE,SSE2,HTT,SSE3,PCLMUL,MWAIT,SSSE3,CX16,SSE4.1,SSE4.2,POPCNT,AES,XSAVE,AVX,NXE,MMXX,FFXSR,PAGE1GB,RDTSCP,LONG,LAHF,CMPLEG,SVM,EAPICSP,AMCR8,ABM,SSE4A,MASSE,3DNOWP,OSVW,IBS,XOP,SKINIT,WDT,FMA4,NODEID,TOPEXT,CPCTR,ITSC cpu3: 64KB 64b/line 2-way I-cache, 16KB 64b/line 4-way D-cache, 2MB 64b/line 16-way L2 cache cpu3: ITLB 48 4KB entries fully associative, 24 4MB entries fully associative cpu3: DTLB 32 4KB entries fully associative, 32 4MB entries fully associative cpu3: smt 1, core 1, package 0 ioapic0 at mainbus0: apid 5 pa 0xfec00000, version 21, 24 pins ioapic1 at mainbus0: apid 6 pa 0xfec20000, version 21, 32 pins acpimcfg0 at acpi0 acpimcfg0: addr 0xe0000000, bus 0-255 acpihpet0 at acpi0: 14318180 Hz acpiprt0 at acpi0: bus 0 (PCI0) acpiprt1 at acpi0: bus 4 (P0PC) acpiprt2 at acpi0: bus 5 (PE20) acpiprt3 at acpi0: bus -1 (PE21) acpiprt4 at acpi0: bus 6 (PE22) acpiprt5 at acpi0: bus -1 (PE23) acpiprt6 at acpi0: bus 1 (PC02) acpiprt7 at acpi0: bus -1 (PC03) acpiprt8 at acpi0: bus -1 (PC04) acpiprt9 at acpi0: bus -1 (PC05) acpiprt10 at acpi0: bus -1 (PC06) acpiprt11 at acpi0: bus -1 (PC07) acpiprt12 at acpi0: bus 2 (PC09) acpiprt13 at acpi0: bus 3 (PC0A) acpiprt14 at acpi0: bus -1 (PC0B) acpiprt15 at acpi0: bus -1 (PC0C) acpiprt16 at acpi0: bus -1 (PC0D) acpipci0 at acpi0 PCI0 com0 at acpi0 UAR1 addr 0x3f8/0x8 irq 4: ns16550a, 16 byte fifo acpicmos0 at acpi0 "pnp0c14" at acpi0 not configured acpibtn0 at acpi0: PWRB acpicpu0 at acpi0: C2(0@100 io@0x815), C1(@1 halt!), PSS acpicpu1 at acpi0: C2(0@100 io@0x815), C1(@1 halt!), PSS acpicpu2 at acpi0: C2(0@100 io@0x815), C1(@1 halt!), PSS acpicpu3 at acpi0: C2(0@100 io@0x815), C1(@1 halt!), PSS cpu0: 4219 MHz: speeds: 4200 4100 3700 2900 2100 1400 MHz pci0 at mainbus0 bus 0 pchb0 at pci0 dev 0 function 0 vendor "ATI", unknown product 0x5a14 rev 0x02 ppb0 at pci0 dev 2 function 0 "ATI SR5690 PCIE" rev 0x00: msi pci1 at ppb0 bus 1 amdgpu0 at pci1 dev 0 function 0 "ATI Polaris 10" rev 0xc7 drm0 at amdgpu0 amdgpu0: msi azalia0 at pci1 dev 0 function 1 vendor "ATI", unknown product 0xaaf0 rev 0x00: msi azalia0: no supported codecs ppb1 at pci0 dev 9 function 0 "ATI SR5690 PCIE" rev 0x00: msi pci2 at ppb1 bus 2 xhci0 at pci2 dev 0 function 0 "VIA VL805 xHCI" rev 0x01: msi, xHCI 1.0 usb0 at xhci0: USB revision 3.0 uhub0 at usb0 configuration 1 interface 0 "VIA xHCI root hub" rev 3.00/1.00 addr 1 ppb2 at pci0 dev 10 function 0 "ATI SR5690 PCIE" rev 0x00: msi pci3 at ppb2 bus 3 ahci0 at pci3 dev 0 function 0 "Marvell 88SE9172 SATA" rev 0x12: msi, AHCI 1.0 scsibus1 at ahci0: 32 targets ahci1 at pci0 dev 17 function 0 "ATI SBx00 SATA" rev 0x40: apic 5 int 19, AHCI 1.2 ahci1: port 0: 6.0Gb/s ahci1: port 1: 6.0Gb/s ahci1: port 2: 6.0Gb/s ahci1: port 3: 6.0Gb/s scsibus2 at ahci1: 32 targets sd0 at scsibus2 targ 0 lun 0: <ATA, KINGSTON SA400S3, S350> naa.50026b768366b930 sd0: 228936MB, 512 bytes/sector, 468862128 sectors, thin sd1 at scsibus2 targ 1 lun 0: <ATA, WDC WD40PURZ-85T, 80.0> naa.50014ee2681cee71 sd1: 3815447MB, 512 bytes/sector, 7814037168 sectors sd2 at scsibus2 targ 2 lun 0: <ATA, WDC WD20EARX-00P, 51.0> naa.50014ee206dc5458 sd2: 1907729MB, 512 bytes/sector, 3907029168 sectors sd3 at scsibus2 targ 3 lun 0: <ATA, WDC WD20EZRZ-00Z, 80.0> naa.50014ee2b84166cd sd3: 1907729MB, 512 bytes/sector, 3907029168 sectors ohci0 at pci0 dev 18 function 0 "ATI SB700 USB" rev 0x00: apic 5 int 18, version 1.0, legacy support ehci0 at pci0 dev 18 function 2 "ATI SB700 USB2" rev 0x00: apic 5 int 17 usb1 at ehci0: USB revision 2.0 uhub1 at usb1 configuration 1 interface 0 "ATI EHCI root hub" rev 2.00/1.00 addr 1 ohci1 at pci0 dev 19 function 0 "ATI SB700 USB" rev 0x00: apic 5 int 18, version 1.0, legacy support ehci1 at pci0 dev 19 function 2 "ATI SB700 USB2" rev 0x00: apic 5 int 17 usb2 at ehci1: USB revision 2.0 uhub2 at usb2 configuration 1 interface 0 "ATI EHCI root hub" rev 2.00/1.00 addr 1 piixpm0 at pci0 dev 20 function 0 "ATI SBx00 SMBus" rev 0x42: SMI iic0 at piixpm0 spdmem0 at iic0 addr 0x52: 4GB DDR3 SDRAM PC3-10600 spdmem1 at iic0 addr 0x53: 4GB DDR3 SDRAM PC3-10600 pciide0 at pci0 dev 20 function 1 "ATI SB700 IDE" rev 0x40: DMA, channel 0 configured to compatibility, channel 1 configured to compatibility azalia1 at pci0 dev 20 function 2 "ATI SBx00 HD Audio" rev 0x40: apic 5 int 16 azalia1: codecs: Realtek ALC1150 audio0 at azalia1 pcib0 at pci0 dev 20 function 3 "ATI SB700 ISA" rev 0x40 ppb3 at pci0 dev 20 function 4 "ATI SB600 PCI" rev 0x40 pci4 at ppb3 bus 4 ohci2 at pci0 dev 20 function 5 "ATI SB700 USB" rev 0x00: apic 5 int 18, version 1.0, legacy support ppb4 at pci0 dev 21 function 0 "ATI SB800 PCIE" rev 0x00 pci5 at ppb4 bus 5 re0 at pci5 dev 0 function 0 "Realtek 8168" rev 0x0c: RTL8168G/8111G (0x4c00), msi, address 40:8d:5c:55:2e:15 rgephy0 at re0 phy 7: RTL8251 PHY, rev. 0 ppb5 at pci0 dev 21 function 2 "ATI SB800 PCIE" rev 0x00 pci6 at ppb5 bus 6 ahci2 at pci6 dev 0 function 0 "Marvell 88SE9172 SATA" rev 0x12: msi, AHCI 1.0 scsibus3 at ahci2: 32 targets ohci3 at pci0 dev 22 function 0 "ATI SB700 USB" rev 0x00: apic 5 int 18, version 1.0, legacy support ehci2 at pci0 dev 22 function 2 "ATI SB700 USB2" rev 0x00: apic 5 int 17 usb3 at ehci2: USB revision 2.0 uhub3 at usb3 configuration 1 interface 0 "ATI EHCI root hub" rev 2.00/1.00 addr 1 pchb1 at pci0 dev 24 function 0 "AMD 15/0xh Link Cfg" rev 0x00 pchb2 at pci0 dev 24 function 1 "AMD 15/0xh Address Map" rev 0x00 pchb3 at pci0 dev 24 function 2 "AMD 15/0xh DRAM Cfg" rev 0x00 km0 at pci0 dev 24 function 3 "AMD 15/0xh Misc Cfg" rev 0x00 pchb4 at pci0 dev 24 function 4 "AMD 15/0xh CPU Power" rev 0x00 pchb5 at pci0 dev 24 function 5 "AMD 15/0xh Host" rev 0x00 usb4 at ohci0: USB revision 1.0 uhub4 at usb4 configuration 1 interface 0 "ATI OHCI root hub" rev 1.00/1.00 addr 1 usb5 at ohci1: USB revision 1.0 uhub5 at usb5 configuration 1 interface 0 "ATI OHCI root hub" rev 1.00/1.00 addr 1 isa0 at pcib0 isadma0 at isa0 pckbc0 at isa0 port 0x60/5 irq 1 irq 12 pckbd0 at pckbc0 (kbd slot) wskbd0 at pckbd0: console keyboard pcppi0 at isa0 port 0x61 spkr0 at pcppi0 usb6 at ohci2: USB revision 1.0 uhub6 at usb6 configuration 1 interface 0 "ATI OHCI root hub" rev 1.00/1.00 addr 1 usb7 at ohci3: USB revision 1.0 uhub7 at usb7 configuration 1 interface 0 "ATI OHCI root hub" rev 1.00/1.00 addr 1 vmm0 at mainbus0: SVM/RVI uhub8 at uhub0 port 1 configuration 1 interface 0 "VIA Labs USB2.0 Hub" rev 2.10/4.20 addr 2 uhidev0 at uhub4 port 5 configuration 1 interface 0 "Logitech Gaming Mouse G502" rev 2.00/3.02 addr 2 uhidev0: iclass 3/1 ums0 at uhidev0: 16 buttons, Z and W dir wsmouse0 at ums0 mux 0 uhidev1 at uhub4 port 5 configuration 1 interface 1 "Logitech Gaming Mouse G502" rev 2.00/3.02 addr 2 uhidev1: iclass 3/0, 17 report ids uhidpp0 at uhidev1 ukbd0 at uhidev1 reportid 1: 8 variable keys, 6 key codes wskbd1 at ukbd0 mux 1 ucc0 at uhidev1 reportid 3: 652 usages, 18 keys, array wskbd2 at ucc0 mux 1 uhid0 at uhidev1 reportid 4: input=1, output=0, feature=0 umodem0 at uhub5 port 5 configuration 1 interface 0 "Arduino LLC USB IO Board" rev 2.00/1.00 addr 2 umodem0: data interface 1, has no CM over data, has break umodem0: status change notification available ucom0 at umodem0 uhidev2 at uhub5 port 5 configuration 1 interface 2 "Arduino LLC USB IO Board" rev 2.00/1.00 addr 2 uhidev2: iclass 3/0, 4 report ids ums1 at uhidev2 reportid 1: 8 buttons, Z dir wsmouse1 at ums1 mux 0 ukbd1 at uhidev2 reportid 2: 8 variable keys, 6 key codes wskbd3 at ukbd1 mux 1 ucc1 at uhidev2 reportid 4: 10 usages, 4 keys, array wskbd4 at ucc1 mux 1 vscsi0 at root scsibus4 at vscsi0: 256 targets softraid0 at root scsibus5 at softraid0: 256 targets root on sd0a (3ad3537e8f630ff7.a) swap on sd0b dump on sd0b amdgpu0: POLARIS10 36 CU rev 0x01 amdgpu0: 1920x1080, 32bpp wsdisplay0 at amdgpu0 mux 1: console (std, vt100 emulation), using wskbd0 wskbd1: connecting to wsdisplay0 wskbd2: connecting to wsdisplay0 wskbd3: connecting to wsdisplay0 wskbd4: connecting to wsdisplay0 wsdisplay0: screen 1-5 added (std, vt100 emulation)