strip debugging fprintfs and dead Device.Powered path

Drop the diagnostic logs added during adapter/scan/connect
debugging — the wire flow is now well-understood, so the noise
isn't worth keeping. Also delete iwd_device_set_powered (and the
adapter_obj/adapter_proxy fields it relied on); manager.set_powered
goes through Iwd_Adapter directly, so the device-side fallback is
unreachable.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
nemunaire 2026-04-09 11:49:19 +07:00
commit 6bc2975f06
4 changed files with 12 additions and 97 deletions

View file

@ -2,7 +2,6 @@
#include "iwd_dbus.h"
#include "iwd_props.h"
#include "iwd_manager.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@ -62,17 +61,6 @@ iwd_adapter_free(Iwd_Adapter *a)
free(a);
}
static void
_on_set_reply(void *data, const Eldbus_Message *msg, Eldbus_Pending *p EINA_UNUSED)
{
const char *what = data;
const char *en, *em;
if (eldbus_message_error_get(msg, &en, &em))
fprintf(stderr, "e_iwd: %s failed: %s: %s\n", what, en, em);
else
fprintf(stderr, "e_iwd: %s ok\n", what);
}
void
iwd_adapter_set_powered(Iwd_Adapter *a, Eina_Bool on)
{
@ -95,8 +83,7 @@ iwd_adapter_set_powered(Iwd_Adapter *a, Eina_Bool on)
eldbus_message_iter_basic_append(variant, 'b', v);
eldbus_message_iter_container_close(iter, variant);
eldbus_proxy_send(props, msg, _on_set_reply,
on ? "Adapter.Powered=true" : "Adapter.Powered=false", -1);
eldbus_proxy_send(props, msg, NULL, NULL, -1);
/* Keep the props proxy alive on the adapter so the call isn't canceled. */
if (a->_props_proxy_keepalive) eldbus_proxy_unref(a->_props_proxy_keepalive);
a->_props_proxy_keepalive = props;

View file

@ -1,5 +1,4 @@
#include "iwd_dbus.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@ -41,7 +40,6 @@ _emit_managed(Iwd_Dbus *d, Eldbus_Message_Iter *objects)
Eldbus_Message_Iter *props;
if (!eldbus_message_iter_arguments_get(iface_entry, "sa{sv}", &iface, &props))
continue;
fprintf(stderr, "e_iwd: %s :: %s\n", path, iface);
if (d->cbs.iface_added)
d->cbs.iface_added(d->data, path, iface, props);
}
@ -52,19 +50,9 @@ static void
_on_get_managed(void *data, const Eldbus_Message *msg, Eldbus_Pending *pending EINA_UNUSED)
{
Iwd_Dbus *d = data;
const char *errname, *errmsg;
if (eldbus_message_error_get(msg, &errname, &errmsg))
{
fprintf(stderr, "e_iwd: GetManagedObjects error: %s: %s\n", errname, errmsg);
return;
}
if (eldbus_message_error_get(msg, NULL, NULL)) return;
Eldbus_Message_Iter *objects;
if (!eldbus_message_arguments_get(msg, "a{oa{sa{sv}}}", &objects))
{
fprintf(stderr, "e_iwd: GetManagedObjects: failed to parse top-level dict\n");
return;
}
fprintf(stderr, "e_iwd: GetManagedObjects reply received, walking objects\n");
if (!eldbus_message_arguments_get(msg, "a{oa{sa{sv}}}", &objects)) return;
_emit_managed(d, objects);
}

View file

@ -2,7 +2,6 @@
#include "iwd_dbus.h"
#include "iwd_props.h"
#include "iwd_manager.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@ -126,11 +125,9 @@ iwd_device_free(Iwd_Device *d)
{
if (!d) return;
iwd_device_detach_station(d);
if (d->sh_dev_props) eldbus_signal_handler_del(d->sh_dev_props);
if (d->device_proxy) eldbus_proxy_unref(d->device_proxy);
if (d->adapter_proxy) eldbus_proxy_unref(d->adapter_proxy);
if (d->adapter_obj) eldbus_object_unref(d->adapter_obj);
if (d->obj) eldbus_object_unref(d->obj);
if (d->sh_dev_props) eldbus_signal_handler_del(d->sh_dev_props);
if (d->device_proxy) eldbus_proxy_unref(d->device_proxy);
if (d->obj) eldbus_object_unref(d->obj);
free(d->path);
free(d->name);
free(d->address);
@ -139,70 +136,16 @@ iwd_device_free(Iwd_Device *d)
free(d);
}
static void
_log_reply(void *data, const Eldbus_Message *msg, Eldbus_Pending *p EINA_UNUSED)
{
const char *what = data;
const char *en, *em;
if (eldbus_message_error_get(msg, &en, &em))
fprintf(stderr, "e_iwd: %s failed: %s: %s\n", what, en, em);
else
fprintf(stderr, "e_iwd: %s ok\n", what);
}
void
iwd_device_set_powered(Iwd_Device *d, Eina_Bool on)
{
if (!d) return;
Eina_Bool v = on;
/* Toggle the radio at the Adapter level — that's what actually takes
* the interface up/down on modern iwd. Device.Powered is a no-op on
* many installs. Keep the adapter proxy alive on the device so the
* pending property_set isn't canceled. */
if (d->adapter_path && d->obj && !d->adapter_proxy)
{
Eldbus_Connection *conn = eldbus_object_connection_get(d->obj);
d->adapter_obj = eldbus_object_get(conn, IWD_BUS_NAME, d->adapter_path);
if (d->adapter_obj)
d->adapter_proxy = eldbus_proxy_get(d->adapter_obj, IWD_IFACE_ADAPTER);
}
if (d->adapter_proxy)
eldbus_proxy_property_set(d->adapter_proxy, "Powered", "b", &v, _log_reply,
on ? "Adapter.Powered=true"
: "Adapter.Powered=false");
else
fprintf(stderr, "e_iwd: set_powered: no Adapter for %s\n",
d->path ? d->path : "?");
if (d->device_proxy)
eldbus_proxy_property_set(d->device_proxy, "Powered", "b", &v, NULL, NULL);
}
void
iwd_device_scan(Iwd_Device *d)
{
if (!d)
{
fprintf(stderr, "e_iwd: scan: NULL device\n");
return;
}
if (!d->station_proxy)
{
fprintf(stderr, "e_iwd: scan: no Station proxy on %s\n",
d->path ? d->path : "?");
return;
}
eldbus_proxy_call(d->station_proxy, "Scan", _log_reply, "Scan", -1, "");
if (!d || !d->station_proxy) return;
eldbus_proxy_call(d->station_proxy, "Scan", NULL, NULL, -1, "");
}
void
iwd_device_disconnect(Iwd_Device *d)
{
if (!d || !d->station_proxy)
{
fprintf(stderr, "e_iwd: disconnect: missing Station proxy\n");
return;
}
eldbus_proxy_call(d->station_proxy, "Disconnect", _log_reply, "Disconnect", -1, "");
if (!d || !d->station_proxy) return;
eldbus_proxy_call(d->station_proxy, "Disconnect", NULL, NULL, -1, "");
}

View file

@ -31,8 +31,6 @@ struct _Iwd_Device
Eldbus_Object *obj;
Eldbus_Proxy *device_proxy;
Eldbus_Proxy *station_proxy;
Eldbus_Object *adapter_obj;
Eldbus_Proxy *adapter_proxy;
Eldbus_Signal_Handler *sh_dev_props;
Eldbus_Signal_Handler *sh_sta_props;
@ -47,8 +45,7 @@ void iwd_device_apply_station_props(Iwd_Device *d, Eldbus_Message_Iter *props);
void iwd_device_attach_station (Iwd_Device *d);
void iwd_device_detach_station (Iwd_Device *d);
void iwd_device_set_powered(Iwd_Device *d, Eina_Bool on);
void iwd_device_scan (Iwd_Device *d);
void iwd_device_disconnect (Iwd_Device *d);
void iwd_device_scan (Iwd_Device *d);
void iwd_device_disconnect(Iwd_Device *d);
#endif