rfkill: allow use of multiple arguments
PATCH 1/2 rfkill: allow use of multiple arguments
There is no reason why multiple arguments could not be supported.
Most common use case is to do multiple control commands in one go without us of 'all' argument that can cause unnecessary connection breakage. For example someone might want to add to a system initialization following commands.
rfkill block bluetooth uwb wimax wwan gps fm nfc
That will ensure everything but wifi is turned off with as few commands as possible, without killing wifi at any point.
--- sys-utils/rfkill.8 | 18 ++++++++------ sys-utils/rfkill.c | 73 +++++++++++++++++++++++++++++++++--------------------- 2 files changed, 56 insertions(+), 35 deletions(-)
sys-utils/rfkill.8 +11 -7
@@ -4,7 +4,7 @@ rfkill \- tool for enabling and disabling wireless devices .SH SYNOPSIS .B rfkill -.RI [ options ] " command" " [" id | type ] +.RI [ options ] " command" " [" id | type \ ...] .SH OPTIONS .TP \fB\-J\fR, \fB\-\-json\fR
@@ -33,23 +33,25 @@ Display help text and exit. .B event Listen for rfkill events and display them on stdout. .TP -\fBlist \fR[\fIid\fR|\fItype\fR] +\fBlist \fR[\fIid\fR|\fItype\fR ...] List the current state of all available devices. The full list has TYPE and ID columns that one can use to limit the scope. It is a good idea to check with .B list command -.BR id " or " type +.IR id " or " type scope is appropriate before setting .BR block " or " unblock . Special -.B all -type string will match everything. +.I all +type string will match everything. Use of multiple +.IR id " or " type +arguments is supported. .TP -\fBblock \fBid\fR|\fBtype\fR +\fBblock \fBid\fR|\fBtype\fR [...] Disable the corresponding device. .TP -\fBunblock \fBid\fR|\fBtype\fR +\fBunblock \fBid\fR|\fBtype\fR [...] Enable the corresponding device. If the device is hard\-blocked, for example via a hardware switch, it will remain unavailable though it is now soft\-unblocked.
@@ -59,6 +61,8 @@ rfkill list rfkill block all .br rfkill unblock wlan +.br +rfkill block bluetooth uwb wimax wwan gps fm nfc .SH AUTHORS .B rfkill was originally written by
sys-utils/rfkill.c +45 -28
134 lines not on this page · raw message
Signature · 1 line
2.14.1
PATCH 2/2 rfkill: do not fsync(3) /dev/rfkill file descriptor
Attempt to fsync() this device returns EINVAL, causing the rfkill always to return EXIT_FAILURE when either block or unblock is requested. Simply closing the file descriptor will fix the issue.
--- sys-utils/rfkill.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sys-utils/rfkill.c +1 -1
@@ -452,7 +452,7 @@ static int rfkill_block(uint8_t block, const char *param)closelog (); }free (message); -return close_fd (fd); +return close (fd); }static void __attribute__((__noreturn__))usage (void )
Signature · 1 line
2.14.1
Re: [PATCH 2/2] rfkill: do not fsync(3) /dev/rfkill file descriptor
Quoted 2 lines · Sami Kerola
sys-utils/rfkill.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Applied, thanks.
Signature · 2 lines
Karel Zak <[email protected]> http://karelzak.blogspot.com
Quoted 3 lines · Sami Kerola
sys-utils/rfkill.8 | 18 ++++++++------ sys-utils/rfkill.c | 73 +++++++++++++++++++++++++++++++++--------------------- 2 files changed, 56 insertions(+), 35 deletions(-)
Applied, thanks.
Signature · 2 lines
Karel Zak <[email protected]> http://karelzak.blogspot.com