[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-devel
Subject:    Re: [PATCH + FEATURE] Automatic notification of hotplugged devices
From:       Jérôme_Lodewyck <lodewyck () clipper ! ens ! fr>
Date:       2005-05-13 21:13:02
Message-ID: 200505132313.02155.lodewyck () clipper ! ens ! fr
[Download RAW message or body]

Le Vendredi 13 Mai 2005 22:47, Kévin Ottens a écrit :
> Le Vendredi 13 Mai 2005 13:02, vous avez écrit :
> > From what I understood, the only reason Edwin calls medianotifier from
> > HALBackend instead of e.g. MediaList::addMedium is that addMedium doesn't
> > know if a medium has been added at startup of mediamanager, or upon
> > physical medium insertion (it would be annoying to have tens of medium
> > insertion notifications at KDE startup, isn't it ?).
>
> We simply need to process differently the first run, and the other
> signals... The MediaList could be fixed... I'll look at it as soon as I
> have some time.
>
> > Most probably, each backend will have to export some "do_notify" property
> > if we want to factorize any notification code.
>
> I'm not sure to understand you correctly... Could you explain a bit more?

Let me summarize the problem :

1/ Which module should handle notifications ?
For sure, it musn't be the backend, as we would write n times the same code.

2/ Which module should decide if the user should be notified or not ?
Currently, the mediamanager has no way to decide this, and that's why
medianotifier is started in HALBackend in Edwin's patch. To solve this 
problem, I can see two alternatives :

        a/ the mediamanager makes the notification decision.
For this purpose, the mediamanager has to infringe on the backend design to 
determine whether a device has been added on startup or not.
A possible implementation of this would be to define member functions in 
BackendBase, (e.g startup_list). (you should have a clearer idea about this, 
since it seems to me that this is what you suggested)
PROS :
        - this factorizes the maximum amount of code & policy
        - this introduces new structures that may be useful in the future

        b/ the backends make the notification decision and advise the 
mediamanager.
When a backend adds a medium, it tells to the mediamanager if the user should 
be notified.
This is _very_ easy to implement, as one just has to add a bool do_notify 
argument to the function MediaList::addMedium (and possibly 
changeMediumState). As far as MediaList and HALBackend are concerned, this is 
almost a one-liner change.
PROS :
        - a notification decision by the backend might make sense. Let's 
imagine we 
would like to use HAL's properties to decide about notification (crazy 
example : notify for memory cards, but not usb sticks...). Also, the 
LinuxCDPolling backend should for sure notify, whereas this is not clear for 
FStabBackend (notification upon device mounting doesn't really make sense...)
        - minimum amount of change

hope I have been understandable this time !

Jérôme
 
>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic