Skip to content

Open the mouse before asking whether it's asleep, and retake the screenshots - #22

Merged
packerlschupfer merged 2 commits into
packerlschupfer:mainfrom
f-o-o-g-s:screenshots-sleep-check-open
Oct 14, 2026
Merged

packerlschupfer merged 2 commits into
packerlschupfer:mainfrom
f-o-o-g-s:screenshots-sleep-check-open

Conversation

@f-o-o-g-s

Copy link
Copy Markdown
Contributor

3e6be23's asleep() calls get_power() on the device find_device() hands back, which isn't open yet. On a wireless mouse that raises AttributeError: 'NoneType' object has no attribute 'ctrl_transfer' whether it's awake or not, so the script refuses every time. It now opens and closes the device around the read, the same way the window does for each of its own reads.

Checked on the X3 on the 1K dongle both ways:

  • awake: 8 of 8, and no warning from the end-of-run check
  • asleep (50 s untouched): stopped before the first shot with the driver's "no reply from the mouse ... within 1000 ms", and wrote nothing

Small note on the docstring: on the 1K dongle a sleeping mouse gives that timeout, not a 0xFF reply. It still raises, so the check works either way.

The second commit retakes the set on main with the script as it ships plus this fix, no env tricks. Five pages change: the Customize icon in the sidebar (it was the missing-image box in all of them) and the title bar, now just the close button. The three dialogs came out pixel-identical, so I left them alone. Readings are real again: 1000 Hz, 1600 DPI, 96% signal, battery 85% this time.

asleep() called get_power() on the device find_device() hands back, which
isn't open yet. On a wireless mouse that raised AttributeError ('NoneType'
object has no attribute 'ctrl_transfer') whether it was awake or not, so
the script refused every time. It now opens and closes the device around
the read, the same way the window does for each of its own.

Checked on an X3 on the 1K dongle: awake it took all 8 with no warning at
the end, and asleep (50 s untouched) it stopped before the first shot with
the driver's "no reply from the mouse ... within 1000 ms".
Same X3 on the 1K dongle as a91f0b7, taken on main with the script as it
ships plus the fix above. Five pages change: the Customize icon in the
sidebar, which was the missing-image box in every one of them, and the
title bar, now just the close button. The three dialogs came out
pixel-identical, so they're left alone.
@packerlschupfer
packerlschupfer merged commit 181772d into packerlschupfer:main Oct 14, 2026
1 check passed
packerlschupfer added a commit that referenced this pull request Oct 14, 2026
@f-o-o-g-s's #22 fixed the real bug - the check read the battery on a
device find_device() hands back closed, so it raised on every wireless
mouse whether or not it was asleep.  What's left is the message: an open()
that fails is almost always the udev rules, and "move the mouse to wake it,
or pass --ignore-sleep" is exactly the wrong advice for that, since
--ignore-sleep would then take a full set of empty screenshots.

So the probe reports the two separately, and the unreachable one stops the
run whatever the flags say.
@packerlschupfer

Copy link
Copy Markdown
Owner

Merged, both commits.

Good catch, and a fair one — find_device() handing back a closed device only shows on hardware I don't have. My X2A takes the hasattr(device, 'get_power') exit, so the entire path shipped untested here. A day between writing that check and you finding it broken is a good trade.

One follow-up on top (f110422): an open() that fails now gets its own message. "Move the mouse to wake it, or pass --ignore-sleep" is the wrong advice when the real answer is the udev rules, and --ignore-sleep would then quietly take a full set of empty screenshots — so the unreachable case stops the run whatever the flags say. Your docstring note went in with it: through the dongle it times out rather than answering 0xFF, and either way the driver raises, which is all the check needs.

The retake was the right call too — the script as it ships, no env tricks, is exactly what someone regenerating from scratch should get.

And stepping back: thank you for this whole run. The 1K dongle's battery, charging, link quality and paired-mouse identity; hidraw matched on PID so a dongle can't be mistaken for the mouse next to it; the listener regression I introduced, found and fixed with a CI check that would have caught me; the DPI stage numbering settled on hardware nobody here owns; and the first screenshot set that actually shows the wireless pages. That is a lot of this project's recent surface, and all of it came with the hardware evidence attached. Much appreciated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants