是否有可能使用write C code访问RILD插座的Andr​​oid [英] Is it possible to use write c code access rild socket in Android

查看:99
本文介绍了是否有可能使用write C code访问RILD插座的Andr​​oid的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

之类的标题。我写的code是这样的:

like the Title. I write the code like this:

printf("create socket\r\n");

fd = socket_local_client(SOCKET_NAME_RIL,
ANDROID_SOCKET_NAMESPACE_RESERVED,
SOCK_STREAM);

if (fd < 0) {
perror ("opening radio  socket error");
exit(-1);
}



printf("fd = %d\r\n",fd);
int length = 12;
char datalength[5]={0};
datalength[0] = 0;
datalength[1] = 0;
datalength[2] = (length >>8) & 0xff;
datalength[3] = (length & 0xff);
int ret = send(fd, datalength, 4, 0);
if(ret != sizeof(int)) {
    perror ("Socket write error when sending length");
    close(fd);
    exit(-1);
}

我能得到FD值成功,并成功地发送数据。
但从的logcat -b广播没有可显示的信息无关。
似乎有RILD prevent套接字连接。

i can get fd value successfully, and send data successfully. but from "logcat -b radio" there is nothing information can be displayed. it seems that rild has prevent socket connection.

有任何决议案?谢谢

推荐答案

RILD 插座拥有的电话应用程序,所以你将无法连接到它,只要运行。你可能会尝试连接到 RILD调试插座。

The rild socket is "owned" by the Phone app, so you won't be able to connect to it as long as that is running. You might try connecting to the rild-debug socket.

这篇关于是否有可能使用write C code访问RILD插座的Andr​​oid的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆