modem-auto-config
This commit is contained in:
@@ -1,8 +1,17 @@
|
||||
cmake_minimum_required(VERSION 2.6)
|
||||
project(modem-auto-config)
|
||||
set (CMAKE_CXX_STANDARD 11)
|
||||
project(modem-auto-config C)
|
||||
|
||||
# Use 64-bit off_t on 32-bit Linux
|
||||
if (CMAKE_SYSTEM_NAME STREQUAL "Linux" AND CMAKE_SIZEOF_VOID_P EQUAL 4)
|
||||
# ensure 64bit offsets are used for filesystem accesses for 32bit compilation
|
||||
add_definitions(-D_FILE_OFFSET_BITS=64)
|
||||
endif()
|
||||
|
||||
|
||||
add_executable(modem-auto-config modem_auto_config.c)
|
||||
|
||||
target_link_libraries(modem-auto-config hybris-common android-properties)
|
||||
|
||||
|
||||
install (TARGETS modem-auto-config DESTINATION sbin)
|
||||
install (FILES modem-auto-config.service DESTINATION /lib/systemd/system)
|
||||
|
||||
6
debian/control
vendored
6
debian/control
vendored
@@ -3,8 +3,8 @@ Section: admin
|
||||
Priority: optional
|
||||
Build-Depends: cmake (>= 2.8.10),
|
||||
debhelper-compat (= 12),
|
||||
libandroid-properties,
|
||||
libhybris-common
|
||||
libandroid-properties1,libandroid-properties-dev,
|
||||
libhybris-common1,libhybris-common-dev,libhybris-dev,
|
||||
Maintainer: kuailexs <952415538@qq.com>
|
||||
Standards-Version: 3.9.5
|
||||
Homepage: https://gitlab.com/ubports-cn/modem-auto-config
|
||||
@@ -12,7 +12,7 @@ Vcs-Browser: https://gitlab.com/ubports-cn/modem-auto-config
|
||||
Vcs-Git: https://gitlab.com/ubports-cn/modem-auto-config.git
|
||||
|
||||
Package: modem-auto-config
|
||||
Architecture: armhf arm64 i386 amd64
|
||||
Architecture: any
|
||||
Depends: ${misc:Depends},
|
||||
${shlibs:Depends},
|
||||
Description: utility to make the modem automatically selects MBN
|
||||
|
||||
2
debian/source/format
vendored
2
debian/source/format
vendored
@@ -1 +1 @@
|
||||
3.0 (native)
|
||||
1.0
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <dlfcn.h>
|
||||
#include <cutils/properties.h>
|
||||
#include <hybris/properties/properties.h>
|
||||
#include <hybris/common/binding.h>
|
||||
|
||||
// Remove comment to enable debug
|
||||
@@ -42,17 +42,26 @@ static int (*pdc_clean)(void) = NULL;
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
char libpath[50];
|
||||
char libpath[50] = {"\0"};
|
||||
int length = property_get("vendor.rild.libpath", libpath, "0");
|
||||
if (length <= 0) {
|
||||
LOG_ERR("Failed to get prop.\n");
|
||||
return -1;
|
||||
}
|
||||
static void *rild_lib = android_dlopen(libpath, RTLD_LAZY);
|
||||
LOG_DEBUG("vendor.rild.libpath %s\n", libpath);
|
||||
void *rild_lib = android_dlopen(libpath, RTLD_LAZY);
|
||||
if(rild_lib == NULL){
|
||||
LOG_ERR("Failed android_dlopen.\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
pdc_init = (int (*)(void))android_dlsym(rild_lib,"_Z8pdc_initv");
|
||||
pdc_enable_auto_selection = (int (*)(int, int))android_dlsym(rild_lib, "_Z25pdc_enable_auto_selectionii");
|
||||
pdc_clean = (int (*)(void))android_dlsym(rild_lib, "_Z9pdc_cleanv");
|
||||
//pdc_init = (int (*)(void))android_dlsym(rild_lib,"_Z8pdc_initv");
|
||||
//pdc_enable_auto_selection = (int (*)(int, int))android_dlsym(rild_lib, "_Z25pdc_enable_auto_selectionii");
|
||||
//pdc_clean = (int (*)(void))android_dlsym(rild_lib, "_Z9pdc_cleanv");
|
||||
|
||||
pdc_init = (int (*)(void))android_dlsym(rild_lib,"pdc_init");
|
||||
pdc_enable_auto_selection = (int (*)(int, int))android_dlsym(rild_lib, "pdc_enable_auto_selection");
|
||||
pdc_clean = (int (*)(void))android_dlsym(rild_lib, "pdc_clean");
|
||||
|
||||
if(pdc_init == NULL || pdc_enable_auto_selection == NULL || pdc_clean == NULL){
|
||||
LOG_ERR("Failed to get fns %p %p %p\n",pdc_init,pdc_enable_auto_selection,pdc_clean);
|
||||
@@ -64,7 +73,7 @@ int main(int argc, char* argv[])
|
||||
pdc_enable_auto_selection(1,0);
|
||||
pdc_enable_auto_selection(1,1);
|
||||
pdc_clean();
|
||||
android_dlclose(rild_lib)
|
||||
android_dlclose(rild_lib);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user