eiwd/src/iwd/iwd_dbus.h
Pierre-Olivier Mercier d76a77b5b3 Fix critical D-Bus and gadget integration issues
This commit fixes several critical bugs preventing the module from working:

1. Agent D-Bus Object Lifecycle Fix:
   - Keep manager_obj reference alive in IWD_Agent structure
   - Prevents async RegisterAgent call from being canceled
   - Fixes 'Canceled by user' error during agent registration
   - Object is now properly unreferenced during shutdown

2. Signal Handler Cleanup Fix:
   - Don't manually delete signal handlers after object unref
   - eldbus_object_unref() automatically cleans up handlers
   - Prevents 'Eina Magic Check Failed' error on module unload
   - Fixes double-free of signal handlers

3. Gadget Integration Fix:
   - Set gcc->o_base directly to attach icon to gadcon
   - Prevents shelf layout corruption when adding module
   - Proper Enlightenment gadcon integration

4. Agent Path Fix:
   - Use IWD_DAEMON_PATH ('/net/connman/iwd') for AgentManager
   - AgentManager interface is on daemon object, not root
   - Fixes 'No matching method found' error

These fixes resolve:
- Module load/unload crashes
- Shelf disorganization
- Agent registration failures
- D-Bus signal handler corruption

The module should now load cleanly, register the agent successfully,
and unload without errors.
2025-12-28 21:51:41 +07:00

50 lines
1.4 KiB
C

#ifndef IWD_DBUS_H
#define IWD_DBUS_H
#include <Eina.h>
#include <Eldbus.h>
/* iwd D-Bus service and interfaces */
#define IWD_SERVICE "net.connman.iwd"
#define IWD_MANAGER_PATH "/"
#define IWD_DAEMON_PATH "/net/connman/iwd"
#define IWD_MANAGER_INTERFACE "net.connman.iwd.Manager"
#define IWD_ADAPTER_INTERFACE "net.connman.iwd.Adapter"
#define IWD_DEVICE_INTERFACE "net.connman.iwd.Device"
#define IWD_STATION_INTERFACE "net.connman.iwd.Station"
#define IWD_NETWORK_INTERFACE "net.connman.iwd.Network"
#define IWD_KNOWN_NETWORK_INTERFACE "net.connman.iwd.KnownNetwork"
#define IWD_AGENT_MANAGER_INTERFACE "net.connman.iwd.AgentManager"
#define DBUS_OBJECT_MANAGER_INTERFACE "org.freedesktop.DBus.ObjectManager"
#define DBUS_PROPERTIES_INTERFACE "org.freedesktop.DBus.Properties"
/* D-Bus context */
typedef struct _IWD_DBus
{
Eldbus_Connection *conn;
Eldbus_Object *manager_obj;
Eldbus_Proxy *manager_proxy;
Eldbus_Signal_Handler *interfaces_added;
Eldbus_Signal_Handler *interfaces_removed;
Eina_Bool connected;
} IWD_DBus;
/* Global D-Bus context */
extern IWD_DBus *iwd_dbus;
/* Initialization and shutdown */
Eina_Bool iwd_dbus_init(void);
void iwd_dbus_shutdown(void);
/* Connection state */
Eina_Bool iwd_dbus_is_connected(void);
/* Helper to get D-Bus connection */
Eldbus_Connection *iwd_dbus_conn_get(void);
/* Get managed objects */
void iwd_dbus_get_managed_objects(void);
#endif