NameDateSize

..22-Apr-20134 KiB

.gitignore22-Apr-201313

Android.mk22-Apr-20131.9 KiB

Makefile22-Apr-20135.1 KiB

MODULE_LICENSE_APACHE222-Apr-20130

NOTICE22-Apr-201311.9 KiB

README.txt22-Apr-20135 KiB

src/22-Apr-20134 KiB

README.txt

1Mock-ril:
2
3Install:
4
5The protoc is now part of the Android build but its
6called "aprotoc" so it doesn't conflict with versions
7already installed. If you wish to install it permanetly
8see external/protobuf/INSTALL.txt and
9external/protobuf/python/README.txt.  If you get
10"from google.protobuf import xxxx" statements that
11google.protobuf is not found, you didn't install the
12python support for protobuf. Also on Mac OSX I got an
13error running the protoc tests but installing was fine.
14
15Running/testing:
16
17See "Testing a new ril:" below for general instructions but
18for the mock-ril I've added some targets to the Makefile to
19ease testing. Also Makefile needs to know the device being
20used as this determines the directory where files are found
21and stored. ANDROID_DEVICE is an environment variable and
22maybe either exported:
23   $ export ANDROID_DEVICE=stingray
24
25or it can be passed on the command line:
26   $ make clean ANDROID_DEVICE=stingray
27
28If it's not set "passion" is the default.
29
30Execute the "first" target first to setup appropriate
31environment:
32  $ cd hardware/ril/mock-ril
33  $ make first
34
35If changes made to ".proto" files run make with the default
36"all" target:
37  $ make
38
39If changes are made to "c++" file create a new library and
40run the "test" target:
41  $ mm
42  $ make test
43
44If changes to only the execute "js" target:
45  $ make js
46
47To run the test control server:
48  $ make tcs
49
50Implementation:
51
52The mock-ril is a library where the ril is implemented primarily
53in javascript, mock-ril.js. In addition it can be controlled by
54sending messages from another computer to port 54312 (TODO make
55programmable) to the ctrlServer, a Worker in In mock-ril.js.
56
57See mock_ril.js for additional documentation.
58
59files:
60  ctrl.proto                    Protobuf messages for the control server
61  ctrl.*                        Protobuf generated files.
62  ctrl_pb2.py                   Python files generated from ctrl.proto
63  ctrl_server.*                 Cpp interface routines between ctrlServer
64                                in javascript and the controller.
65  experiments.*                 Early experiments
66  js_support.*                  Java script support methods. Exposes various
67                                routines to javascript, such as print, readFile
68                                and include.
69  logging.h                     LOG_TAG and include utils/log.h
70  mock_ril.[cpp|h]              Main module inteface code.
71  mock_ril.js                   The mock ril
72  node_buffer.*                 A Buffer for communicating between c++ and js.
73                                This was ported from nodejs.org.
74  node_object.*                 An object wrapper to make it easier to expose
75                                c++ code to js. Ported from nodejs.org.
76  node_util.*                   Some utilities ported from nodejs.org.
77  protobuf_v8.*                 Protobuf code for javascript ported from
78                                http://code.google.com/p/protobuf-for-node/.
79  requests.*                    Interface code for handling framework requests.
80  responses*                    Interface code for handling framework responses.
81  ril.proto                     The protobuf version of ril.h
82  ril_vars.js                   Some additional variables defined for enums in
83                                ril.h.
84  ril_pb2.py                    Python files generated from ril.proto.
85  status.h                      STATUS constants.
86  tcs.py                        Test the ctrlServer.
87  util.*                        Utility routines
88  worker.*                      Define WorkerThread and WorkerQueue.
89  worker_v8.*                   Expose WorkerQueue to js.
90
91
92TODO: more documentation.
93
94
95Testing a new ril:
96
97The Makefile is used to generate files and make testing easier.
98and there are has several targets:
99
100all         runs protoc and generates files, ril.desc ril.pb.*
101
102clean       target removes generated files.
103
104first       changes to root, remounts r/w and copies some files.
105
106test        copies the latest libmock_ril.so and kills rild
107            to run the new mockril
108
109General instructions for testing ril's:
110
1111) On the device login in as root and remount file system so it's read/write:
112     $ adb root
113     restarting adbd as root
114
115     $ adb remount
116     remount succeeded
117
1182) Set rild.libpath to the name of the ril:
119     adb shell setprop rild.libpath /system/lib/libmock_ril.so
120
121  Using setprop makes the change temporary and the old ril will be
122  used after rebooting. (Another option is to set rild.libpath in
123  /data/local.prop, but don't forget to reboot for it to take effect).
124
1253) Compile and copy the ril to /system/lib/:
126   adb push out/target/product/passion/system/lib/libmock_ril.so /system/lib/
127
1284) To restart the ril, kill the currently running ril and the new one
129   will automatically be restarted. You can use the ps command to find
130   /system/bin/rild PID, 3212 below and kill it:
131     $ adb shell ps | grep rild
132     radio     3212  1     3224   628   ffffffff afd0e4fc S /system/bin/rild
133
134     $ adb shell kill 3212
135
136   or
137
138     $ adb shell setprop ctl.restart ril-daemon
139
1405) Make modifications, go to step 3.
141