[PATCH] specify extreply characters in vendor plugins

Harald Welte laforge at openmoko.org
Tue Jul 31 09:22:52 CEST 2007


On Sun, Jun 03, 2007 at 04:17:52PM +0200, Philipp Zabel wrote:
> Hi,
> 
> this is an updated patch to allow the vendor plugins to specify which
> characters are used to start extended replies.

I was about to add this, but then realised that it would have to be in
both vendor and machine plugin.

Looking at the current code, I think the separation between machine and
vendor plugin has to be re-thought.

I think it still makes sense to e.g. abstract TI-specific commands into some
kind of generic plugin, i.e. what the vendor plugin was supposed to be.

But then, all vendors (including OpenMoko now) hack the firmware to
various degree and ad their own additional commands on top of e.g. the
TI commands.  That's what should be in the machine plugin.

So I think that we will have to end up with something like 'hooks' in
the gsmd core code, and then any plugin can register callback functions
at those hooks.  Part of the callback registration is some priority.

When the code reaches one of those hooks, we iterate over all the
callback functions of that hook, in order of their priority.

Also, machine and vendor plugin can become _technically_ the same
structure, and the difference is just a semantic one.

Furthermore, since every hook would be identified by some constant, we
don't have to add tons and tons of special-case callback functions to
every plugin.

Plugins would register something like 

struct gsmd_hook {
	unsigned int hook;
	unsigned int prio;
	gsmd_hookfn *fn;
};

struct gsmd_hookfn init_setting_hook = {
	.hook	= GSMD_HOOK_INIT_SETTINGS,
	.prio	= 100,
	.fn	= &init_settings,
}

gsmd_register_hookfn(&gsmd_hookfn);

What do you think?
-- 
- Harald Welte <laforge at openmoko.org>          	        http://openmoko.org/
============================================================================
Software for the world's first truly open Free Software mobile phone



More information about the gsmd-devel mailing list