Skip to content

Deprecate [EMCIO]DB_PROGRAM: unify tool data on one interface #4535

Description

@grandixximo

At the 2026-09 dev meeting, removal of the tool database interface ([EMCIO]DB_PROGRAM) was proposed. It has active users (#4422, #4408), so a straight removal is off the table. This issue is to hash out what unification looks like instead. The shape below is a starting point, not a settled plan, and I do not have bandwidth to drive it (multiaxis and TP work ongoing), so: comments on the shape welcome, and if you want to own any of it, please say so.

What db_program does that the tool table file cannot

  1. Custom per-tool schema (diameter, tooth count, usage hours, grade) in an external database.
  2. Load/unload event stream, for tool usage tracking.
  3. Dynamic tool-number => pocket resolution at load time.

Everything else duplicates what the tool table file plus the existing Python/NML interface already provides. Note the event stream is coarse: only load/unload and offset puts. Spindle on/off and motion are not part of the protocol, so real cutting-time or cutting-distance tracking already requires the db program to watch HAL itself.

Proposal (draft shape)

Keep one canonical in-core tool table, one persistence mechanism (the file), and standard status/HAL as the observation interface, the same pattern as the rest of LinuxCNC:

  1. Add a tool-data-changed notification usable from userspace (a HAL pin or stat field, an epoch counter bumped on any tool data change). Today an external app can observe load/unload via iocontrol pins but has no way to learn about G10 offset changes without polling. This looks like the only real capability gap, but I may be missing others.
  2. Separately, pursue an extended tool data model (standardized diameter/tooth-count style fields visible to all GUIs). That is the actual feature most db_program users seem to be after (ref Feature Request: add fields to tool table #4408), and it shrinks the remaining reasons to run an external db program.
  3. Once 1 and 2 land, deprecate DB_PROGRAM with a migration recipe: a short example Python script using the linuxcnc module plus HAL that reproduces the usage-tracking pattern.

Open questions

  • Is the capability list above complete? Anyone using db_program for something it does not cover?
  • Is the epoch/notification pin the right mechanism, or is there a better fit (NML status, a message channel)?
  • Should the extended tool data model block deprecation, or can they proceed independently?

Non-goals

  • No change to the tool table file format as part of this issue.
  • No removal before a replacement recipe exists and at least one release cycle of deprecation notice.

Future ideas

  • Per-tool cutting stats: a userspace HAL watcher could integrate feed motion while the spindle is on (pins exist today: motion.current-vel, spindle.0.on, iocontrol tool pins) and accumulate per-tool cut distance, average feed, and usage hours. This subsumes the "operating hours" use case the db_program docs describe, with no core changes needed.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions