750D: add PTP handler registration stub - #262
Open
paweltokarz wants to merge 1 commit into
Open
Conversation
Add THUMB_FN(0xfe4196f2, ptp_register_handler) to platform/750D.110/stubs.S. This identifies the Canon firmware function used to add operation handlers to the camera PTP operation list. The added stub lets the existing Magic Lantern PTP code call ptp_register_handler() from the normal ptp_register_all_handlers() path. With CONFIG_PTP and CONFIG_PTP_CHDK enabled, the existing CHDK handler for opcode 0x9999 is registered through Canon's native PTP operation list mechanism. This commit intentionally changes only the 750D.110 platform stub table. It does not modify generic PTP code, the build system, modules, loader behavior, Lua, or any shared source path. Static diagnosis: the function at 0xfe4196f2 reads Canon's PTP operation-list global, returns 0x17 if the list is not initialized, returns 0x03 for a null handler, and inserts operation nodes through the same list structure used by Canon handlers. After boot, the Canon list global is valid and the operation list contains the newly registered 0x9999 node. Build testing: make13 CONFIG_PTP=y CONFIG_PTP_CHDK=y build/cam_complete completed successfully on 750D.110 with Arm GNU Toolchain 13.3.Rel1. The resulting image exports ptp_register_all_handlers, ptp_init, __ptp_handler_0x9999, _ptp_handlers_start/_end, and resolves ptp_register_handler to fe4196f3. Runtime testing on a real EOS 750D / firmware 1.1.0 confirmed that Magic Lantern boots and remains responsive, normal INIT_FUNC-based PTP registration works, CHDK opcode 0x9999 responds, PTP info/version succeeds, GetMemory succeeds, the Canon operation list contains a 0x9999 node, and PTP file upload/download roundtrip in ML/LOGS matches byte-for-byte. Risk is limited to CONFIG_PTP builds for the 750D.110 platform. Baseline non-PTP behavior is unchanged. If the address were wrong, the expected failure mode would be limited to PTP registration on this platform rather than affecting global ML code.
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.
Add THUMB_FN(0xfe4196f2, ptp_register_handler) to platform/750D.110/stubs.S. This identifies the Canon firmware function used to add operation handlers to the camera PTP operation list.
The added stub lets the existing Magic Lantern PTP code call ptp_register_handler() from the normal ptp_register_all_handlers(). With CONFIG_PTP and CONFIG_PTP_CHDK enabled, the existing CHDK handler for opcode 0x9999 is registered through Canon's native PTP operation list mechanism.
This commit intentionally changes only the 750D.110 platform stub table. It does not modify generic PTP code, the build system, modules, loader behavior, Lua, or any shared source path.
Static diagnosis: the function at 0xfe4196f2 reads Canon's PTP operation-list global, returns 0x17 if the list is not initialized, returns 0x03 for a null handler, and inserts operation nodes through the same list structure used by Canon handlers. After boot, the Canon list global is valid and the operation list contains the newly registered 0x9999 node.
Build testing: make13 CONFIG_PTP=y CONFIG_PTP_CHDK=y build/cam_complete completed successfully on 750D.110 with Arm GNU Toolchain 13.3.Rel1. The resulting image exports ptp_register_all_handlers, ptp_init, __ptp_handler_0x9999, _ptp_handlers_start/_end, and resolves ptp_register_handler to fe4196f3.
Runtime testing on a real EOS 750D / firmware 1.1.0 confirmed that Magic Lantern boots and remains responsive, normal INIT_FUNC-based PTP registration works, CHDK opcode 0x9999 responds, PTP info/version succeeds, GetMemory succeeds, the Canon operation list contains a 0x9999 node, and PTP file upload/download roundtrip in ML/LOGS matches byte-for-byte.
Risk is limited to CONFIG_PTP builds for the 750D.110 platform. Baseline non-PTP behavior is unchanged. If the address were wrong, the expected failure mode would be limited to PTP registration on this platform rather than affecting global ML code.