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