Repository navigation
Number ioctl commands from DMDRVI_IOCTL_CUSTOM_BASE, answer the rest with -ENOTTY - #37
Merged
Merged
Conversation
dmgpio_dmdrvi_ioctl() switched on (dmgpio_ioctl_cmd_t)command. On arm-none-eabi enums are short (sizeof == 1 here), so the cast kept only the low byte: GCC emits `uxtb` before the jump table. dmdevfs probes every node with DMDRVI_IOCTL_BLOCK_GET_INFO (0x100) and DMDRVI_IOCTL_MONITOR_GET_POLICY (0x200); both became 0 - dmgpio_ioctl_cmd_toggle_pins - so each probe toggled the pins and returned 0, and every GPIO node was reported as a block and a monitor device (a dmdevmon instance and a partition scan per pin). The host build (4-byte enums) never showed it. Switch on the int command instead, and answer anything that is not a dmgpio command with -ENOTTY, as dmdrvi requires, without logging it - dmdevfs asks every node. docs/api-reference.md listed commands dmgpio does not have; it now shows the real dmgpio_ioctl_cmd_t and the return values. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TgkwHQKqf6c4DzypSKzZT7
dmdrvi reserves everything below DMDRVI_IOCTL_CUSTOM_BASE (0x1000) for standard commands - network 0x01.., block 0x100.., monitor 0x200.. - that generic code such as dmdevfs may send to any node. dmgpio numbered its own commands from 0, so 1-4 were also DMDRVI_IOCTL_NET_*: a network probe sent to a GPIO node would have set pins or installed an interrupt handler. dmgpio_ioctl_cmd_t now starts at DMDRVI_IOCTL_CUSTOM_BASE, and every standard command gets -ENOTTY. dmgpio_types.h includes dmdrvi_ioctl.h for the base, so dmgpio_port (whose header includes dmgpio_types.h) links dmdrvi >= 2.0 for its headers too; both pin dmdrvi >= 2.0, the first version with the base. This changes the command values: modules that send dmgpio ioctls (dmsdio, dmspi) must be rebuilt, and the release has to be dmgpio 2.0 so that binaries built against 1.x (which require dmgpio < 2.0) are never paired with it. README and docs/api-reference.md show the real commands and the new numbering. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TgkwHQKqf6c4DzypSKzZT7
Merged
1 of 2 tasks
JohnAmadis
pushed a commit
to choco-technologies/dmsdio
that referenced
this pull request
Sep 29, 2026
dmgpio 2.0 numbers its ioctls from DMDRVI_IOCTL_CUSTOM_BASE (choco-technologies/dmgpio#37), so the card detect read (dmgpio_ioctl_cmd_get_high/low_pins_state) has new values: link dmgpio >= 2.0. This is a build-time requirement only - dmsdio talks to the GPIO through Dmod_Ioctl() on its node, so dmsdio.dmd does not list dmgpio and the board image has to carry dmgpio 2.0 together with this build. DMSDIO_IOCTL_BASE was a literal 0x1000; it is now dmdrvi's DMDRVI_IOCTL_CUSTOM_BASE itself. dmsdio_types.h includes dmdrvi_ioctl.h for it, so dmsdio_port fetches the dmdrvi headers too - in the same, single dmod_link_modules() call as its other modules, because every call rewrites the target's version requirements file. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TgkwHQKqf6c4DzypSKzZT7
4 of 6 tasks
JohnAmadis
pushed a commit
to choco-technologies/dmspi
that referenced
this pull request
Sep 29, 2026
choco-technologies/dmgpio#37 was released as dmgpio 1.1, not 2.0, so dmgpio@>=2.0 could not be resolved and CI had no dmgpio headers. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TgkwHQKqf6c4DzypSKzZT7
JohnAmadis
pushed a commit
to choco-technologies/dmsdio
that referenced
this pull request
Sep 29, 2026
choco-technologies/dmgpio#37 was released as dmgpio 1.1, not 2.0, so dmgpio@>=2.0 could not be resolved and CI had no dmgpio headers. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TgkwHQKqf6c4DzypSKzZT7
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.
Part of choco-technologies/dmod-ecosystem#17. Fixes the misclassified GPIO nodes reported on STM32F746G-DISCO in choco-technologies/dmsdio#2.
Problem
With dmdevfs ≥ 1.1, every GPIO node was reported as both a
monitorand ablockdevice. That meant one dmdevmon instance per pin (~40 on STM32F746G-DISCO, each loggingrefresh failed (-22)) plus a partition scan. On top of that, every probe toggled the pins.dmgpio_dmdrvi_ioctl()switched on(dmgpio_ioctl_cmd_t)command. arm-none-eabi uses short enums (sizeof == 1), so GCC truncates the command to a byte (uxtb r3, r2beforetbb).DMDRVI_IOCTL_BLOCK_GET_INFO(0x100) andDMDRVI_IOCTL_MONITOR_GET_POLICY(0x200) both became0=toggle_pinsand returned 0. A host build (4-byte enums) never shows this.DMDRVI_IOCTL_CUSTOM_BASE(0x1000) for standard commands, which generic code may send to any node. As a result, 1–4 were alsoDMDRVI_IOCTL_NET_*.Fix
dmgpio_ioctl_cmd_tnow starts atDMDRVI_IOCTL_CUSTOM_BASE.dmgpio_types.hincludesdmdrvi_ioctl.h.dmgpio_port.h) linkdmdrvi@>=2.0.switch (command)on theint.-ENOTTYwithout a log entry, as dmdrvi requires. dmdevfs asks every node.docs/api-reference.mdshow the real commands (they listed ones dmgpio does not have), the numbering and the return values.stm32f7 disassembly after the change: only
0x1000..0x1004reach the jump table. Everything else, including0x100/0x200, returns-25=-ENOTTY:Consumers
Across the choco-technologies driver repositories, only two modules send dmgpio ioctls:
dmuart, dmspi, dmfmc and dmeth use dmgpio only for pin muxing in
.iniboard files, and dmeth mentions it only in a comment. None of them needs a rebuild.Test plan
stm32f4/stm32f7builds (the CI matrix) with no warnings. The disassembly shows the new range and the-ENOTTYpath.sizeof(enum) == 1witharm-none-eabi-gcc -mcpu=cortex-m7, anduxtbin the releaseddmdrvi_dmgpio_ioctl.report=all:monitor/block;🤖 Generated with Claude Code
https://claude.ai/code/session_01TgkwHQKqf6c4DzypSKzZT7