Skip to content

Commit

Permalink
Merge pull request #173 from nix-community/feat/rmi-touchpad
Browse files Browse the repository at this point in the history
feat: add rmi touchpad support
  • Loading branch information
Mic92 authored Jan 9, 2025
2 parents d06a4dd + d8902a9 commit ca484aa
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions pkg/hwinfo/input.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,8 @@ import (
"fmt"
"log/slog"

"github.com/numtide/nixos-facter/pkg/udev"

"github.com/numtide/nixos-facter/pkg/linux/input"
"github.com/numtide/nixos-facter/pkg/udev"
)

// captureTouchpads scans the input devices and identifies touchpads, returning a slice of HardwareDevice structs or an
Expand All @@ -22,7 +21,6 @@ func captureTouchpads(deviceIdx uint) ([]HardwareDevice, error) {
var result []HardwareDevice //nolint:prealloc

for _, inputDevice := range inputDevices {

path := "/sys" + inputDevice.Sysfs

udevData, err := udev.Read(path)
Expand Down Expand Up @@ -81,6 +79,17 @@ func captureTouchpads(deviceIdx uint) ([]HardwareDevice, error) {
Value: uint16(SubClassMousePs2),
}

case input.BusRmi:
// RMI is a protocol which runs over other physical buses, typically i2c, but it can also be over others
// such as USB or SPI.
// I'm not sure how to map this into hwinfo's bus classification, so for now we will use other for both the
// bus and mouse subclass.
hd.BusType = NewBusID(BusOther)
hd.SubClass = &ID{
Name: SubClassMouseOther.String(),
Value: uint16(SubClassMouseOther),
}

case input.BusPci,
input.BusIsapnp,
input.BusHil,
Expand All @@ -97,7 +106,6 @@ func captureTouchpads(deviceIdx uint) ([]HardwareDevice, error) {
input.BusGsc,
input.BusAtari,
input.BusSpi,
input.BusRmi,
input.BusCec,
input.BusIntelIshtp,
input.BusAmdSfh:
Expand Down

0 comments on commit ca484aa

Please sign in to comment.