Commit Graph

66 Commits

Author SHA1 Message Date
James Prestwood 69e9945ef7 device: command: remove default device concept
There was quite a bit of framework behind setting/resetting a default
device, which is now no longer needed.
2022-08-11 15:47:20 -05:00
James Prestwood 0b68601c10 client: make COLOR_* macros take a string input
The existing color code escape sequences required the user to set the
color, write the string, then unset with COLOR_OFF. Instead the macros
can be made to take the string itself and automatically terminate the
color with COLOR_OFF. This makes for much more concise strings.
2022-07-07 14:09:03 -05:00
James Prestwood e1d485029b client: update dbus-proxy to use display_table_row 2022-07-07 14:09:03 -05:00
James Prestwood 2c92a5e137 client: support multi-line print for long values
The generic proxy property display was limited to a width for names/value
which makes the output look nice and uniform, but will cut off any values
which are longer than this limit.

This patch adds some logic to detect this, and continue displaying the
value on the next line.

The width arguments were also updated to be unsigned, which allows checking
the length without a cast.
2022-06-29 14:47:22 -05:00
James Prestwood e0613311c2 client: fix crash from unknown properties
The dbus proxy code assumes that every interface has a set of
properties registered in a 'proxy_interface_property' structure,
assuming the interface has any properties at all. If the interface
is assumed to have no properties (and no property table) but
actually does, the property table lookup fails but is assumed to
have succeeded and causes a crash.

This caused iwctl to crash after some properties were added to DPP
since the DPP interface previously had no properties.

Now, check that the property table was valid before accessing it. This
should allow properties to be added to new interfaces without crashing
older versions of iwctl.
2022-06-28 17:49:16 -05:00
James Prestwood 4e61d04e0d client: special case daemon interface for non-interactive
In non-interactive mode, when a dbus method call returns the process
exits. This is true for all methods except agent requests since e.g.
Connect() call automatically requests credentials and the client must
wait for that to return before exiting. The new daemon interface must
also be treated in the same way and not exit.
2021-11-02 16:14:21 -05:00
Tim Kourt df64dd443e client: Rework agent registarion logic
Do agent registration as part of agent manager proxy creation.
This ensures that the registration call is made only after the agent
manager’s interface becomes available on the bus.
2020-02-27 16:30:11 -06:00
Tim Kourt 4fdb6bc9fa client: Reorder interface creation ops
Add the newly created proxy objects into the queue before the
interface specific initialization logic takes place. This way the new
proxy objects can be used within the initialization procedures.
2020-02-27 16:26:32 -06:00
Tim Kourt c32495cf03 client: Fix proxy object's dependency resolution
Previously, the parsing of the OMs objects has been done in one pass,
therefore, the proxy object's dependencies may not have been parsed at the
time when they were looked up for the dependency assignments. Now, the
parsing of the OM objects is done in two passes: 1) Create proxy objects -
one per interface and path, 2) Populate the proxy objects with properties
and assign dependencies. Therefore, we are guaranteed to have the proxy
objects created by the time they are looked up for the dependency
assignments.
2020-02-07 15:24:47 -06:00
Marcel Holtmann 89e476d992 client: Use include path from top source directory 2019-12-13 09:02:42 +01:00
Tim Kourt 4f1c661273 client: Fail in non-interactive mode if iwd service isn’t running
In non-interactive mode request the managed object right away and do
not wait for the service to appear. This way client can fail right
away instead of endlessly waiting in non-interactive mode.
2019-11-08 21:22:37 -06:00
Tim Kourt 13bb8c1afe client: Ignore invalid notifications 2019-10-23 17:44:51 -05:00
Tim Kourt cfa652e9ba client: Treat invalid DBus reply same as an error 2019-10-23 17:44:16 -05:00
Tim Kourt 19529a4d3a client: Don't register agent without a need
Register agent iff no '--dontask' command-line option has been provided
or there are some other command line options besides '--dontask'
2019-09-19 12:36:12 -05:00
Tim Kourt 589f6182b5 client: Set exit status on agent reg. failure 2019-09-02 16:12:37 -05:00
Tim Kourt 6c64016402 client: Make agent registration unconditional 2019-09-02 16:12:37 -05:00
Tim Kourt c806e6a32a client: Don't quit on agent manager's callbacks in non-interactive mode
In non-interactive mode the agent managers' agent registration callback
precede the actual action command's callback such as 'connect'. iwctl
continues execution until anything else besides the agent registration
callback arrives unless the agent registration has failed.
2019-08-15 15:06:59 -05:00
Tim Kourt 13b22b3744 client: Change agent registration scenarios
Previously, agent was registered only for the interactive mode.
This patch enables agent registration in non-interactive mode
taking into consideration the existence of the command-line options.
2019-08-15 15:06:59 -05:00
Tim Kourt 34800bfa63 client: Enable word completion for the SSIDs with spaces
"I--> results in "IWD 1"
2019-07-23 17:20:39 -05:00
Tim Kourt f1dd6b1084 client: Fix network name completion after restart of iwd
Previously, on service disappeared event the list of the known
proxy objects was cleared, but pointers to the default entity
per command family wasn’t reset. Reset default entities for
the command families to remove the dead pointers to the deleted
proxy objects.

==1325== Invalid read of size 8
==1325==    at 0x4055D4: proxy_interface_is_same (dbus-proxy.c:439)
==1325==    by 0x407C28: match_by_partial_name (network.c:220)
==1325==    by 0x40547C: proxy_interface_find_all (dbus-proxy.c:424)
==1325==    by 0x405592: proxy_property_str_completion (dbus-proxy.c:153)
==1325==    by 0x407DA9: network_name_completion (network.c:241)
==1325==    by 0x4E596D5: rl_completion_matches (in /usr/lib64/libreadline.so.7.0)
2019-07-18 23:37:54 -05:00
Tim Kourt f5674a2356 client: Eliminate property_value_options struct
property_value_options is replaced with an array of strings
that represent value options for the properties
2019-04-11 10:53:17 -05:00
Tim Kourt b30b84373d client: Fix property completion mem leak 2019-04-09 00:05:07 -05:00
Tim Kourt bb4f4c8159 client: Remove DBus disconnect message 2019-04-09 00:04:47 -05:00
Denis Kenzior 904d65ce79 client: Get rid of dbus_proxy bind/unbind 2018-09-14 03:47:17 -05:00
Denis Kenzior 48870d0911 client: Expand proxy_property_str_completion
This function now takes an extra argument 'extra_interface'.  When
non-NULL, the property match is furthered filtered by checking whether
the proxy_interface on the given path also contains an interface of type
'extra_interface'
2018-09-14 03:47:17 -05:00
Denis Kenzior f85685c9e4 client: Add proxy_interface_get_path 2018-09-14 03:47:17 -05:00
Denis Kenzior ad13680420 client: dbus-proxy: Relax requirements for find_all
If the function is not provided, assume that we want to match all
proxies of a given interface.
2018-09-14 03:47:17 -05:00
Tim Kourt 9944b7b3b5 client: add noninteractive support into proxy 2018-08-06 12:42:06 -05:00
Tim Kourt 8238ca7fce client: destroy builder on append failure 2018-08-02 20:54:28 -05:00
Tim Kourt a3bc408ae4 client: truncate value string to the column length 2018-08-02 20:54:25 -05:00
Tim Kourt 6ba707fca8 client: add completion for proxy property names and values 2018-07-25 16:05:09 -05:00
Tim Kourt d3742ba651 client: add property setter for proxy
v2: renamed builder_append_value_variant -> append
2018-07-25 15:26:31 -05:00
Tim Kourt 46a188eb39 client: rename property setters
As the local objects are updated from DBus, the new name is more
appropriate for the purpose.
2018-07-25 11:16:54 -05:00
Tim Kourt e71687e901 client: add proxy_interface comparison func. 2018-05-31 19:29:51 -05:00
Tim Kourt 53124e8fff client: abstract the value parameter for completion 2018-05-31 19:29:15 -05:00
Tim Kourt 85a1678147 client: introduce agent 2018-05-03 16:00:23 -05:00
Tim Kourt d1a00d9b34 client: implement agent-manager API 2018-05-03 16:00:23 -05:00
Tim Kourt 9bb19526d9 client: Exclude unnecessary checks
Arrays are guaranteed to be initialized during
the compilation time.
2017-08-23 16:26:05 -05:00
Tim Kourt 02f47a164c client: fix dependency unbind logic 2017-05-19 18:05:16 -05:00
Tim Kourt 006e60d291 client: allow interface search by NULL property 'value' 2017-05-12 17:46:44 -05:00
Tim Kourt 1fed159f4a client: fix leaks 2017-05-12 14:38:03 -05:00
Tim Kourt 8080789d77 client: add properties interface into ignorable list 2017-05-01 16:57:56 -05:00
Tim Kourt 893a0e67b2 client: add subscription for the property updates 2017-05-01 13:46:49 -05:00
Tim Kourt 6a06623b0d client: exclude unicode characters 2017-04-28 13:27:05 -05:00
Tim Kourt 425cb23f98 client: Ops check on destroy 2017-04-26 18:51:45 -05:00
Tim Kourt 5b94af5aab client: display device properties 2017-04-26 18:51:21 -05:00
Tim Kourt e04df7f282 client: cmd argument completion based on properties 2017-04-26 18:48:25 -05:00
Tim Kourt 59a3c848ff client: Change signature of the prop. setters 2017-04-25 17:04:14 -05:00
Tim Kourt 8f632633c1 client: Add NULL check for ops 2017-04-25 12:37:24 -05:00
Tim Kourt 1ef601dcf8 client: Handle failed retrieval of the objects 2017-04-21 15:00:57 -05:00