FreeCalypso > hg > freecalypso-tools
annotate libpwon/forkoff.c @ 1001:7df4c9ae6ba4
loadtools/scripts: w220.{config,init} => chimei.{config,init}
Motorola W220, first touched by FreeCalypso in 2019-05, is an ODM phone
made by Chi-Mei, and its peculiar property of relevance to loadtools
is that it has XRAM on Calypso nCS3 instead of the usual nCS1 - which
matters for fc-xram. We are now discovering other Chi-Mei phones
including Sony Ericsson J120, and they share the same quirk of XRAM
on nCS3 - hence we rename this loadtools target from w220 to chimei.
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Sat, 09 Dec 2023 17:53:44 +0000 |
parents | ab54957dbe35 |
children |
rev | line source |
---|---|
571
41b3e010808d
libpwon started, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1 #include <sys/types.h> |
575
cef70d53fc5e
loadtools: new -P boot control mechanism implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
571
diff
changeset
|
2 #include <signal.h> |
571
41b3e010808d
libpwon started, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
3 #include <stdio.h> |
41b3e010808d
libpwon started, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
4 #include <stdlib.h> |
41b3e010808d
libpwon started, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
5 #include <unistd.h> |
41b3e010808d
libpwon started, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
6 |
41b3e010808d
libpwon started, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
7 extern char bootctrl_pwon_cmd[]; |
953
ab54957dbe35
libpwon: implement -Petmoff mode
Mychaela Falconia <falcon@freecalypso.org>
parents:
736
diff
changeset
|
8 extern int bootctrl_duart28c_mode, bootctrl_etmoff_mode; |
571
41b3e010808d
libpwon started, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
9 |
41b3e010808d
libpwon started, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
10 static char shell_pathname[] = "/bin/sh"; |
41b3e010808d
libpwon started, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
11 |
41b3e010808d
libpwon started, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
12 void |
41b3e010808d
libpwon started, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
13 fork_exec_pwon_cmd() |
41b3e010808d
libpwon started, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
14 { |
41b3e010808d
libpwon started, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
15 int i; |
41b3e010808d
libpwon started, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
16 |
41b3e010808d
libpwon started, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
17 i = vfork(); |
41b3e010808d
libpwon started, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
18 if (i < 0) { |
41b3e010808d
libpwon started, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
19 perror("vfork"); |
41b3e010808d
libpwon started, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
20 exit(1); |
41b3e010808d
libpwon started, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
21 } |
41b3e010808d
libpwon started, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
22 if (i) |
41b3e010808d
libpwon started, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
23 return; |
41b3e010808d
libpwon started, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
24 execl(shell_pathname, "sh", "-c", bootctrl_pwon_cmd, (char *) 0); |
41b3e010808d
libpwon started, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
25 perror(shell_pathname); |
41b3e010808d
libpwon started, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
26 _exit(1); |
41b3e010808d
libpwon started, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
27 } |
575
cef70d53fc5e
loadtools: new -P boot control mechanism implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
571
diff
changeset
|
28 |
cef70d53fc5e
loadtools: new -P boot control mechanism implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
571
diff
changeset
|
29 pwon_if_needed() |
cef70d53fc5e
loadtools: new -P boot control mechanism implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
571
diff
changeset
|
30 { |
736
7d1df6d831e4
libpwon: added -Pdtr and -Prts support for DUART28C
Mychaela Falconia <falcon@freecalypso.org>
parents:
575
diff
changeset
|
31 if (bootctrl_duart28c_mode) { |
7d1df6d831e4
libpwon: added -Pdtr and -Prts support for DUART28C
Mychaela Falconia <falcon@freecalypso.org>
parents:
575
diff
changeset
|
32 signal(SIGCHLD, SIG_IGN); |
7d1df6d831e4
libpwon: added -Pdtr and -Prts support for DUART28C
Mychaela Falconia <falcon@freecalypso.org>
parents:
575
diff
changeset
|
33 fork_duart28c_pulse(); |
7d1df6d831e4
libpwon: added -Pdtr and -Prts support for DUART28C
Mychaela Falconia <falcon@freecalypso.org>
parents:
575
diff
changeset
|
34 return(1); |
7d1df6d831e4
libpwon: added -Pdtr and -Prts support for DUART28C
Mychaela Falconia <falcon@freecalypso.org>
parents:
575
diff
changeset
|
35 } |
7d1df6d831e4
libpwon: added -Pdtr and -Prts support for DUART28C
Mychaela Falconia <falcon@freecalypso.org>
parents:
575
diff
changeset
|
36 if (bootctrl_pwon_cmd[0]) { |
7d1df6d831e4
libpwon: added -Pdtr and -Prts support for DUART28C
Mychaela Falconia <falcon@freecalypso.org>
parents:
575
diff
changeset
|
37 signal(SIGCHLD, SIG_IGN); |
7d1df6d831e4
libpwon: added -Pdtr and -Prts support for DUART28C
Mychaela Falconia <falcon@freecalypso.org>
parents:
575
diff
changeset
|
38 fork_exec_pwon_cmd(); |
7d1df6d831e4
libpwon: added -Pdtr and -Prts support for DUART28C
Mychaela Falconia <falcon@freecalypso.org>
parents:
575
diff
changeset
|
39 return(1); |
7d1df6d831e4
libpwon: added -Pdtr and -Prts support for DUART28C
Mychaela Falconia <falcon@freecalypso.org>
parents:
575
diff
changeset
|
40 } |
953
ab54957dbe35
libpwon: implement -Petmoff mode
Mychaela Falconia <falcon@freecalypso.org>
parents:
736
diff
changeset
|
41 if (bootctrl_etmoff_mode) { |
ab54957dbe35
libpwon: implement -Petmoff mode
Mychaela Falconia <falcon@freecalypso.org>
parents:
736
diff
changeset
|
42 bootctrl_do_etmoff(); |
ab54957dbe35
libpwon: implement -Petmoff mode
Mychaela Falconia <falcon@freecalypso.org>
parents:
736
diff
changeset
|
43 return(2); |
ab54957dbe35
libpwon: implement -Petmoff mode
Mychaela Falconia <falcon@freecalypso.org>
parents:
736
diff
changeset
|
44 } |
736
7d1df6d831e4
libpwon: added -Pdtr and -Prts support for DUART28C
Mychaela Falconia <falcon@freecalypso.org>
parents:
575
diff
changeset
|
45 return(0); |
575
cef70d53fc5e
loadtools: new -P boot control mechanism implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
571
diff
changeset
|
46 } |