summaryrefslogtreecommitdiffstats
path: root/sys-utils/rfkill.c
Commit message (Collapse)AuthorAgeFilesLines
* misc: consolidate version printing and close_stdout()Karel Zak2019-04-161-3/+3
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* rfkill: don't use lib/pathKarel Zak2018-06-211-2/+4
| | | | | | It seems like crazy overkill for this trivial purpose. Signed-off-by: Karel Zak <kzak@redhat.com>
* rfkill: add --output-all optionSami Kerola2018-05-031-1/+11
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* rfkill: use scols_column_set_json_type()Karel Zak2018-04-181-1/+8
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* rfkill: include <poll.h> instead of <sys/poll.h>Patrick Steinhardt2018-04-111-1/+1
| | | | | | | | | The POSIX standard states that poll(3P) is being made available by <poll.h>, not <sys/poll.h>. Most commands already include the correct header, with the exception of rfkill. Fix that to avoid a warning on musl-based systems. Signed-off-by: Patrick Steinhardt <ps@pks.im>
* misc: fix typos using codespellRuediger Meier2018-02-161-1/+1
| | | | | | Some more funny typos, please review carefully. Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* rfkill: provide RFKILL_TYPE_FM if undefinedRuediger Meier2018-01-241-0/+5
| | | | | | | | | | As discussed last year it's nice to be compatible to 2.6.32 https://www.spinics.net/lists/util-linux-ng/msg13963.html BTW also re-define NUM_RFKILL_TYPES if needed, although we are not really using it. Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* lib/timeutils: add common ISO timestamp masksJ William Piggott2017-11-101-7/+3Star
| | | | | | | | | | | | | | | | | | | | | | * Start the ISO format flags at bit 0 instead of bit 1. * Remove unnecessary _8601 from ISO format flag names to avoid line wrapping and to ease readability. * ISO timestamps have date-time-timzone in common, so move the TIMEZONE flag to bit 2 causing all timestamp masks to have the first three bits set and the last four bits as timestamp 'options'. * Change the 'SPACE' flag to a 'T' flag, because it makes the code and comments more concise. * Add common ISO timestamp masks. * Implement the ISO timestamp masks in all applicable code using the strxxx_iso() functions. Signed-off-by: J William Piggott <elseifthen@gmx.com>
* rfkill: fix description name typoSami Kerola2017-10-171-1/+1
| | | | | | | Commit 7d2a9960ad made gps to look like a GUID Partition Table. Reviewed-by: Karel Zak <kzak@redhat.com> Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* rfkill: fix typo [coverity scan]Karel Zak2017-10-121-1/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* rfkill: support old "list" outputKarel Zak2017-10-031-45/+114
| | | | | | .. just because we want to be replacement for the original version. Signed-off-by: Karel Zak <kzak@redhat.com>
* rfkill: remove duplicate codeKarel Zak2017-10-031-59/+82
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* rfkill: refactor actionsKarel Zak2017-10-031-20/+65
| | | | | | | * convert action string to ID and use switch() * add note about default output to the man page Signed-off-by: Karel Zak <kzak@redhat.com>
* rfkill: improve default outputKarel Zak2017-10-031-4/+4
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* rfkill: fix coding style and error messagesKarel Zak2017-09-151-7/+7
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* rfkill: do not fsync(3) /dev/rfkill file descriptorSami Kerola2017-09-151-1/+1
| | | | | | | | 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. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* rfkill: allow use of multiple argumentsSami Kerola2017-09-151-28/+45
| | | | | | | | | | | | | | | | 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. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* rfkill: add NFC fallback for old headersKarel Zak2017-08-311-0/+9
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* rfkill: cleanup returnsKarel Zak2017-08-311-20/+20
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* rfkill: add Sami to authorsKarel Zak2017-08-311-0/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* rfkill: cleanup usage()Karel Zak2017-08-311-5/+4Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* rfkill: check id number refers to a device that existsSami Kerola2017-08-301-1/+8
| | | | | | | | | | | | | | | | Earlier all commands happily accepted without detecting failure when none-existing id number was used. For example: $ rfkill block 2017; echo $? 0 The same input after this change looks following. $ rfkill block 2017; echo $? rfkill: invalid identifier: 2017 1 Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* rfkill: use back and forward compatible testSami Kerola2017-08-301-4/+4
| | | | | | | | The rfkill_event struct might grow in future, so ensure the read sizes are at least the minimum, and allow it to be more. Reference: https://github.com/torvalds/linux/blob/master/include/uapi/linux/rfkill.h#L90-L102 Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* rfkill: inform in syslog when rfkill is invokedSami Kerola2017-08-301-0/+10
| | | | | | | | | This should help when trying to explain what or who is flicking wireles on or off. Notice that the change is not perfect - if rfkill command is setting a state that is already set the syslog entry is sent eventhough there was no effective change. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* rfkill: use human readable timestamps in event outputSami Kerola2017-08-301-4/+11
| | | | | | | The event command appears to be something what primarily a developers will to use when debugging. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* rfkill: use libsmartcols outputSami Kerola2017-08-301-63/+203
| | | | | | | This also makes the rfkill to output status when executed without arguments. That is believed ot be more useful than usage() output. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* rfkill: do not ignore read errorSami Kerola2017-08-301-1/+5
| | | | | | | | Read error should be impossible, but when one does happen user certainly wants to know about that rather than see even more strange issue caused random data in name variable. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* rfkill: clarify 'all devices' handlingSami Kerola2017-08-301-21/+22
| | | | | | | | Stop using RFKILL_IS_INVALID a marker when rfkill is iterating over all devices. Addition of RFKIL_IS_ALL should make this a lot easier to digest, especially if reading code in hurry. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* rfkill: make programming style to match util-linux projectSami Kerola2017-08-301-119/+142
| | | | | | | | Use the usual facilities, add translation strings, move global variables at the beginning of the file, make usage() look as expected, add standard command-line option parsing. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* rfkill: make command to build in util-linux projectSami Kerola2017-08-301-4/+7
| | | | | | | After this commit the command merely builds, but does not confirm style used in util-linux project. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* rfkill: move files to appropriate locationsSami Kerola2017-08-301-0/+373
Also remove unnecessary items. Notice that the licence text from COPYING is moved to top of the command in comment section. Signed-off-by: Sami Kerola <kerolasa@iki.fi>