]> git.ipfire.org Git - thirdparty/util-linux.git/commit
hwclock: add --param-get option
authorBastian Krause <bst@pengutronix.de>
Fri, 21 Jan 2022 15:09:35 +0000 (16:09 +0100)
committerKarel Zak <kzak@redhat.com>
Fri, 28 Jan 2022 10:37:47 +0000 (11:37 +0100)
commit6097b12df708a91651972f73cac2984692196073
treeab0d27166dc1302d8ace89983d7b55dcf17412a7
parentee1e12448e1978230de2f7fb11e0a9216b27d788
hwclock: add --param-get option

Implement the RTC_PARAM_GET RTC ioctl in hwclock. The ioctl interface was
introduced with [1], which went mainline in Kernel v5.16. The parameters
are independent of hardware/driver. This means we can read and set
parameters in a generic way.

The new --param-get hwclock function accepts aliases for parameters
currently existent (Kernel v5.16). They can be extended later on. As
fallback, hexadecimal (if prefixed with 0x) and decimal values, as
defined in [2], are accepted.

Example:

  $ hwclock --param-get features

[1] https://lore.kernel.org/all/20211018151933.76865-1-alexandre.belloni@bootlin.com/
[2] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/include/uapi/linux/rtc.h

Signed-off-by: Bastian Krause <bst@pengutronix.de>
bash-completion/hwclock
sys-utils/hwclock-rtc.c
sys-utils/hwclock.c
sys-utils/hwclock.h