Skip to content

Commit

Permalink
features: add experimental gpio-chardev-support flag
Browse files Browse the repository at this point in the history
Due to limitations imposed by the kernel support, the gpio-chardev interface
is considered experimental and needs experimental.gpio-chardev-support
setting to be enabled in snapd, either explicitly at runtime or through
the defaults section in gadget.yaml.

Signed-off-by: Zeyad Gouda <[email protected]>
  • Loading branch information
ZeyadYasser committed Feb 3, 2025
1 parent 81fd929 commit 7a2b68b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
4 changes: 4 additions & 0 deletions features/features.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ const (
ConfdbControl
// AppArmorPrompting enables AppArmor to prompt the user for permission when apps perform certain operations.
AppArmorPrompting
// GPIOChardevSupport enables experimental gpio-chardev interface.
GPIOChardevSupport

// lastFeature is the final known feature, it is only used for testing.
lastFeature
Expand Down Expand Up @@ -124,6 +126,8 @@ var featureNames = map[SnapdFeature]string{
ConfdbControl: "confdb-control",

AppArmorPrompting: "apparmor-prompting",

GPIOChardevSupport: "gpio-chardev-support",
}

// featuresEnabledWhenUnset contains a set of features that are enabled when not explicitly configured.
Expand Down
3 changes: 3 additions & 0 deletions features/features_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ func (*featureSuite) TestName(c *C) {
check(features.Confdbs, "confdbs")
check(features.ConfdbControl, "confdb-control")
check(features.AppArmorPrompting, "apparmor-prompting")
check(features.GPIOChardevSupport, "gpio-chardev-support")

c.Check(tested, Equals, features.NumberOfFeatures())
c.Check(func() { _ = features.SnapdFeature(1000).String() }, PanicMatches, "unknown feature flag code 1000")
Expand Down Expand Up @@ -104,6 +105,7 @@ func (*featureSuite) TestIsExported(c *C) {
check(features.Confdbs, true)
check(features.ConfdbControl, false)
check(features.AppArmorPrompting, true)
check(features.GPIOChardevSupport, false)

c.Check(tested, Equals, features.NumberOfFeatures())
}
Expand Down Expand Up @@ -229,6 +231,7 @@ func (*featureSuite) TestIsEnabledWhenUnset(c *C) {
check(features.Confdbs, false)
check(features.AppArmorPrompting, false)
check(features.ConfdbControl, false)
check(features.GPIOChardevSupport, false)

c.Check(tested, Equals, features.NumberOfFeatures())
}
Expand Down

0 comments on commit 7a2b68b

Please sign in to comment.