lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]



Hi everyone,

I follow the list since a while, but this is my first contribution. Thanks everyone for your support

Regarding the MAC address question, we also work with embedded Linux and what we do in such szenarios, is calling the OS interface functions using os.execute and shell commands.
Output will be save in a file and then, with strings parsed. The same functionality is used for reading process IDs, network usage, etc, and it is not *so* slow because we dump the information into a file in a Ramdisk.

For dumping the MAC Address, call os.execute ('ifconfig | grep HWaddr > [FILENAME]'). Then use io.open, read, close to get the info from the file into a lua string, then os.remove (to delete the file) and strings functions find (search for 'HWaddr ') and sub to extract the MAC info

Hope it helps

Regards,

José

> > I'm not doing licensing, instead I have multiple embedded devices that
> > are identical except for the MAC address. I'm trying to identify the
> > device. The devices are Linux based so I can write some C code to the
> > MAC address. I was trying to avoid the C code and the corresponding
> > build/install complications.
>
> Try nixio:
> http://dev.luci.midlink.org/nixio/doc/modules/nixio.html#nixio.getifaddrs
>
> Regards,
> miko
>