mirror of
git://projects.qi-hardware.com/xburst-tools.git
synced 2024-12-23 13:22:25 +02:00
Use different MACs for the host and for the device ends of usb link
This makes Qi consistent with current SHR boot script. It assigns the MAC specified on the identity partition to the device and the next address to the host, ie: from "g_ether.dev_addr=00:1F:11:01:58:67" generate "g_ether.host_addr=00:1F:11:01:58:68". Signed-off-by: Paul Fertser <fercerpav@gmail.com>
This commit is contained in:
parent
8089e8de8b
commit
141b2bedfc
@ -558,6 +558,22 @@ void post_serial_init_gta02(void)
|
||||
puts("BATTERY CONDITION LOW\n");
|
||||
}
|
||||
|
||||
/*
|
||||
* Increment a hexadecimal digit represented by a char and
|
||||
* return 1 if an overflow occured.
|
||||
*/
|
||||
static char inc_hexchar(char * p)
|
||||
{
|
||||
if (*p == '9')
|
||||
*p = 'A';
|
||||
else if (*p != 'F')
|
||||
(*p)++;
|
||||
else {
|
||||
*p = '0';
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* create and append device-specific Linux kernel commandline
|
||||
@ -569,6 +585,7 @@ void post_serial_init_gta02(void)
|
||||
char * append_device_specific_cmdline_gta02(char * cmdline)
|
||||
{
|
||||
int n = 0;
|
||||
int i;
|
||||
int len;
|
||||
static char mac[64];
|
||||
struct kernel_source const * real_kernel = this_kernel;
|
||||
@ -632,10 +649,17 @@ char * append_device_specific_cmdline_gta02(char * cmdline)
|
||||
|
||||
mac[len] = '\0';
|
||||
|
||||
cmdline += strlen(strcpy(cmdline, " g_ether.host_addr="));
|
||||
cmdline += strlen(strcpy(cmdline, " g_ether.dev_addr="));
|
||||
cmdline += strlen(strcpy(cmdline, &mac[2]));
|
||||
|
||||
cmdline += strlen(strcpy(cmdline, " g_ether.dev_addr="));
|
||||
for (i = 0; i != 10; i++) {
|
||||
if ((i % 3) == 2)
|
||||
continue;
|
||||
if (!inc_hexchar(mac + 18 - i))
|
||||
break; /* Carry not needed. */
|
||||
}
|
||||
|
||||
cmdline += strlen(strcpy(cmdline, " g_ether.host_addr="));
|
||||
cmdline += strlen(strcpy(cmdline, &mac[2]));
|
||||
*cmdline++ = ' ' ;
|
||||
bail:
|
||||
|
Loading…
Reference in New Issue
Block a user