diff options
author | David 'Digit' Turner <digit@google.com> | 2010-04-06 18:35:54 -0700 |
---|---|---|
committer | David 'Digit' Turner <digit@google.com> | 2010-04-06 18:35:54 -0700 |
commit | fbcab322c2a12bfe49d0faaef91fccdc7bb97d4e (patch) | |
tree | 8be7f9dab076439aa2c83d239b4f889db8e81359 /android/avd | |
parent | a1204591a52bf668ee72c86f98f53189621572a2 (diff) | |
download | external_qemu-fbcab322c2a12bfe49d0faaef91fccdc7bb97d4e.zip external_qemu-fbcab322c2a12bfe49d0faaef91fccdc7bb97d4e.tar.gz external_qemu-fbcab322c2a12bfe49d0faaef91fccdc7bb97d4e.tar.bz2 |
Automatically parse a file named 'hardware.ini' if it is found
in the skin directory, and we are using the Android build system.
Change-Id: I62480314f73ae60e769c113d6e4421e9946bb818
Diffstat (limited to 'android/avd')
-rw-r--r-- | android/avd/info.c | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/android/avd/info.c b/android/avd/info.c index 6766c96..d726112 100644 --- a/android/avd/info.c +++ b/android/avd/info.c @@ -139,6 +139,7 @@ struct AvdInfo { char* contentPath; IniFile* rootIni; /* root <foo>.ini file */ IniFile* configIni; /* virtual device's config.ini */ + IniFile* hardwareIni; /* skin-specific hardware.ini */ /* for both */ char* skinName; /* skin name */ @@ -172,6 +173,11 @@ avdInfo_free( AvdInfo* i ) i->configIni = NULL; } + if (i->hardwareIni) { + iniFile_free(i->hardwareIni); + i->hardwareIni = NULL; + } + if (i->rootIni) { iniFile_free(i->rootIni); i->rootIni = NULL; @@ -1328,6 +1334,30 @@ _getBuildSkin( AvdInfo* i, AvdInfoParams* params ) return 0; } +/* Read a hardware.ini if it is located in the skin directory */ +static int +_getBuildHardwareIni( AvdInfo* i ) +{ + char temp[PATH_MAX], *p=temp, *end=p+sizeof(temp); + + if (i->skinDirPath == NULL || i->skinName == NULL) + return 0; + + p = bufprint(temp, end, "%s/%s/hardware.ini", i->skinDirPath, i->skinName); + if (p >= end || !path_exists(temp)) { + DD("no skin-specific hardware.ini in %s", i->skinDirPath); + return 0; + } + + D("found skin-specific hardware.ini: %s", temp); + i->hardwareIni = iniFile_newFromFile(temp); + if (i->hardwareIni == NULL) + return -1; + + return 0; +} + + AvdInfo* avdInfo_newForAndroidBuild( const char* androidBuildRoot, const char* androidOut, @@ -1351,6 +1381,7 @@ avdInfo_newForAndroidBuild( const char* androidBuildRoot, /* we don't need to fail if there is no valid skin */ _getBuildSkin(i, params); + _getBuildHardwareIni(i); return i; @@ -1424,6 +1455,10 @@ avdInfo_getHwConfig( AvdInfo* i, AndroidHwConfig* hw ) if (ini != i->configIni) iniFile_free(ini); + if (ret == 0 && i->hardwareIni != NULL) { + ret = androidHwConfig_read(hw, i->hardwareIni); + } + /* special product-specific hardware configuration */ if (i->androidOut != NULL) { |