Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,9 @@ A missing privilege exits with code 9 and the error code `permission_denied` ([d
| `gsdml schema versions` | the GSDML schema versions go-profinet has (1.0 to 2.46) |
| `gsdml schema validate FILE [--version V]` | validation against the schema of the file's version (or `V`) only: structure, simple types and facets, identity constraints, each issue with its line (exit code 7 when it is not valid) |
| `gsdml schema dump FILE [--version V] [--no-validate]` | the typed model of the file as JSON, with the schema's names and JSON numbers and booleans for numeric and boolean types |
| `gsdml modules FILE`, `gsdml submodules FILE` | the module and submodule types, with IO lengths, records and (`submodules`) the API of a submodule of an API other than 0; `modules` also lists, with why, the modules left out of the catalog because they need a configurable submodule |
| `gsdml plan FILE [--dap ID] [--plug SLOT=IDENT]... [--slot N]... [--param-value SLOT:SUBSLOT:INDEX:FIELD=VALUE]... [--param-defaults]` | the parameter records an AR with the same flags writes before PrmEnd, in write order (with the API of a submodule of an API other than 0), built from the file's fields with go-profinet's `PlanParameters`, with the issues of the records and their severity (with `--format table` on stderr); sends nothing (exit code 7 when go-profinet refuses the plan for errors of the records). An AR's `--param` records are not part of the plan |
| `gsdml modules FILE`, `gsdml submodules FILE` | the module and submodule types, with IO lengths, records and (`submodules`) the API of a submodule of an API other than 0; `modules` lists the modules with configurable submodules too, with their number and the IO lengths of their defaults, and apart, with why, those go-profinet cannot place |
| `gsdml config FILE [--dap ID] [--plug SLOT=IDENT]... [--plug-submodule SLOT:SUBSLOT=SUBMODULE]...` | the configuration of a device access point, resolved with go-profinet's `gsdml.Configuration`: each slot (0 is the DAP) with its module and submodules, a configurable submodule marked with its SubmoduleItem ID, and the configurable submodules the DAP and each plugged module can put in their subslots (allowed, fixed and used subslots); `--plug` and `--plug-submodule` change it as for an AR; sends nothing |
| `gsdml plan FILE [--dap ID] [--plug SLOT=IDENT]... [--plug-submodule SLOT:SUBSLOT=SUBMODULE]... [--slot N]... [--param-value SLOT:SUBSLOT:INDEX:FIELD=VALUE]... [--param-defaults]` | the parameter records an AR with the same flags writes before PrmEnd, in write order (with the API of a submodule of an API other than 0), built from the file's fields with go-profinet's `PlanParameters`, with the issues of the records and their severity (with `--format table` on stderr); sends nothing (exit code 7 when go-profinet refuses the plan for errors of the records). An AR's `--param` records are not part of the plan |
| `gsdml generate --model MODEL.json [--output-file FILE\|DIR] [--pnio-version V] [--device-access=false]` | the GSDML file of a go-profinet device model (`--output-file`/`-O`: a file, or a directory for the conventional name; `--pnio-version`: declared PNIO_Version, default V2.35; `--device-access`: declare DeviceAccessSupported, default true) |
| `connect` | establish an AR as IO-Controller and run it: states and alarms are streamed, then a summary; `--slot N` expects only some modules (shared device: another controller owns the rest), `--peer-check PORT=STATION/PORT` has the device watch a port's neighbor, `--mrp-role client\|manager\|off` gives a multiport device its MRP role, `--reparam SLOT:SUBSLOT:INDEX:HEX` re-parameterizes the running AR (PrmBegin … PrmEnd) |
| `ar` | establish an AR and show what Connect negotiated (AR, IOCRs, ModuleDiff) |
Expand All @@ -157,6 +158,8 @@ Every command has `--help`. A device is selected by `--station NAME` (resolved w

`connect`, `ar`, `iocr`, `io` and `alarms` act as IO-Controller (conformance class A, RT_CLASS_1, or RT_CLASS_2 with `--advanced`). They need the expected configuration of the device: its GSDML file (`--gsdml FILE`, with `--dap ID` when it has several device access points), or a go-profinet model in JSON (`--model`). The modules a GSDML file fixes or uses in slots are expected; `--plug SLOT=IDENT` plugs others from its catalog (`gsdml modules` lists them), in a slot the file allows them in (the device access point's `PhysicalSlots` and the module's `AllowedInSlots`); `--plug-any-slot` lifts that, to test how a device answers a module in the wrong slot.

Configurable submodules (a module's or the DAP's `UseableSubmodules`, from the file's `SubmoduleList`) are configured with go-profinet's `gsdml.Configuration`: each is in the subslots the file fixes it in, else uses it in, and `--plug-submodule SLOT:SUBSLOT=SUBMODULE` (repeatable, after `--plug`; slot 0 is the DAP) puts another in a subslot the file allows it in, by its SubmoduleItem ID or by its ident number when only one has it, or with `-` leaves a subslot empty; `gsdml config` shows the configuration and the choices. profinetctl uses the configuration for `--plug-submodule`, for a device access point whose defaults need configurable submodules, and for a `--plug` of a module that has them; otherwise the model is go-profinet's `gsdml.ToModel`, as before. The configuration plugs a module only in a slot the file allows (`--plug-any-slot` is refused with it) and does not replace a module the file fixes in a slot; a subslot the file uses two submodules in by default needs a `--plug-submodule`. Its reading of the subslot attributes is go-profinet's, not checked against PI's specification or an engineering tool.

```console
$ sudo profinetctl -i eth0 connect -s io-rack-1 --gsdml device.xml --plug 3=0x30 \
--output 2:1:00000001 --param 1:1:123:01020304 --duration 10s
Expand Down
73 changes: 73 additions & 0 deletions RELEASE.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,79 @@ ending with a `---` line and no `---` line inside a section

---

## v0.22.0

**Date:** 2026-11-24
**Previous release:** v0.21.0

## Summary

Built on go-profinet v0.24.0, whose `gsdml.Configuration` configures
configurable GSDML submodules (`UseableSubmodules`). `--plug-submodule`
chooses them for an AR and `gsdml plan`, the new `gsdml config` shows a
device access point's configuration and its choices, and the device
access points and modules v0.21.0 refused for configurable submodules
now work with their defaults.

## Changes

### Added

- **`--plug-submodule SLOT:SUBSLOT=SUBMODULE`** (`connect`, the other AR
commands, `gsdml plan`; repeatable, after `--plug`; slot 0 is the
DAP): puts a configurable submodule in a subslot the file allows it in,
by its SubmoduleItem ID or by its ident number when only one submodule
has it, or with `-` leaves the subslot empty.
- **`gsdml config FILE [--dap ID] [--plug ...] [--plug-submodule ...]`**:
the resolved configuration (each slot with its module and submodules, a
configurable submodule marked with its ID) and the configurable
submodules of the DAP and of each plugged module, with the subslots the
file allows, fixes and uses them in. JSON: docs/json-output.md.
- **`gsdml modules`**: `configurable_submodules` per module in JSON,
", N configurable" in text.

### Changed

- **go-profinet v0.24.0** (from v0.23.0).
- **Configurable submodules.** profinetctl builds the model with
go-profinet's `gsdml.Configuration` when `--plug-submodule` is given,
when a device access point's defaults need configurable submodules
(`ToModel` refuses it), and when a `--plug` names a module that has
them; otherwise it is `gsdml.ToModel`'s model, as before. Each
configurable submodule is in the subslots the file fixes it in, else
uses it in. The configuration plugs a module only in a slot the file
allows and does not replace a module the file fixes in a slot.
- **`--gsdml`, `gsdml modules`, `submodules`, `inspect`, `check`**: a
device access point v0.21.0 refused with `unsupported_gsdml` for a
configurable submodule is its default configuration. A default that
needs a choice (two submodules used in one subslot) exits 3 with
`invalid_input` and names the subslot; `gsdml check` reports it as
unvalidated, rule `model`.
- **`gsdml modules`**: a module with configurable submodules is among
the usable modules (its submodules and IO lengths those of its
defaults); `omitted_modules` now holds only the modules go-profinet
cannot place, with why.
- **`--plug` of a module with configurable submodules** plugs it with its
defaults instead of exiting 3 with `unsupported_gsdml`. A slot the file
does not allow, or one with a module the file fixes, is `invalid_input`
(exit 3).

### Breaking

- `--plug-any-slot` with a configuration of configurable submodules exits
2 with `invalid_flag_combination`; it had no such configuration to
apply to before. `--plug-submodule` with `--model` does too.
- `gsdml modules` JSON: modules with configurable submodules move from
`omitted_modules` to `modules`.
- Exit codes and messages for files with configurable submodules change
as above: `unsupported_gsdml` becomes success, or `invalid_input` for a
choice the file does not allow or a default that needs one.

The reading of the subslot attributes is go-profinet's, not checked
against PI's specification or an engineering tool (its LIMITATIONS.md).

---

## v0.21.0

**Date:** 2026-11-24
Expand Down
15 changes: 3 additions & 12 deletions cmd/ar.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ type arOptions struct {
gsdml, dap string
modelFile string
plugs []string
plugSubs []string
plugAnySlot bool
advanced bool
sendClock uint16
Expand Down Expand Up @@ -73,6 +74,7 @@ func addAROptions(c *cobra.Command, o *arOptions) {
f.StringVar(&o.dap, "dap", "", "Device access point ID in the GSDML file (default: the first)")
f.StringVar(&o.modelFile, "model", "", "Expected configuration as a go-profinet model in JSON (instead of --gsdml)")
f.StringArrayVar(&o.plugs, "plug", nil, "Plug the module with this ident number from the GSDML catalog: SLOT=IDENT (repeatable), in a slot the GSDML file allows it in")
f.StringArrayVar(&o.plugSubs, "plug-submodule", nil, plugSubmoduleUsage)
f.BoolVar(&o.plugAnySlot, "plug-any-slot", false, "Let --plug plug a module in a slot the GSDML file does not allow it in (PhysicalSlots, AllowedInSlots), to test how the device answers")
f.BoolVar(&o.advanced, "advanced", false, "Advanced startup with RT_CLASS_2 (instead of legacy startup with RT_CLASS_1)")
f.Uint16Var(&o.sendClock, "send-clock", 32, "SendClockFactor in units of 31.25 µs (32 = 1 ms)")
Expand Down Expand Up @@ -161,21 +163,10 @@ func (o *arOptions) parse() (*parsedAR, error) {
if err := o.checkNumbers(); err != nil {
return nil, err
}
m, doc, err := loadModelDoc(o.gsdml, o.dap, o.modelFile)
m, doc, err := buildModel(o.gsdml, o.dap, o.modelFile, modelChoices{plugs: o.plugs, subs: o.plugSubs, anySlot: o.plugAnySlot})
if err != nil {
return nil, err
}
var rules *slotRules
if doc != nil && !o.plugAnySlot {
rules = slotRulesOf(doc, o.dap)
}
var omitted []omittedModule
if len(o.plugs) > 0 {
omitted = omittedModules(doc, o.dap)
}
if err := plug(m, o.plugs, rules, omitted); err != nil {
return nil, err
}
if m, err = withSlots(m, o.slots); err != nil {
return nil, err
}
Expand Down
Loading
Loading