-
Notifications
You must be signed in to change notification settings - Fork 104
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
D-Bus API for clients? #56
Comments
Sounds interesting. At a first glance I shared oholy's thoughts: a [C] library would be a better idea, but repeating all the stuff (in C/C++) that is already in wsdd appears to be cumbersome. Thus, using wsdd appears to make sense. But it would require users/distros to install wsdd and run it in discovery mode which should be used as single operation mode by default IMO (as long as nothing else is intended). However, this kind of problem might be out my scope 😉 but I assume it has to be considered. And just for the records, I'd also like to add that the discovery mode (searching for other WSD machines) has not been extensively tested. It was implemented as a diagnostic/quick look feature for the local network. Anyways. I like that idea but I have currently no experience in implementing such an API for D-Bus. I've found a tutorial for Python and D-Bus but it appears to be dated (Phyton 2.4). Existing libraries have a strong dependency to Glib which seems to make it hard to other "MainLoop" concepts, or depend on twisted, or have limitations whose impact I am unable to judge. I do not want to refactor the whole code to make it fit into, e.g., Glib's main loop concept and I do not want to introduce a dependency such that the code becomes (much) harder to use on different architectures. IMO, the ideal solution would be connect to dbus, get a file descriptor for that, put that descriptor into a "selector", and handle the traffic on that descriptor accordingly. However, from my quick and sloppy look into the APIs they do not seem to support such an approach. If I'm wrong, just let me know. Putting that technical issue aside: What would the API look like from your side? My first idea: Having an object under |
I haven't looked into a possible implementation, but I'm pretty sure we can find a way to integrate a D-Bus server without overhauling the main loop you already have. That code would actually need some changes, if we're going to have to wait for events on 2 fds rather than just the one, right? I might look at this when I'm in between projects, if nobody beats me to it. Thanks! |
That would be great.
Not really: Lines 1643 to 1646 in 1d3c5f7
Lines 1263 to 1272 in 1d3c5f7
The code is designed to allow multiple FDs to register at the selector. Thus, something like this would work class DBusHandler(object):
def __init__(self, selector):
import some_neat_dbus_library as dbus
self.socket = dbus.createConnection(...)
selector.register(self.socket, selectors.EVENT_READ, self);
def handle_request(self):
""" handle dbus specific stuff """"
# in main
if args.dbus:
DBusHandler(s)
Great. Feel free to create a fork+branch/PR/whatever so we can share work force resources 😉
You're welcome! |
@hadess Is this still needed? I see that @ondrejholy did some awesome work of integrating the discovery mode into GVFS. This is not exactly the same thing that was requested here, but I guess it originates from the same GVFS issue, which has been resolved in the meantime... |
It would definitely be nice to have D-Bus API and use that in gvfs instead of the socket-based API which is a bit cumbersome to use. However, my python knowledge is poor, so I used the already existing socket API for now instead of implementing a new D-Bus API... |
A D-Bus interface would be particularly useful for applications to be able to do service discovery using wsdd. gvfs, the user-space filesystem used by GNOME and others, could use it to find Windows 10 SMB machines on the local network (see https://gitlab.gnome.org/GNOME/gvfs/-/issues/506)
The text was updated successfully, but these errors were encountered: