Re: [Bluez-devel] CUPS plugin discovery bits

Johan Hedberg
2007-05-23T16:56:22Z

Hi Bastien,

On May 23, 2007, at 18:26, Bastien Nocera wrote:
> Updated patch attached.

A little about optimizing the device discovery. It seems you are
filtering out all non-printer devices by checking the minor device
class but still requesting names for all found devices (actually hcid
is doing the requesting because you use the normal DiscoverDevices
method).

The name requests are the most time wasting operations of the device
discovery process (if a device happens to go out of range you'll have
to wait usually between 10 and 20 seconds for a page timeout to
occur, and even if it is within range we're talking about several
seconds usually for the name request to succeed). To allow overcoming
this issue have the DiscoverDevicesWithoutNameResolving method which
can be used when you can deduce from the device class information
whether you want to ignore the device or get further information
about it (e.g. its name, provided services through SDP, etc).

So, for the CUPS case, the optimal solution would be to use this
alternate discovery method and for each RemoteDeviceFound signal
check the class of device value and if it matches request the name
for the device (as you were doing in your first patch). This way time
will not go wasted to requesting names for devices we will not do
anything with anyway.

Johan