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

Implement the RTC_PARAM_SET 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-set hwclock function accepts aliases for parameters
currently existent (Kernel v5.16). They can be extended later on. As
fallback and for values, hexadecimal (if prefixed with 0x) and decimal
values, as defined in [2], are accepted.

Example:

  $ hwclock --param-set bsm=0x0

[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