| Xia Wang | 14171dc | 2010-10-05 19:29:48 -0700 | [diff] [blame] | 1 | Mock-ril: |
| 2 | |
| 3 | Install: |
| 4 | |
| 5 | Install protoc see the external/protobuf/INSTALL.txt and |
| 6 | external/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 | |
| 16 | If you get "from google.protobuf import xxxx" statements |
| 17 | that google.protobuf is not found you didn't install the |
| 18 | python support for protobuf. Also on Mac OSX I got an |
| 19 | error running the protoc tests but installing was fine. |
| 20 | |
| 21 | Running/testing: |
| 22 | |
| 23 | See "Testing a new ril:" below for general instructions but |
| 24 | for the mock-ril I've added some targets to the Makefile to |
| 25 | ease testing. |
| 26 | |
| 27 | Execute the "first" target first to setup appropriate |
| 28 | environment: |
| 29 | $ cd hardware/ril/mock-ril |
| 30 | $ make first |
| 31 | |
| 32 | If changes made to ".proto" files run make with the default |
| 33 | "all" target: |
| 34 | $ make |
| 35 | |
| 36 | If changes are made to "c++" file create a new library and |
| 37 | run the "test" target: |
| 38 | $ mm |
| 39 | $ make test |
| 40 | |
| 41 | If changes to only the execute "js" target: |
| 42 | $ make js |
| 43 | |
| 44 | To run the test control server: |
| 45 | $ make tcs |
| 46 | |
| 47 | Implementation: |
| 48 | |
| 49 | The mock-ril is a library where the ril is implemented primarily |
| 50 | in javascript, mock-ril.js. In addition it can be controlled by |
| 51 | sending messages from another computer to port 54312 (TODO make |
| 52 | programmable) to the ctrlServer, a Worker in In mock-ril.js. |
| 53 | |
| 54 | See mock_ril.js for additional documentation. |
| 55 | |
| 56 | files: |
| 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 | |
| 89 | TODO: more documentation. |
| 90 | |
| 91 | |
| 92 | Testing a new ril: |
| 93 | |
| 94 | The Makefile is used to generate files and make testing easier. |
| 95 | I has several targets: |
| 96 | |
| 97 | all runs protoc and generates files, ril.desc ril.pb.* |
| 98 | |
| 99 | clean target removes generated files. |
| 100 | |
| 101 | first changes to root, remounts r/w and copies some files. |
| 102 | |
| 103 | test copies the latest libmock_ril.so and kills rild |
| 104 | to run the new mockril |
| 105 | |
| 106 | General instructions for testing ril's: |
| 107 | |
| 108 | 1) 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 | |
| 115 | 2) 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 | |
| 122 | 3) Compile and copy the ril to /system/lib/: |
| 123 | adb push out/target/product/passion/system/lib/libmock_ril.so /system/lib/ |
| 124 | |
| 125 | 4) 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 | |
| 133 | 5) Make modifications, go to step 3. |