# XREAL glasses: their head tracking and buttons (hidraw) for whoever sits
# at the seat, so c8 can read where the head points. Before 73-seat-late,
# which turns uaccess into the ACL.
SUBSYSTEM=="hidraw", ATTRS{idVendor}=="3318", TAG+="uaccess"
# While they're plugged in, an Intel GPU isn't let below 650 MHz. A
# glasses frame is short work, so on battery i915 kept the GPU at its
# slowest (300 MHz), each frame took 4 to 7 ms of it and with a video
# playing every fourth one missed its refresh: 72 of 90 a second, 88 with
# this. Unplugged, back to the slowest it has. Other GPUs have no such
# file and are let be.
ACTION=="add", SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", ENV{PRODUCT}=="3318/*", RUN+="/bin/sh -c 'for c in /sys/class/drm/card[0-9]; do [ -w $$c/gt_min_freq_mhz ] && echo 650 > $$c/gt_min_freq_mhz; done; true'"
ACTION=="remove", SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", ENV{PRODUCT}=="3318/*", RUN+="/bin/sh -c 'for c in /sys/class/drm/card[0-9]; do [ -w $$c/gt_min_freq_mhz ] && cat $$c/gt_RPn_freq_mhz > $$c/gt_min_freq_mhz; done; true'"