ofono with local patches/modifications
Go to file
Andres Salomon 34b73ace78 driver callback naming
On Sun, 30 Aug 2009 13:45:45 -0500
Denis Kenzior <denkenz@gmail.com> wrote:

> Hi Andres,
>
> > static struct ofono_modem_driver g1_driver = {
> >         .name = "HTC G1",
> >         .probe = g1_probe,
> >         .enable = g1_enable,
> >         .disable = g1_disable,
> >         .remove = g1_remove,
> >         .populate = g1_populate,
> > };
> >
>
> So the current intention:
> .probe - Detect whether device is really supported by the plugin,
> initialize any data structures specific to the device
> .remove - Destroy data structures
> .enable - Perform power up
> .disable - Perform power down
> .populate - Populate the atoms supported by this device (e.g. netreg,
> voicecall, etc)  This is called by the core after every power cycle,
> when the device is brought up.
>

Thanks!  See patch below.

> >
> > Of course, I'm also wondering why there needs to be two separate
> > layers of calls in the first place.  Why not have drivers register
> > everything from within probe, call ofono_set_powered(modem, TRUE)
> > once the device is ready, and be done with it?
>
> The reason for this is e.g. airplane mode, where you physically want
> to turn off the device.  Another case is for battery / power reasons,
> e.g. a netbook with a USB modem that is not being used.
>

Fair enough.  In the kernel, we have callbacks named suspend/resume
to handle that.

> > The only reason why this doesn't blow up in the generic_at plugin is
> > because the driver_data is leaked.  If one were to free it from
> > generic_at_exit in the wrong place (since it's allocated from
> > generic_at_init, it would make sense to free it in generic_at_exit),
> > one would see the same SEGV/SIGBUS/SIGILL errors upon ctrl-c.
>
> So the leak has now been fixed.
>
> I think you're being unnecessarily harsh here.  To be fair, the
> generic_at driver does something like this at init:

My criticism is simply w/ the naming.  'enable'/'disable' doesn't imply
anything about power.  powerup/powerdown, poweron/poweroff,
suspend/resume would all imply power state changes (at least the latter
would be familiar to those who do kernel stuff).  Having comments that
describe what the callbacks do would also work, though.

>From 80a7b54d52201dfd7d8b590457450ae0a4f72888 Mon Sep 17 00:00:00 2001
From: Andres Salomon <dilinger@collabora.co.uk>
Date: Sun, 30 Aug 2009 15:56:16 -0400
Subject: [PATCH] Add comments to ofono_modem_driver struct

Document what all the callbacks do.
2009-08-30 15:29:59 -05:00
doc Convert to fully non-recursive build system 2009-08-24 23:49:40 -07:00
drivers Rename all files under drivers/isimodem/ 2009-08-25 14:04:42 +03:00
gatchat Fix a problem with CtrlZ echo 2009-08-29 10:47:16 -05:00
gdbus Convert to fully non-recursive build system 2009-08-24 23:49:40 -07:00
gisi gisi: return GPRS interface index/name 2009-08-28 15:20:27 +03:00
include driver callback naming 2009-08-30 15:29:59 -05:00
plugins Fix memory leak in generic_at driver 2009-08-30 13:29:44 -05:00
src Add debug to modem_create 2009-08-30 13:29:44 -05:00
test Enlarge the timeout for phonebook import 2009-08-06 15:42:23 -05:00
unit Convert to fully non-recursive build system 2009-08-24 23:49:40 -07:00
.gitignore Convert to fully non-recursive build system 2009-08-24 23:49:40 -07:00
AUTHORS Mention Yang's contribution 2009-06-18 15:29:05 -05:00
COPYING Initial revision 2009-04-26 20:31:15 +02:00
ChangeLog Release 0.3 2009-08-12 18:00:24 -07:00
HACKING Add development/hacking documentation 2009-05-12 00:32:52 -07:00
INSTALL Initial revision 2009-04-26 20:31:15 +02:00
Makefile.am Rename all files under drivers/isimodem/ 2009-08-25 14:04:42 +03:00
NEWS Initial revision 2009-04-26 20:31:15 +02:00
README Update project description 2009-05-05 21:21:26 -07:00
acinclude.m4 Fix configure script on bash 2.0 2009-08-03 12:32:22 -05:00
bootstrap Initial revision 2009-04-26 20:31:15 +02:00
bootstrap-configure Convert to fully non-recursive build system 2009-08-24 23:49:40 -07:00
configure.ac Convert to fully non-recursive build system 2009-08-24 23:49:40 -07:00

README

oFono - Open Source Telephony
*****************************

Copyright (C) 2008-2009  Intel Corporation. All rights reserved.


Compilation and installation
============================

In order to compile telephony stack you need following software packages:
	- GCC compiler
	- GLib library
	- D-Bus library

To configure run:
	./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var

Configure automatically searches for all required components and packages.

To compile and install run:
	make && make install