当前位置:   article > 正文

RK3588&Android12 动态兼容4G模组_rk android12 wifi屏蔽5g信号

rk android12 wifi屏蔽5g信号

平台:RK3588&Android12 

内容:实现4G模组的兼容

实现一个固件可以动态兼容多种4G模块,不用换个模块就需要重新打包升级。

主要改系统层,根据模块的PID和VID使用对应的固件

  1. hardware\ril\rild\rild.c
  2. ++ #include <dirent.h>
  3. ++ static lte_device supported_lte_devices[] = {
  4. ++ {"U9507C", "2df3:9d01", "vendor/lib64/libreference-ril-u9507c.so"},
  5. ++ {"E9730C", "2df3:9b33", "vendor/lib64/libreference-ril-e9730c.so"},
  6. ++ {"EC200A", "2c7c:6005", "vendor/lib64/libreference-ril-ec200a.so"},
  7. ++ {"EC2x", "2c7c:0125", "vendor/lib64/libreference-ril-ec2x.so"},
  8. ++ {"SLM770", "2dee:4d57", "vendor/lib64/libreference-ril-slm770.so"}, //vid+pid
  9. ++ {"U9300C", "1c9e:9b3c", "vendor/lib64/libreference-ril-u9300c.so"},
  10. ++ //{"N720V5", "2df3:9d01", "vendor/lib64/libec20.so"},
  11. ++ };
  12. ++
  13. ++ int get_rillib_from_id(char *libPath)
  14. ++ {
  15. ++ char *bus_dir = "/sys/bus/usb/devices";
  16. ++ char *prefix = "PRODUCT=";
  17. ++ int idnum;
  18. ++ int i = 0;
  19. ++ int ret = 0;
  20. ++ DIR *dir;
  21. ++ struct dirent *next;
  22. ++ FILE *fp = NULL;
  23. ++ idnum = sizeof(supported_lte_devices) / sizeof(supported_lte_devices[0]);
  24. ++ dir = opendir(bus_dir);
  25. ++ if (!dir) {
  26. ++ return -1;
  27. ++ }
  28. ++
  29. ++ while ((next = readdir(dir)) != NULL) {
  30. ++ char line[256];
  31. ++ char uevent_file[256] = {0};
  32. ++ sprintf(uevent_file, "%s/%s/uevent", bus_dir, next->d_name);
  33. ++ //PLOG(DEBUG) << "uevent path:" << uevent_file;
  34. ++ RLOGD("**uevent path :=%s**", uevent_file);
  35. ++ fp = fopen(uevent_file, "r");
  36. ++ if (NULL == fp) {
  37. ++ continue;
  38. ++ }
  39. ++
  40. ++ while (fgets(line, sizeof(line), fp)) {
  41. ++ char *pos = NULL;
  42. ++ int product_vid = 0;
  43. ++ int product_did = 0;
  44. ++ int producd_bcddev = 0;
  45. ++ char temp[10] = {0};
  46. ++ pos = strstr(line, prefix);
  47. ++ //PLOG(DEBUG) << "line:" << line << ", prefix:" << prefix << ".";
  48. ++ if (pos != NULL) {
  49. ++ sscanf(pos + 8, "%x/%x/%x", &product_vid, &product_did, &producd_bcddev);
  50. ++
  51. ++ sprintf(temp, "%04x:%04x", product_vid, product_did);
  52. ++ RLOGD("**found vid:pid =%04x:%04x, temp=%s **", product_vid, product_did, temp);
  53. ++ for (i = 0; i < idnum; i++) {
  54. ++ if (0 == strncmp(temp, supported_lte_devices[i].vid_pid, 9)) {
  55. ++ //PLOG(ERROR) << "found device pid:vid :" << temp;
  56. ++ RLOGD("**found device pid:vid :=%s, module_name :=%s**", temp, supported_lte_devices[i].module_name);
  57. ++ strcpy(libPath, supported_lte_devices[i].path);
  58. ++ ret = 0;
  59. ++ fclose(fp);
  60. ++ goto ready;
  61. ++ }
  62. ++ }
  63. ++ }
  64. ++ }
  65. ++ fclose(fp);
  66. ++ }
  67. ++
  68. ++ ret = -1;
  69. ++ ready:
  70. ++ closedir(dir);
  71. ++ //PLOG(DEBUG) << "wifi detectd return ret:" << ret;
  72. ++ RLOGD("**get_rillib_from_id=%d**", ret);
  73. ++ return ret;
  74. ++ }
  75. int main(int argc, char **argv) {
  76. ......
  77. if (rilLibPath == NULL) {
  78. if ( 0 == property_get(LIB_PATH_PROPERTY, libPath, NULL)) {
  79. // No lib sepcified on the command line, and nothing set in props.
  80. // Assume "no-ril" case.
  81. goto done;
  82. } else {
  83. rilLibPath = libPath;
  84. }
  85. }
  86. ++ if (get_rillib_from_id(libPath) == 0)
  87. ++ rilLibPath = libPath;
  88. ++ RLOGD("**RILd rilLibPath=%s**", rilLibPath);

把对应RIL库文件放到 device\rockchip\common\4g_modem\lib64\

再修改4g_modem.mk把文件加载到对应位置,例如:

  1. /device/rockchip/common
  2. --- a/modules/4g_modem.mk
  3. +++ b/modules/4g_modem.mk
  4. PRODUCT_COPY_FILES += \
  5. $(LOCAL_PATH)/../4g_modem/bin64/dhcpcd:$(TARGET_COPY_OUT_VENDOR)/bin/dhcpcd \
  6. $(LOCAL_PATH)/../4g_modem/lib64/librk-ril.so:$(TARGET_COPY_OUT_VENDOR)/lib64/librk-ril.so \
  7. + $(LOCAL_PATH)/../4g_modem/lib64/libreference-ril-ec2x.so:$(TARGET_COPY_OUT_VENDOR)/lib64/libreference-ril-ec2x.so \
  8. + $(LOCAL_PATH)/../4g_modem/lib64/libreference-ril-ec200a.so:$(TARGET_COPY_OUT_VENDOR)/lib64/libreference-ril-ec200a.so \
  9. + $(LOCAL_PATH)/../4g_modem/lib64/libreference-ril-u9300c.so:$(TARGET_COPY_OUT_VENDOR)/lib64/libreference-ril-u9300c.so

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/你好赵伟/article/detail/229560
推荐阅读
相关标签
  

闽ICP备14008679号