完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
固定mac地址流程: 关闭原先的读取MAC地址文件->获取cpu串号->根据cpu串号计算一组能用的MAC地址->设置MAC地址。 此种固定方式即使重刷固件也不会改变MAC地址 生成MAC流程 1.全局变量system_serial_low为串号的低8位,system_serial_high为串号的高8位,先获取这两个值 2.判断这两个值是否小于0,如果小于0则取其绝对值 3.将这两个值转换为字符串,依次将字符串的两位转化为MAC地址的其中一个数据, 例如:读到的system_serial_high = 123456789,system_serial_low=789abcdef 则MAC = 12:34:56:78:ab:cd 4.最终判断MAC地址第一位是否为偶数,如果不是偶数,就当前这位数减1,使其变成偶数。 diff --git a/frameworks/base/services/core/java/com/android/server/WatchdogManagerService.java b/frameworks/base/services/core/java/com/android/server/WatchdogManagerService.java index 2c32ec3d15..57ab825dcd 100644 --- a/frameworks/base/services/core/java/com/android/server/WatchdogManagerService.java +++ b/frameworks/base/services/core/java/com/android/server/WatchdogManagerService.java @@ -155,8 +155,8 @@ public class WatchdogManagerService extends IWatchdogManager.Stub { mWatchdogReceiver = new WatchdogReceiver(); getNetworkManagementService(); - Message msg = mHandler.obtainMessage(MSG_SET_MAC); - mHandler.sendMessageAtTime(msg, SystemClock.uptimeMillis() + 10 * 1000); + //Message msg = mHandler.obtainMessage(MSG_SET_MAC); + //mHandler.sendMessageAtTime(msg, SystemClock.uptimeMillis() + 10 * 1000); } private boolean checkMacAddress(String macAddr) { diff --git a/kernel/drivers/net/ethernet/rockchip/gmac/stmmac_main.c b/kernel/drivers/net/ethernet/rockchip/gmac/stmmac_main.c index 5d2df5b4ff..6860e6e5fd 100755 --- a/kernel/drivers/net/ethernet/rockchip/gmac/stmmac_main.c +++ b/kernel/drivers/net/ethernet/rockchip/gmac/stmmac_main.c @@ -51,6 +51,9 @@ #include "stmmac_ptp.h" #include "stmmac.h" #include "../eth_mac.h" +#include +#include + #undef STMMAC_DEBUG /*#define STMMAC_DEBUG*/ @@ -1564,6 +1567,195 @@ static int stmmac_get_hw_features(struct stmmac_priv *priv) return hw_cap; } + +//整型输入x,输出对应的16进制字符串 +void int_to_hex_str(long int x,char *p) +{ + int t,i=0; + if(x<0) + { + x=-x; + *p='-'; + p++; + } + if(x==0) + *p='0'; + for(i=0;i<10;i++) + { + t=x%16; + x=x/16; + if(t<10) + *(p+9-i)=t+'0'; + else + *(p+9-i)=t+'A'-10; + if(x==0) + { + t=9-i; + break; + } + } + for( i=0;i<10-t;i++) + { + *(p+i)=*(p+t+i); + *(p+t+i)=' |