Hi Stéphane,

Thanks for your clarifications. There are a couple of things I'm still
unsure about:

On Thu, 2007-06-28 at 10:42 +0200, stephane frenot wrote:
> There are various kind of driver,  one kind corresponds to  bus drivers.
> (pcmcia, usb...)
> The one that registers the low end device is the bus driver. The bus device
> is manually started.

Does this correspond roughly to what the OSGi specs call a "base
driver"? If I understand you correctly, this is something (not
necessarily a service, bundle nor even a program) that knows when a
device is connected to the platform. If it's through the serial port,
then chances are it is some initialization code that reads a
configuration file. If it is on the USB, chances are the base driver can
detect this automatically.

But then, how does this base driver know what device service to install?
Is the base driver supposed to come with service bundles for all kinds
of possible devices that might be connected? Who is responsible for
providing the device service implementations?

Suppose I have a serial port and USB port, to which I can connect two
different printers. As soon as the printers are connected, the base
drivers for each port are supposed to register a Printer device service,
aren't they? And this service will be provided by the same bundle, won't
it? So where does this bundle come from?

> 2) How does the implementation of the WidgetDevice service "know" which
> > driver to use? The SerialWidgetDriver.attach() method takes a
> > ServiceReference as an argument, so there is no way for the driver to
> > tell (say) WidgetServiceImpl "hi, you can use me to access the serial
> > port now". All I see is that the SerialWidget class provides a serial
> > access service to any bundle in the framework, not just to
> > WidgetServiceImpl.
> 
> Each  founded driver is installed. Then the device asks each driver a
> matching  score.  Each drivers answers and the highest answer is selected
> through the attach method.

What you describe sounds like the intuitive way to do it, but the OSGi
specs say that it is a Device Manager that is responsible for calling
the Driver.match() and Driver.attach() methods. So I do not really
understand at what time does the device service object get a reference
to the driver object.

> I mean, this is the normal chain of events as I understand it:
> >
> > - The Force registers a WidgetDevice service with its implementation
> > WidgetServiceImpl.
> >
> > - The DriverLocator finds the SerialWidgetDriver, installs it, matches
> > it against WidgetDevice, and calls the attach() method with a service
> > reference to WidgetDevice as argument.
> 
> 
> It is the device that triggers the matching process

I'm not sure I follow you. It's related to what was said above, but my
understanding is that the installation of a device service (any service
implementing the Device interface, or any service setting the
DEVICE_CATEGORY property) will cause the DeviceManager to start looking
for a driver. So it is not the responsibility of the Device service
object to find a driver, is it?

> I'm not sure to understand the last part. One element to see is that the
> system could continuously look for better drivers. So new driver (with
> better matching method) can be found during run-time.

What I would appreciate is some explanation of the device/driver example
in the specs. As far as I can see, the Device service object is never
"given" a reference to the driver directly.

Or put another way, the example seems to say that the Device service
object will never go looking for a driver, but instead will wait until a
SerialPort service gets registered in the framework---whether by a
driver or by any other bundle. Which sounds strange to me.

Do you know perhaps of any example code of a device/driver pair that I
could have a look at?

Kind regards,
--
--------------------------------------------------
David Lindelöf
Product Developer
Adhoco AG
Technopark
Jagerstrasse 2
8406 Winterhur
tel +41-52-203.2903
mob +41-79-415.6641
fax +41-52-203.2904
e-mail [EMAIL PROTECTED]
url http://www.adhoco.com
weblog http://www.visnet.ch/smartbuildings/
--------------------------------------------------

There's nothing to writing.  All you do is sit at a typewriter and open a vein.
                -- Red Smith

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to