Hi all,
After my last email, I tried to find a stable solution to my problem. I
found one which is the following:
Instead of removing and creating again the device, now I just change the
identification string, from zero to the real one. The change is happening
in the same file, src/detect.c and as follows:
...
device = find_device(index);
if (device != NULL) {
char *real_ident = idx2idnt(index);
char *curr_ident = connman_device_get_ident(device);
/*If curr_ident is zeroed then change it.*/
if (!g_strcmp0(curr_ident, "000000000000")) {
if (real_ident != NULL) {
connman_device_set_ident(device,
real_ident);
free(real_ident);
}
}
return;
}
...
In this change, I don't check the MAC address but the identification
string, which is the MAC address without the colons. If it is zero then get
the real identification and set this one as identification. For the real
identification I used a function in src/inet.c, index2ident, but because it
is static I created a wrapper function, idx2idnt, in order to use it.
I am open to any comments and/or suggestions.
Regards,
Stavros
PS.
The function idx2ident would be like
char *idx2idnt(int index)
{
return index2ident(index, NULL);
}
---------- Forwarded message ----------
From: Stavros Vagionitis <[email protected]>
Date: 13 June 2012 14:04
Subject: Get zeroed MAC address when USB dongle is plugged in.
To: [email protected]
Hi all,
I have the following problem, I describe it in steps:
1) I am connected to the ethernet and to wifi. The primary connection is
ethernet. In the log file that I have attached, you can see the output of
the commands cm list, ifconfig and iwconfig.
2) I unplug the USB dongle. You can see the debug output of connman in the
log after the "usb 1-1: USB disconnect..." line.
3) I plug in the USB dongle. You can see the debug output of connman after
the "usb 1-1: new high speed USB device..." line.
As you can see, when the wifi device is created has a zeroed MAC address.
Later on it gets the correct MAC address but the interface is not updated.
As a result the path to the services is different than before the
unplug/plug. So you cannot autoconnect to the network that you were
connected before because of the different path due to the change in MAC
address.
I use an old version of connman, 0.78, but I believe the same behavior
might exists to future versions. I haven't tested it yet with the latest
version 1.1 because it has some major API changes and I have to rewrite the
client I use for 0.78.
I try to find a solution. I found a kind of solution but it doesn't work
all the time, connman gets unstable. In the src/detect.c I added the
following in the detect_newlink function
...
device = find_device(index);
if (device != NULL) {
/*Get the current mac address*/
const char * zero_addr = "00:00:00:00:00:00";
char * curr_addr = connman_device_get_string(device,
"Address");
/*Compare with the zero address.*/
if (g_strcmp0(curr_addr, zero_addr))
return;
detect_dellink( type, index, flags, change);
}
...
This modification checks if the MAC address is zero. If it is true then
deletes the device (with detect_dellink) and continues to create a new one
with the correct MAC address. I am not sure if this is the correct approach
because connman gets unstable.
I would like to ask if you can suggest any other approach and if you came
across with this problem with USB dongles.
Some more information regarding the system. The Linux kernel is 2.6.29.6-33
in mipsel architecture. The wifi dongle has a Ralink RT3070 chipset. I have
downloaded the latest driver from the site of
Ralink<http://www.ralinktech.com/en/04_support/support.php?sn=501> and
built it with no problem.
Kind regards,
Stavros
_______________________________________________
connman mailing list
[email protected]
http://lists.connman.net/listinfo/connman