Skip to content

Commit

Permalink
guilib loading fix
Browse files Browse the repository at this point in the history
  • Loading branch information
funneld committed May 25, 2022
1 parent f095180 commit d95e35a
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 14 deletions.
2 changes: 1 addition & 1 deletion ipk/control/control
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Package: auto-start-recording
Version: 0.1.0
Version: 0.1.1
Maintainer: funnel
Description: Auto starts recording whenever a link with the Airunit is present.
Architecture: armv7-3.2
Expand Down
33 changes: 20 additions & 13 deletions jni/auto_start_recording.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,23 +11,30 @@ int32_t _ZN19GlassRacingChnlMenu7timeOutEv (void* this) {
int32_t ret = 0;

if (!timeOut && !getInstance){
void *guiLib = dlopen("/system/lib/libtp1801_gui.so",1);

timeOut = dlsym (guiLib, "_ZN19GlassRacingChnlMenu7timeOutEv");
if (timeOut == 0)
{
printf("dlsym: %s\n", dlerror());
return 0;
timeOut = dlsym (RTLD_NEXT, "_ZN19GlassRacingChnlMenu7timeOutEv");
if (timeOut == 0){
guiLib = dlopen("/system/lib/libtp1801_gui.so", 1);
timeOut = dlsym (guiLib, "_ZN19GlassRacingChnlMenu7timeOutEv");
if (timeOut == 0)
{
printf("dlsym: %s\n", dlerror());
return 0;
}
}

getInstance = dlsym (guiLib, "_ZN17GlassUserSettings11getInstanceEv");
if (getInstance == 0)
{
printf("dlsym: %s\n", dlerror());
return 0;

getInstance = dlsym (RTLD_NEXT, "_ZN17GlassUserSettings11getInstanceEv");
if (getInstance == 0){
if(!guiLib){guiLib = dlopen("/system/lib/libtp1801_gui.so", 1);}
getInstance = dlsym (guiLib, "_ZN17GlassUserSettings11getInstanceEv");
if (getInstance == 0)
{
printf("dlsym: %s\n", dlerror());
return 0;
}
}
}

uint32_t inst = getInstance();

gs_link_stat_t link = GS_LINK_STAT_UKNOWN;
Expand Down
1 change: 1 addition & 0 deletions jni/auto_start_recording.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ typedef enum Record_sender {
RECORD_DISARM=1
} Record_sender;

static void *guiLib = 0;
static bool restart_record = true;
static int32_t (* gs_modem_get_link_state_wrap)(void *_gs_info, enum gs_link_stat_t *) = 0;
static int32_t (* gs_lv_transcode_record)(void *_gs_info, bool b_record, Record_sender sender) = 0;
Expand Down

0 comments on commit d95e35a

Please sign in to comment.