Ecm static MAC address


#1

Hi team,

I would like to set a static MAC address to the ecm (ethernet over USB) because it always changes after a reboot. I know, setNet can do that but only with eth0 and not with the usb0.

Anybody know what can be done?

Thanks!

Daniel


#2

Hi Daniel,

You can modify the file /etc/legato/usbsetup with the following to setup a static MAC address for ecm.

...
elif [ $usb_mode = "ecm" ]
then
    func="${func}ecm"
    echo "addr" > /sys/module/g_android/parameters/dev_addr <---- ADD THIS LINE OF CODE
...

where “addr” is your mac address.

After you reboot, your ecm should have a static MAC address.

NOTE: This is only a workaround at the moment. In the next release, ecm will be configured with a static MAC address by default.

Hope this helps,
Enoch


#3

Hi esun,

Thank you for your help.

I’ve try to do your modifications in the usbsetup but the MAC address continue being different each boot. This is how the /etc/legato/usbsetup file looks like:

..
    elif [ $usb_mode = "ecm" ]
    then
      func="${func}ecm"
      echo "06:99:7D:C2:73:C6" > /sys/module/g_android/parameters/dev_addr
    elif [ $usb_mode = "diag" ]
    then
      func="${func}diag"
      echo "diag" > /sys/class/android_usb/android0/f_diag/clients
    else
      func="${func}${usb_mode}"
    fi
  done
..

However, the dev_addr variable has changed (with the right MAC address):

cat /sys/module/g_android/parameters/dev_addr 
06:99:7D:C2:73:C6

Note: Before doing this, dev_addr output was: i[/i]

What I’m doing wrong? Is there something missing?

Thanks again

Daniel


#4

Have you upgraded to 15.01?


#5

Sorry for the delay,

It works! I had the 15.01 version installed and checking the file and also the usb0 configuration, it prints the right MAC every boot.

Thank you!

Daniel

PS: I was checking wrong the MAC of the usb0 device :S