Hi again Denis..
so , I have now something  that seems to work properly also when SIM is removed/ inserted.

here a the code I've been using;

http://pastebin.com/8VgKrYur

Got as always some question :)

1) The "set_online" function I copied from other drivers but is not never called anyway...i'll tell more..if I enable it the ofono core stucks somewhere..:|
2) seems that if  I set the same virtual com for the service "dev_info"  & "sim"  I got a  crash of the stack...so i put them in 2 different channel of the Mux.
3) ppp works only if when I got DNS & ip
     ifconfig ppp0  <ip>  up
     route add -net 0.0.0.0 ppp0



2013/3/27 Denis Kenzior <denkenz@gmail.com>
Hi Marco,



    enable -> pre_sim, sim_inserted -> post_sim, set_online ->
    post_online.  Generally you do not call set_online before hitting
    the post_sim state.


could I don't  implement set_online if I don't need it?

That would work, if the modem driver does not implement set_online, oFono core automatically transitions to Online after CPIN returns 'READY'.



    <snip>



        I've managing vendor URC for sim detection right now but i have
        problems.For instance if I remove it when ofonod is ready the Hilonc
        sends an URC to notify sim status changed but after that it reboots
        itself(2 sec later)... what i did is to notify the stack that
        the SIM
        has been removed and modem is powered off . I thought that after
        calling
        set_powered fnc the stack should have called my driver virtual
        disable
        function in order to properly close the MUX .. but it's not..


    No, if you call ofono_modem_set_powered(modem, FALSE) it assumes
    that the modem powered off due to an internally generated event
    (e.g. not oFono's doing).  The driver has to clean up properly in
    this case.  The driver disable() method is only called on oFono
    initiated power down requests.


mmh ok..so If the modem restarts it's my business to disable and enable
again all the driver' stuff , right?


If the modem resets, then yes you need to call ofono_modem_set_powered to FALSE.  Booting it back up should not be done in the driver, unless your modem supports so called silent resets.  This is where the modem stack crashes but silently resets itself back to the previous state. (e.g. no PIN entry is required, initialization is very fast). In that case use ofono_modem_reset.

<snip>

Glad I could help ;)

Regards,
-Denis