Closed laykuanloon closed 8 years ago
Hi @laykuanloon i think the pr below solves the problem, are you able to test ? https://github.com/solettaproject/meta-soletta/pull/111
@ceolin I have manually tested the script on my board (my board have no eth0), it will get the veth0 interface mac address. Is it possible to get eth0 or wlan0 first if it's available?
ip addr show scope global
of my board
2: veth0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 1000
link/ether 12:34:56:78:00:02 brd ff:ff:ff:ff:ff:ff
3: veth1: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 1000
link/ether fe:dc:ba:09:00:02 brd ff:ff:ff:ff:ff:ff
4: sit0@NONE:
I'll see how to escape all virtual/bridges links and change the script.
thanks for your reply !
@laykuanloon https://github.com/solettaproject/meta-soletta/pull/112
I think now it works. Could check it for me please ?
@ceolin,
I tested the new script. it will get the rndis0 address.
Following is the interface exist in your search path root@sofia-3gr:/sys/class/net# ls lo rndis0 sit0 veth0 veth1 wlan0
it's becoming harder :) This value you've got during the boot ? This macaddress just need to be unique since it's only used by avahi to expose this device. Hardcode the path to be wlan0 or eth0 is a bad idea since in other distros we're using names like wlps enps. This script checks only for real devices and excludes all virtual links like lo, veth, bridges and so on. I guess if both links, wlan0 and rndis0, are usb devices we don't have guarantee which one the kernel will load first (to check for the index).
I had tried other approach that was check for the route but this also did not worked because this script run during the boot and the device may not be online.
Trying to understand the real problem, what is the matter using the rndis macaddress to identify the devices ? it's only used to create a hostname, the ip used to connect will still be correct in the client because of avahi.
@ceolin
My board only have the wifi mac address sticker but not rndis mac address. If user want to know the rndis mac address then he need to connect serial cable, and type command in console to check. There is no problem for my development, I can use console to check.
Most of the final product will put eth0/wifi mac address, so I think to get eth0 or wifi mac address is better.
Suggestion?
@laykuanloon
I see, it's hard figure out which interface mac address to use. One solution is let the device name choice in the yocto layer, we exposes a variable (with the interface name) then when the image is generated that script will contain the interface that should be used. But this will be defined during the image generation (of course one can change it later). What you think about it ?
@ceolin I think is fine for me.
@elvinongbl is yocto expert and sensor lead in our team. maybe he can comment on your suggestion.
I agree with @ceolin on the proposal of letting the final end product maker to set the preferred interface through recipe. We may use "sed" operation in the recipe to alter the value that is to be set for INTERFACE within the sh script. Please make sure the default value is assigned in the yocto recipe by using ?= so that this default value can be easily change in local.conf.
guys, i've updated the pr with the changes we had discussed. Could you guys see it please ?
@ceolin, i have verified the recipe and soletta-dev-app-mac.sh. Is working fine.
@laykuanloon thanks for testing. Closing this issue.
https://github.com/solettaproject/meta-soletta/blob/master/recipes-soletta/dev-app/soletta-dev-app/soletta-dev-app-mac.sh#L2
INTERFACE="enp2s0"
The above script only cater for "enp2s0" network interface, is there a proper way to detect the platform available network interface or need to hard code per platform/system?