| 159 | RPCListener(self).start() |
| 160 | |
| 161 | def open_lib(self, lib): |
| 162 | self.binded_lib, self.binded_lib_off = lib, 0 |
| 163 | fp = "file:///tinylib?entry&_modver=1.0&_dom=cdsp\0" |
| 164 | pra, _, _, _ = rpc_prep_args(ins=[memoryview(array.array('I', [len(fp), 0xff])), memoryview(bytearray(fp.encode()))], |
| 165 | outs=[o1:=memoryview(bytearray(0x8)), o2:=memoryview(bytearray(0xff))]) |
| 166 | qcom_dsp.FASTRPC_IOCTL_INVOKE(self.rpc_fd, handle=0, sc=rpc_sc(method=0, ins=2, outs=2), pra=pra) |
| 167 | if o1.cast('i')[1] < 0: raise RuntimeError(f"Cannot open lib: {o2.tobytes().decode()}") |
| 168 | return o1.cast('I')[0] |
| 169 | |
| 170 | def close_lib(self, handle): |
| 171 | pra, _, _, _ = rpc_prep_args(ins=[memoryview(array.array('I', [handle, 0xff]))], outs=[memoryview(bytearray(0x8)), memoryview(bytearray(0xff))]) |