Repository navigation
fix(capture): skip phones as the camera; hide Scanlight cards until polled - #1773
Open
kurtwindisch wants to merge 3 commits into
Open
kurtwindisch wants to merge 3 commits into
kurtwindisch wants to merge 3 commits into
Conversation
GphotoCamera.open() called Camera().init() without a port, so
libgphoto2 opened the first device on the bus. With an iPhone
connected, NegPy opened the phone as the camera: the Camera dot
turned green and Scan was enabled. A user's log showed six such
sessions ('Apple iPhone 5 (PTP mode)', live view NO, settings NO).
list_cameras() and open() now skip a device whose driver entry is
typed as an audio player (MTP phones and players) or carries
Apple's USB vendor (iPhone and iPad are typed as still cameras).
The capture flag cannot decide: most camera entries lack it,
including the X-T30, X-S10 and the A6000 from marcinz606#621. Over the
libgphoto2 2.5.34 table, the rule skips all 398 phone entries and
keeps every camera entry except two Ricoh Theta 360 cameras in
MTP mode. A model with no entry counts as a camera.
open() points the camera at the chosen port and lets libgphoto2
detect the model there. It picks the device on each retry, so a
body that comes back at a new USB address still opens. A bus with
only a phone fails the open with a message that says so.
Verified in the app: an iPhone is not recognized, and an X-T30 II
connects. make run-sim still connects the simulated camera.
Fixes marcinz606#1772
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The Camera panel started in RGB mode, so the Preset card, Keep Light On and the RGB gate showed for every user until the first connection poll answered. A Fujifilm open takes a few seconds, long enough to click + on a Preset card for a light that is not there. The panel now starts in white-light mode. The first poll decides: a Scanlight shows its cards, and no Scanlight shows the "You can also connect the Scanlight" hint, which stays hidden until then. Verified with make run-sim: the Preset card is hidden before the first poll and shows once the simulated Scanlight answers. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
open() created a libgphoto2 Camera before _pick_device(), so a bus with only a phone left one unused native handle per attempt for the garbage collector. The camera is now created only once a device is picked. Verified with make run-sim: the simulated camera still connects. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Camera scanning opened a connected iPhone as the scanning camera (#1772).
GphotoCamera.open()calledCamera().init()without a port, so libgphoto2 opened the first device on the bus.list_cameras()andopen()skip a device whose libgphoto2 driver entry is typed as an audio player (MTP phones and players) or carries Apple's USB vendor0x05ac(iPhone and iPad are typed as still cameras).open()points the camera at the chosen device's port and lets libgphoto2 detect the model there. It picks the device again on each retry, so a body that comes back at a new USB address still opens.FakeGPand the simulated gphoto module now have port and abilities lists, so tests andmake run-simrun the real path.Scanlight cards at startup
The Camera panel started in RGB mode, so the Preset card, Keep Light On and the RGB gate showed for every user until the first connection poll answered. A Fujifilm open takes a few seconds, and the same reporter could click + on a Preset card with no Scanlight connected. The panel now starts in white-light mode, and the first poll decides. The "You can also connect the Scanlight" hint also waits for that poll.
Why not the capture flag
libgphoto2 sets
GP_OPERATION_CAPTURE_IMAGEonly on entries marked as capture-tested. 753 of 1,129 major-brand camera entries lack it, including the X-T30, X-S10, X-H2S, X100V and the A6000 from #621. Over the full 2.5.34 table, the device-type and vendor rule skips all 398 phone and tablet entries and keeps every camera entry except the Ricoh Theta V and Z1 in MTP mode. A model with no entry counts as a camera.Known limit
An Android phone in PTP ("Transfer photos") mode with no table entry matches the generic "USB PTP Class Camera" entry, and still counts as a camera. Closing that needs an open of the device to read what it reports.
Test plan
make allmake run-simdriver: Scan > Camera connects the simulated camera ("● Camera (USB)")make run-simdriver: the Preset card is hidden before the first poll and shows once the simulated Scanlight answersFixes #1772
🤖 Generated with Claude Code