Commit 18efbfcc authored by spiiroin's avatar spiiroin

[android] Normalize numerical id-values to lower case hex. JB#41748

Configfs wants to have numbers in '0xbeef' form while android usb wants to
have 'beef'. Normalizing the output to expected format allows either form
to be used in usb-moded configuration files.
Signed-off-by: spiiroin's avatarSimo Piiroinen <simo.piiroinen@jollamobile.com>
parent 4f9ffa6d
......@@ -267,7 +267,15 @@ bool
android_set_productid(const char *id)
{
bool ack = false;
if( id && android_in_use() ) {
char str[16];
char *end = 0;
unsigned num = strtol(id, &end, 16);
if( end > id && *end == 0 ) {
snprintf(str, sizeof str, "%04x", num);
id = str;
}
ack = write_to_file(ANDROID0_ID_PRODUCT, id) != -1;
}
log_debug("ANDROID %s(%s) -> %d", __func__, id, ack);
......@@ -283,6 +291,13 @@ android_set_vendorid(const char *id)
{
bool ack = false;
if( id && android_in_use() ) {
char str[16];
char *end = 0;
unsigned num = strtol(id, &end, 16);
if( end > id && *end == 0 ) {
snprintf(str, sizeof str, "%04x", num);
id = str;
}
ack = write_to_file(ANDROID0_ID_VENDOR, id) != -1;
}
log_debug("ANDROID %s(%s) -> %d", __func__, id, ack);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment