Is it possible to add some missing symbols to existing shared libraries?
The stock libaudio.so on Milestone XT720 references three static strings found in the stock libmedia.so that are not common in other ROMs. Basically, the relevant parts in the original proprietaries are (via nm -D)
Code:
libaudio.so:
U _ZN7android14AudioParameter11keyFMLaunchE
U _ZN7android14AudioParameter12keyFMRoutingE
U _ZN7android14AudioParameter14keyHDMIRoutingE
Code:
libmedia.so:
0005fb68 D _ZN7android14AudioParameter11keyFMLaunchE
0005fb6c D _ZN7android14AudioParameter12keyFMRoutingE
0005fb70 D _ZN7android14AudioParameter14keyHDMIRoutingE
Code wise, we've figured out that they're just these stupid static strings
Code:
namespace android {
class AudioParameter {
static const char *keyFMLaunch;
static const char *keyFMRouting;
static const char *keyHDMIRouting;
};
const char *AudioParameter::keyFMLaunch = "FM_launch";
const char *AudioParameter::keyFMRouting = "FM_routing";
const char *AudioParameter::keyHDMIRouting ="HDMI_routing";
}; // namespace android
For example we're mostly compatible with Milestone A853's stock ROM, but Milestone A853's libmedia.so doesn't have these symbols, so we get link failure and substituting our libmedia.so causes big problems. If we use Milestone A853's libaudio.so instead, then FM radio volume control doesn't work.
AOSP/CyanogenMod don't have these symbols in libmedia either, so we've been using a forked framework/base just to stick these symbols in. I'm trying to clean up our tree and if it's possible I'd rather just stuff those symbols into libaudio.so somehow and never think about it again.
Is there some way to copy those strings from libmedia.so? I've been trying some things with the various binutils (objcopy, ld) and scouring man pages but no luck so far. I put the code above in wrapper.cpp but I can't figure out whether gcc can add to an existing .so. Any suggestions? I'm happy to read if someone knows where to point me.
Related
Hi, I'm trying to create an application, and i require to use a variable input for a reference ID to display different arrays here is what i am using at the moment
Code:
public void verbTenses() {
Spinner verbs = (Spinner) findViewById(R.id.verbs);
Spinner tenses = (Spinner) findViewById(R.id.verb_tenses);
[COLOR="RoyalBlue"]ListAdapter adapter = R.array.(verbs.getSelectedItem() + "_" + tenses.getSelectedItem());[/COLOR]
ListView list = (ListView) findViewById(R.id.ListView01);
list.setAdapter(adapter);
}
the error area is highlighted
Thank you
Questions or Problems Should Not Be Posted in the Development Forum
Please Post in the Correct Forums
Moving to Q&A
Hi!
I am trying to develop an android app with a google map v2, location service and some control buttons.
But I don't want to put all these things inside one MainActivity class. So I thought I could split all the code into some more classes. The MainActivity shall controll all the GUI things and react on map or location events...
Now I have the following problem. Inside my onCreate I instanziate the additional classes:
Code:
// Preferences as singleton
pref = Prefs.getInstance(this.getApplicationContext());
pref.loadSettings();
// Set up the location
loc = new Locations(pref);
loc.setCallback(this);
map = new MyMap(pref);
It seems to work fine. But inside the MyMap class every time I start the app a null pointer exception is thrown. When I am calling MyMap() the following code will be executed:
Code:
[...]
private Prefs pref;
private GoogleMap mMap;
[...]
public MyMap(Prefs prefs) {
pref = (Prefs) prefs;
if (mMap == null) {
FragmentManager fmanager = getSupportFragmentManager();
mMap = ((SupportMapFragment) fmanager.findFragmentById(R.id.map)).getMap();
[...]
}
The line with the findFragmentById is the one that causes the exception.
If I write
Code:
SupportMapFragment f = ((SupportMapFragment) fmanager.findFragmentById(R.id.map));
f is allways null. But how can I access the fragments and view elements defined within my MainActivity?
It works if I put the code inside my MainAcitivity.
Every class extends "android.support.v4.app.FragmentActivity"
I tried to save the application context within my Prefs() class, so that I can access it from everywhere.
But I don't know how to use it inside my additional classes.
How to share the "R" across all my classes?
Can someone help me please?
Thank you very much!!
Thorsten
Are you having trouble adding a Map to a Fragment? If so, then you may take a look at this tutorial. I haven't tried it myself since I couldn't install Google Play Services on my development device. If it helps, do write back, as I am definitely going to try it myself soon.
I've made some modifications to drivers/usb/otg/msm_otg.c in order to support usb host mode for the Nexus 4: http://forum.xda-developers.com/showthread.php?t=2181820
So far, I've been building off Franco's sources, since I was using his kernel anyway. But this has its problems. I'm not looking to have to constantly keep up with Franco's nightlies. A good amount of posts from people are asking if I could compile a different kernel with the otg modifications, or if they could flash a different kernel on top. Franco's been getting requests to implement the modifications, and I didn't mean to put any onus on him.
I've been trying to do some research on creating a kernel module that could somehow hijack/hook/wrap the static functions I've made changes to in msm_otg.c. This is all way, way over my head though, and I could really use some help here. I've done some reading so far, but it hasn't gotten me anywhere. I got some good help on IRC, but am stuck again.
To get things rolling, I've manually found the address from /proc/kallsyms of static function msm_chg_detect_work to be 0xc03b4950. I'm trying to make a jump from here to my own function. I was provided make_jump_op for this purpose, although I have no understanding of how it works. Here is more or less what I've got so far (relevant bits..):
Code:
// max distance: 0x02000000
unsigned int make_jump_op(unsigned int src, unsigned int dst) {
unsigned int o;
int distance;
distance = (int)( ((long long)dst) - (((long long)src) + 8) );
if (distance > 32*1024*1024 || distance < -32*1024*1024) {
printk(KERN_ERR "distance too big!\n");
return 0; // crash, BOOOOM!
}
distance = distance / 4; // read: ">>2"
o = *((unsigned int *)(&distance)); // is there a proper way to do this, too?
o = (o & 0x00ffffff) + 0xea000000;
return o;
}
static void msm_chg_detect_work_MOD(struct work_struct *w) {
printk(KERN_INFO "TEST\n");
}
static int ziddey_otg_init(void) {
unsigned int *origcall;
printk(KERN_INFO "Loading kernel module '%s'\n", MODULE_NAME);
// 0xc03b4950: msm_chg_detect_work
origcall = (unsigned int *) 0xc03b4950;
preempt_disable();
*origcall = make_jump_op(0xc03b4950, (unsigned int)(void*)msm_chg_detect_work_MOD);
preempt_enable();
printk(KERN_INFO "Loaded kernel module '%s'\n", MODULE_NAME);
return 0;
}
Can anyone make sense of this? I get an Oops error and kernel panic.
Thank you
Code:
$ grep msm_chg_detect_work /proc/kallsyms
c03b4950 t msm_chg_detect_work
Hello guys newbie warning
i am working on compiling my own android 4.2.2 system on an allwinner A20 SOC, my problem comes when i try to enable an external usb based (ttyUSB1) GPS which gives an error in logcat of "no AGPS interface in agps_data_conn_open" which i have tracked back to the com_android_server_location_GPSLocationProvider.cpp which is located in directory framework/base/services/jni/
1. i have tested the drivers provided by the vendor and they are working
2. further when i unplug the usb driver it gives a warning of missing hardware of gps therefore i know that my gps is detected atleast
3. i haved check my gps.conf to make sure i am using the right settings according to my area
below is the exact area which gives an error in the above mentioned cpp file
Code:
static void android_location_GpsLocationProvider_set_agps_server(JNIEnv* env, jobject obj,
jint type, jstring hostname, jint port)
{
if (!sAGpsInterface) {
ALOGE("no AGPS interface in agps_data_conn_open");
return;
}
const char *c_hostname = env->GetStringUTFChars(hostname, NULL);
sAGpsInterface->set_server(type, c_hostname, port);
env->ReleaseStringUTFChars(hostname, c_hostname);
}
p.s. static const AGpsInterface* sAGpsInterface;
Hello,
I'm trying to get raw data from light sensor via sysfs, and transfer to app to show on chart.
I've been looking at the kernel driver sources and found this:
https://android.googlesource.com/ke...-bullhead-3.10-nougat/drivers/misc/apds993x.c
which contains
Code:
static ssize_t apds993x_show_ch0data(struct device *dev,
struct device_attribute *attr, char *buf)
and
static ssize_t apds993x_show_ch1data(struct device *dev,
struct device_attribute *attr, char *buf)
I have flash ElementalX:
https://forum.xda-developers.com/nexus-5x/orig-development/kernel-elementalx-n5x-t3240537
which have the apds993x.c in source.
But I'm so new to kernel development that I don't know how to read these values.
So can somebody help me with this:
Are these value been write to sysfs, if yes, where are they in the /sys/.. ?
How can I read these value out?
Thank you so much!