christgau / wsdd

A Web Service Discovery host daemon.
MIT License
808 stars 97 forks source link

List also service types #178

Closed ondrejholy closed 5 months ago

ondrejholy commented 1 year ago

I was making some experiments with the socket-based API to see whether it could be used to implement WSDD support for GVfs (see https://gitlab.gnome.org/GNOME/gvfs/-/issues/506). During this, I found out that it would be really useful to list also service types as it would allow us to filter out printers...

christgau commented 11 months ago

Sound doable, but can you explain which XML element of the WSD you are referring to. Is it wsdp:ServiceId as shown here!?

ondrejholy commented 11 months ago

I am away until September, so just a quick reply. I am not sure what is the purpose of wsdp:ServiceId. I don't see that in the debug traces from my devices at all. What I had in my mind, when I was requesting that feature is wsd:Types element, e.g.:

<wsd:Types>wsdp:Device pub:Computer</wsd:Types>
<wsd:Types>wsdp:Device wprt:PrintDeviceType wscn:ScanDeviceType ledm:hpLEDMDeviceType</wsd:Types>

It seems it should be enough to know that it contains the pub:Computer type and it seems to be already stored by the wsdd project as per the types field in the following debug output:

2023-05-09 13:16:12,105:wsdd DEBUG(pid 19547): {'FriendlyName': 'Microsoft Publication Service Device Host', 'FirmwareVersion': '1.0', 'SerialNumber': '20050718', 'Manufacturer': 'Microsoft Corporation', 'ManufacturerUrl': 'http://www.microsoft.com', 'ModelName': 'Microsoft Publication Service', 'ModelNumber': '1', 'ModelUrl': 'http://www.microsoft.com', 'PresentationUrl': 'http://www.microsoft.com', 'types': 'pub:Computer', 'DisplayName': 'foo', 'BelongsTo': 'Workgroup:WORKGROUP'}

But to be honest, I haven't found the exact meaning of that value, it is just my guess based on testing. I need this to find available SMB shares and to filter out printers, scanners and possibly other devices...

ondrejholy commented 9 months ago

I was about to simply change the codes to print also content of the props['types'] variable over the list cmd so I could filter out printers and possibly other devices. However, after reading relevant wsdd codes and specifications, I started thinking about the purpose of the discovery mode in the wsdd project. Currently, e.g. printers are listed, which don't provide any <wsdp:Host> service, just <wsdp:Hosted> services. However, it seems to me that listing those devices without additional info about the endpoints doesn't make much sense. Wouldn't be a solution to list just devices having the <wsdp:Host> section? And maybe just those having the pub:Computer type only. Do even exist devices without that type? What do you think?

Just a note that I have already proposed wsdd backend for the gvfs project that is based on the socket API: https://gitlab.gnome.org/GNOME/gvfs/-/merge_requests/186.

ondrejholy commented 8 months ago

Alternatively, the list cmd could accept the type as a parameter, e.g. list pub:Computer. @christgau, which approach do you prefer?