Ticket #1003 (closed defect: fixed)

Opened 11 years ago

Last modified 2 years ago

GSM modem is not powered down when Linux is shut down

Reported by: mwester@… Owned by: mickeyl
Priority: high Milestone:
Component: gsmd Version: 2007.2
Severity: normal Keywords:
Cc: buglog@…, balrogg@…, tick@…, emreturkay@…, willie_chen@… Blocked By:
Blocking: Estimated Completion (week):
HasPatchForReview: PatchReviewResult:
Reproducible:

Description

The GSM modem on the GTA01 is wired on the upstream side of the power management
chip. Furthermore, the GSM modem does not power off based on any external
signal, rather it needs to sent the AT@POFF command.

The attached shutdown script resets the modem (carefully, so as to avoid locking
up the kernel, or filling up buffers with infinitely echoed characters, or other
known GSM/serial interactions known to be potentially problematic on the GTA01.)

(The submitter of this script thinks that placing this logic into the "stop"
portion of /etc/init.d/gsmd is cleaner, and more appropriate. However, it is
implemented as a separate shutdown script on the advice of roh, so as to allow
one to shut down gsmd using the /etc/init.d/gsmd script without powering off the
modem. Either way works.)

Attachments

03_modem_power_on_off.patch (5.9 KB) - added by sean_chiang@… 11 years ago.
Adding api for powe on/off GSM modem
K34modem (424 bytes) - added by sean_chiang@… 11 years ago.
/etc/rc0.d/K34modem
atpoff (1.0 KB) - added by mwester@… 11 years ago.
/etc/rc0.d/K36atpoff
K36atpoff (4.0 KB) - added by mwester@… 11 years ago.
/etc/rc0.d/K36atpoff (updated, and with debug statements)

Change History

comment:1 Changed 11 years ago by tick@…

  • Owner changed from laforge@… to sean_chiang@…

comment:2 Changed 11 years ago by sean_chiang@…

  • Status changed from new to assigned

comment:3 Changed 11 years ago by sean_chiang@…

I had tried this and there would be two problems with this script. First, the
later GSM firmware will fall into sleep mode, so we could not make sure if
"echo AT@POFF" is successful or not each time. Besides each machine should have
its specific power management so I think this part should be done in machine
plugin within gsmd. Second, "echo 0 > power_on" will cause kernel panic right
now, I still have no idea why. Actually, we don't need to do that , when system
power off, the pin will still be pulled low.

comment:4 Changed 11 years ago by mwester@…

I cannot comment on the "sleep mode", but I vehemently disagree that this
power-off should be in gsmd. This is a phone, not a desktop device with
outboard peripherals with separate power supplies. When the user turns off the
phone, they expect that the GSM modem is also powered off, regardless of who
(gsmd or other) turned it on. Even if it was turned on by gsmd, gsmd has a
distressing tendency to segfault, which would end up leaving the modem turned on
as well. In fact, I argue that this power-off should be part of the kernel's
serial port power-off code, so that even if user-space is so totally botched
that no scripts can run, at least an effort is made to power-off the GSM modem.

Regarding the crashes, that sounds a lot like #788 to me - can you test if
one of the resolutions listed therein works, and if so, I guess #788 should
be associated with this one.

comment:5 Changed 11 years ago by sean_chiang@…

  • Owner changed from sean_chiang@… to sean_chiang@…
  • Status changed from assigned to new

comment:6 Changed 11 years ago by tick@…

  • Cc tick@… added

comment:7 Changed 11 years ago by tick@…

  • Status changed from new to assigned

Changed 11 years ago by sean_chiang@…

Adding api for powe on/off GSM modem

Changed 11 years ago by sean_chiang@…

/etc/rc0.d/K34modem

comment:8 Changed 11 years ago by sean_chiang@…

  • Status changed from assigned to closed
  • Resolution set to fixed

Adding new api for power on/off modem in gsmd. With this patch and the script
when system is shut down, GSM modem off too. For NEO, you need to confirm that
if the firmware support AT@POFF or not first.

comment:9 Changed 11 years ago by mwester@…

  • Status changed from closed to reopened
  • Resolution fixed deleted

The API for power on/off the GSM modem using gsmd is a necessary feature, but it
does not really resolve the issue reported by this bug. Specifically, the patch
and the K34modem script will *ONLY* accomplish the desired end effect *IFF* gsmd
is running.

The principle of least surprise requires that the system make every effort to
power off the GSM modem at shutdown, especially when that shutdown is due to the
failure or abnormal behavior of the software on the device. It is quite
reasonable and rational for a user to assume that if they were able to initiate
a power-off, and that the screen went blank, that the phone is truly *OFF*. By
making the power-off dependent upon gsmd, we really haven't solved this problem
for any of the cases where gsmd has failed, or if gsmd has lost communications
with the modem, or any of a huge number of failure modes.

I applaud the addition of the power-off ability to gsmd, but I think gsmd cannot
be trusted in the event that the user powers off the phone because of some sort
of problem with the phone's behavior.

I remain firmly convinced that at shutdown, we must:
A) Reset the modem
B) issue the AT@POFF command
and do so with as little reliance on external processes, libraries, and
especially daemons as is possible, as we simply cannot assume that those things
are available or functional at shutdown.

comment:10 Changed 11 years ago by balrogg@…

  • Cc balrogg@… added

comment:11 Changed 11 years ago by tick@…

K36atpoff is a good example to turn off the GSM modem.
But there are some problems:

  1. There is a bug in kernel, and that may make the system hang while pulling pin.
  2. "echo -e "AT@POFF\r" >$GSM_DEV" is not a reliable way to send command to modem.

In our experiments, it is not as stable as we expected.

  1. It will reset the GSM modem before turning it off (not good in flying mode case.)

In K34modem there are still some problems:

  1. GSMD has to be work when running K34modem

In my experiments it shows that K34modem has the following advantages:

  1. It can reliably and stably turn off the modem *IFF* GSMD works well.
  2. It avoid to touch the kernel bug that hangs the whole system.
  3. It will automatically failed and do nothing in "flying mode" (if implement in

the future)

Here comes out a potential assumption, GSMD has to be alive when K34modem runs.
Is this logical?
I think it ok, though not very ideal.

  1. We can write a new program to turn off the GSM firmware stably and reliably. But since we have GSMD and libgsmd-tools that can do the same thing, why not

take good use of it? And save the space of rootfs?

All we have to do is allow gsmd not been killed at this moment.

  1. As for the those conditions that system device failure (or GSMD terribly

failed ), in these cases system should reboot but not shutdown.

In my opinion

  • GSMD has be stable enough to work normally to the end. (This is another issue. )

Using GSMD to turn the modem off is not a bad choice.
Or if you can use "cu" or some other stable way to turn the GSM modem off, is
also a good choice.

  • K35modem take good usage of shutting down system will automatically pull down

the pin without hang the whole system. So the kernel's bug (It's also another
issue.) will not be a blocker to this case.

  • Even more it pulls nothing and this property is good at flying mode. (If we

can select entering flying when turning on the phone.)

Therefore, I think K35modem can solve the problem "GSM modem is not powered down
when Linux is shut down".

comment:12 Changed 11 years ago by tick@…

Sorry for the typo K34modem

comment:13 Changed 11 years ago by mwester@…

  • dependson set to 788

But there are some problems:

  1. There is a bug in kernel, and that may make the system hang while

pulling pin.

This bug is #788, and has been fixed for a very long time. If you choose not to
apply the patch provided in #788, then it is simple to arrange the stty
statements to avoid triggering the bug. Therefore this argument is NOT a reason
to reject the original solution to this bug report.

  1. "echo -e "AT@POFF\r" >$GSM_DEV" is not a reliable way to send

command to modem.
In our experiments, it is not as stable as we expected.

Ok. Please elaborate. What exactly failed, and how? Once again, this point
(especially when it is thrown out here without any details to support it) is not
a reason to reject the original solution to this bug report. It is, at best, a
reason to fix whatever is "not a reliable way" about it, whatever that might be.

  1. It will reset the GSM modem before turning it off (not good

in flying mode case.)

Please elaborate. Why is this not good in flying mode case? As soon as the
modem initializes, it reads the AT@POFF command and powers off -- there are no
other commands issued or queued to cause it to transmit. Please point us to
some documentation that would indicate what this GSM modem does on power-up (and
if it does, in fact, transmit on power-up, then it can be argued that the modem
itself is flawed in design). In any case, this also is not a reason to reject
the original solution, although it might be a reason to have an out-of-band
flag, perhaps managed by the kernel, that would ensure that no user action could
cause the modem to transmit in the event that the phone crashes and shuts down
while in "flying mode".

In my experiments it shows that K34modem has the following advantages:

  1. It can reliably and stably turn off the modem *IFF* GSMD works well.

Yes. Absolutely correct. But the keyword here is: IFF. The fact is that GSMD
DOES NOT work well. Yes, it should be fixed. Yes, it should be fixed soon.
But the fact of the matter is that right now countless neo's are ending up with
flat batteries and are rendered unbootable (see the other bugs about how the Neo
will not boot even if plugged in to USB if the battery has been flattened).
This is an extremely frustrating situation for users. This argument is a valid
argument, IFF someone can make GSMD work reliably and well. Until then, the fix
as originally documented in this bug report remains the best alternative to
resolving the issue reported by this bug report.

  1. It avoid to touch the kernel bug that hangs the whole system.

Apply the patch that OpenMoko? has been ignoring in #788. That bug is thoroughly
understood, and a workaround has been developed, and is being used by numerous
Neo users today. This is not difficult - apply a patch, and this issue goes away.

It's also worth noting that the refusal of OpenMoko? to fix #788 is one of
the things that makes the Neo so unreliable and frustrating. So while we
understand that "purity" and avoidance of "architectural layering violations"
and other good design principles are important, there is a need to apply
less-than-perfect solutions and patches to quickly solve a problem, especially
when the real solution will take many months and has dire consequences, such as
crashing the kernel (#788) or flattening the battery and rendering the device
unbootable (this bug report).

  1. It will automatically failed and do nothing in

"flying mode" (if implement in the future)

Ahhh! So "flying mode" is a red herring, because it is not yet implemented?
This is a ridiculous argument against the original fix for this problem.
When/if "flying mode" is actually implemented, then this fix can be revisited
and changed or removed as necessary. Until then, this argument is not applicable.

Here comes out a potential assumption, GSMD has to be alive
when K34modem runs.
Is this logical?
I think it ok, though not very ideal.

No. As stated above, GSMD is not reliable enough, and there are far too many
reasons for users to shut it down. Not to mention that the dialer code shuts
down (and attempts to restart) gsmd as well. There is simply no reasonable
reason to assume that gsmd is running when a user finds the need to power off
the device. Quite the contrary - it is reasonable to assume that the user will
power off the device when it has gone wrong in some way. At some point, we can
assume that the user will restart it -- but right now, it is more likely that if
the device ceases to function properly as a phone, the user will shut it down
and use an alternate cell phone. And unless the patch as originally provided in
this bug report is used, in that use case the Neo will quietly sit in the user's
pocket, draining the battery until it is totally flat. At which point, the
device will fail to reboot, even if connected to a USB cable.

  1. We can write a new program to turn off the GSM firmware stably

and reliably.

But since we have GSMD and libgsmd-tools that can do the same thing,

why not
take good use of it? And save the space of rootfs?

All we have to do is allow gsmd not been killed at this moment.

For reasons repeatedly stated above, and on IRC discussions with openmoko, THIS
IS CURRENTLY ONLY A DREAM! Gsmd is NOT reliable enough. Some day, we hope -
but not today. Please stop confusing future goodness with today's bug reports.

  1. As for the those conditions that system device failure (or GSMD

terribly failed ), in these cases system should reboot but not shutdown.

Really? Should that printed in multiple languages on the back of the Neo?
That's just ridiculous - when the user is sufficiently frustrated with the
device, they will power it off.

But if OpenMoko? *REALLY* believes that, then please remove the shutdown command,
the poweroff command, and the corresponding menu items in the neod daemon, and
replace them all with the appropriate "reboot" command. Also ensure that u-boot
is altered to make sure that reboots are attempted at all times.

In my opinion

  • GSMD has be stable enough to work normally to the end.

(This is another issue. )

WHAT!!!! "This is another issue."???? NO NO NO! This is *EXACTLY* the issue -
gsmd fails, and fails all the time, and leaves phones sucking batteries dry!
Yes, gsmd should work. BUT IT DOES NOT, and it will not for a very long time.
Once it is judged that gsmd is reliable, and once the dialer and other
applications stop restarting it all the time, and once the mux is implemented so
that gsmd doesn't need to be shut down in order to do data calls, THEN perhaps
we can say that gsmd is stable and will be running at shutdown. This bug report
is for a problem in the "here and now" - this argument is referring to the "in
the future". This is a dream, not an argument against using the patch/fix as
originally posted in this bug report.

Using GSMD to turn the modem off is not a bad choice.

No. It's not. If gsmd stays running. But it doesn't. So therefore, relying
on gsmd to turn off the modem becomes a bad choice.

Or if you can use "cu" or some other stable way to turn the GSM modem
off, is also a good choice.

Yes - except that cu can't twiddle the CRTSCTS mode that's required. So maybe
"expect". Or a python script. Or a perl script. Or a very small C program.
There are so very many ways to do this. If you can define what you find to be
"unstable" about "echo", an appropriate substitute for echo can be found, and
the fix as originally attached to this bug can be altered, and used.

  • K35modem take good usage of shutting down system will automatically

pull down the pin without hang the whole system. So the kernel's bug
(It's also another
issue.) will not be a blocker to this case.

Sigh. Here we go again on this unrelated issue. Apply the patch to #788,
and the problems all go away. Really. It's that easy. This is a ridiculous
argument, because it is OpenMoko? that is refusing to address #788, so
arguing that you need a different solution for *this* bug, because you won't fix
another bug, is foolish. Don't solve this bug wrongly just because you won't
fix another bug.

  • Even more it pulls nothing and this property is good at flying mode.

(If we can select entering flying when turning on the phone.)

More arguments about "future" stuff. When someone implements "flying mode",
then someone can revisit this fix. Until then, the community would very much
like to have the Neo NOT flatten its batteries.

Therefore, I think K35modem can solve the problem "GSM modem is not
powered down when Linux is shut down".

No. Quite wrong. What this argument is about is rationalization of a fix that
is preferred by some folks at OpenMoko?, even though it does not really solve the
current problem.

It is quite clear that we need a fix right now to ensure that the GSM modem is
powered off when the phone shuts down. It is also clear that gsmd is not stable
enough to do this reliably. To make matters worse, other software shuts down
gsmd (dialer), and it is also common for users to shut down gsmd because there
is no other way to use features that gsmd does not yet do (data). So gsmd is
clearly not ready yet. It is also clear that the arguments expressed contain a
great deal of "noise": constant references to a kernel crash are red herrings,
as this crash has been solved, and can be avoided in several different ways.
Other references to "flying mode" also are red herrings, as no such feature
currently exists. Additionally, there is no documentation to support that
resetting the GSM modem and immediately powering it off results in any attempt
by the modem to transmit. Finally, there are references to the use of "echo" as
being unreliable, without any substantiation of that -- no trace, no error
messages, no logs, not even any specific symptoms. But even so, that too is a
red herring -- echo can be replaced by a number of alternate implementations
that can address whatever issues are posed by the use of "echo".

In summary, the original fix, remains the correct solution. Bug #788 has been
marked as a dependency. The echo issue can be rewritten or changed, pending
concrete description of that problem by the person who made the claims that
"echo" is unreliable.

gsmd is NOT the correct place or way, at present, to resolve this problem.

comment:14 Changed 11 years ago by willie_chen@…

  • Cc willie_chen@… added

comment:15 Changed 11 years ago by tick@…

  • dependson set to 770

comment:16 Changed 11 years ago by balrogg@…

  • dependson 770 deleted
  • blocked set to 770

The other way :-) #770 depends on this I believe.

As a side note, AT@POFF does this one my GTA01Bv4 phone:
AT@POFF
EXT: I

ERROR

comment:17 Changed 11 years ago by mickey@…

  • Status changed from reopened to assigned

comment:18 Changed 11 years ago by tick@…

  • Owner changed from sean_chiang@… to mickey@…
  • Status changed from assigned to new

comment:19 Changed 11 years ago by mickey@…

  • Status changed from new to assigned

i will handle this

comment:20 Changed 11 years ago by shawn.t.rutledge@…

FWIW I tried installing /etc/rc0.d/K36atpoff, did a "halt", disconnected USB and
let the phone sit for a couple days. The battery was still just as dead.

Of course the thing to do is figure out a way to measure current consumption. I
haven't done that yet.

comment:21 Changed 11 years ago by emreturkay@…

  • Cc emreturkay@… added

Changed 11 years ago by mwester@…

/etc/rc0.d/K36atpoff (updated, and with debug statements)

comment:22 Changed 11 years ago by mwester@…

  • attachments.isobsolete changed from 0 to 1

comment:23 Changed 11 years ago by roh

  • Owner changed from mickey@… to mickeyl

comment:24 Changed 11 years ago by mickeyl

  • Status changed from assigned to closed
  • Resolution set to fixed

fixed w/ gsm0710muxd. Please try 2007.2 with this.

comment:25 Changed 2 years ago by RoberMync

Proventil Inhaler For Sale <a href=http://cial1.xyz/cialis-tadalafil.php>Cialis Tadalafil</a> Buy Stendra Tablets Online Viagra Cialis Vendita <a href=http://cial5mg.xyz/cheapest-cialis-online.php>Cheapest Cialis Online</a> Propecia Finasteride Dosage Buy Clomiphene Online <a href=http://kama1.xyz/cost-of-kamagra.php>Cost Of Kamagra</a> Usda Approved Generic Levitra Levitra Contre Cialis <a href=http://viag1.xyz/viagra-pill.php>Viagra Pill</a> Propecia 90 Pills Levitra Withouth Prescription <a href=http://zoloft.ccrpdc.com/generic-zoloft-usa.php>Generic Zoloft Usa</a> Amoxicillin Rash Ebv Erboristeria Viagra Naturale <a href=http://kama1.xyz/purchase-cheap-kamagra.php>Purchase Cheap Kamagra</a> Viagra Rezeptfrei Test Viagra Rembourse Par La Secu <a href=http://cial5mg.xyz/cialis-40mg.php>Cialis 40mg</a> Priligy Wirkt Nicht Amoxicillin During Pregnacy <a href=http://viag1.xyz/cheap-viagra-50mg.php>Cheap Viagra 50mg</a> Baclofene Molecule Chlomid Nolvadex Supplier <a href=http://clomid.ccrpdc.com/clomiphene-order.php>Clomiphene Order</a> Lexapro Uk Online Propecia Dosage Hair Loss Proscar Finasteride <a href=http://zol1.xyz/ordina-zoloft-online.php>Ordina Zoloft Online</a> Levitra 20 Mg 500 Milligrams Keflex <a href=http://viag1.xyz/generic-viagra.php>Generic Viagra</a> Propecia Hair Growth Free Dysfunction Samples <a href=http://kama1.xyz/order-kamagra-on-line.php>Order Kamagra On Line</a> Comprar Cialis En Farmacia Online Dove Comprare Viagra Senza Ricetta <a href=http://cial1.xyz/cheap-cialis.php>Cheap Cialis</a> Cephalexin Use In Dogs Hydrochlorothiazide Pills <a href=http://clomid.ccrpdc.com/clomid-order.php>Clomid Order</a> Ciprofloxacin 127 Cialis Super Active 20mg Reviews <a href=http://cytotec.ccrpdc.com/mail-order-cytotec.php>Mail Order Cytotec</a> Cialis Non Prescription Generic Cialis Elocon Shop <a href=http://nolvadex.ccrpdc.com/generic-nolvadex.php>Generic Nolvadex</a> Viagra Shipped To Philippines Levitra Viagra <a href=http://kama1.xyz/buy-kamagra-oral-jelly.php>Buy Kamagra Oral Jelly</a> Ajanta Pharma On Line Levitra Overdose <a href=http://prednisone.ccrpdc.com/deltasone-prednisone.php>Deltasone Prednisone</a> Zithromax Antibiotikum Shelf Life Of Prednison Tablets <a href=http://viag1.xyz/sildenafil-20mg.php>Sildenafil 20mg</a> Propecia Funciona Uses For Cephalexin <a href=http://cial5mg.xyz/order-cialis-online.php>Order Cialis Online</a> On Line Propecia Long Term Effects <a href=http://cial5mg.xyz/female-cialis.php>Female Cialis</a> Mastitis Keflex Keflex And Stomach <a href=http://clomid.ccrpdc.com/cheap-clomiphene-usa.php>Cheap Clomiphene Usa</a> Kamagra Carrefour Cephalexin Dose For Pneumonia <a href=http://kama1.xyz/kamagra-cheap.php>Kamagra Cheap</a> Cephalexin Sample Cialis Canada Generic <a href=http://viag1.xyz/purchase-viagra-cheap.php>Purchase Viagra Cheap</a> Propecia 20mg Online Cost Of Cialis And Levitra <a href=http://kamagra.ccrpdc.com/kamagra-gel-online.php>Kamagra Gel Online</a> Cialis Disfuncion Erectil Cheap Valtrex Pills 3 Day Delivery <a href=http://cial5mg.xyz/buy-cheap-cialis-pills.php>Buy Cheap Cialis Pills</a> Cialis Dosierung 5 Mg Priligy Precio En Argentina <a href=http://viag1.xyz/buying-viagra-online.php>Buying Viagra Online</a> Pet Med Amoxicillin Levitra Farmacia Prezzo <a href=http://cial1.xyz/generic-cialis-online.php>Generic Cialis Online</a> Bentyl Medication Prix Viagra 25 Milligrams <a href=http://cial5mg.xyz/ordina-cialis-online.php>Ordina Cialis Online</a> Prix Du Vrai Viagra Propecia For Sale Uk <a href=http://zol1.xyz/zoloft-generic-name.php>Zoloft Generic Name</a> Generic Prednisone Prednisone Side Effects <a href=http://kamagra.ccrpdc.com/kamagra-sildenafil.php>Kamagra Sildenafil</a> Achat Propecia En Ligne France Viagra 100mg Precio <a href=http://zol1.xyz/buy-implicane-online.php>Buy Implicane Online</a> Generic Pharmacy India Amoxicillin Before Food <a href=http://antabuse.ccrpdc.com/disulfiram.php>Disulfiram</a> How To Order Cytotec Photos De Pilules Amoxil <a href=http://kama1.xyz/kamagra-chewable.php>Kamagra Chewable</a> Cytotec En Walmart Buy Synthroid Using Paypal <a href=http://lasix.ccrpdc.com/cheap-generic-lasix.php>Cheap Generic Lasix</a> Motilium Without Prescription Priligy 60 Mg Erfahrung <a href=http://accutane.ccrpdc.com/buy-isotane.php>Buy Isotane</a> Buy Generic Accutane Online Venta De Kamagra <a href=http://kama1.xyz/generic-kamagra-buy.php>Generic Kamagra Buy</a> Acheter Cialis En Tunisie Kamagra Kaufen Oberhausen <a href=http://cial5mg.xyz/generic-cialis-100mg.php>Generic Cialis 100mg</a> Viagra Apres Manger

Note: See TracTickets for help on using tickets.