简体   繁体   中英

LG WebOs How to get device Mac address?

Do somebody know, how to get the device Mac address of a lg smart TV with WebOs programmatically ?

I have a Smart TV application and want to read out the device Mac address of the lg smart TV.

Thanks.

There is no way to get MAC address using WebOS internal apis. If you happened to be looking for device unique id (UID) then this might help you. Link to webos-service-api

网络扫描仪应该可以完成这项工作https://www.fing.io

As you know webos is linux based system. It is possible to get mac address from file. It worked on webos.

Ethernet: file:///sys/class/net/eth0/address Wireless: file:///sys/class/net/wlan0/address

<body onload="read_status()">
  <div class="macTest">

  </div>
</body>

A simple code for jquery;

function read_status() {
    $.get( "file:///sys/class/net/wlan0/address", function( data ) {
         $(".macTest").append("<h5>Mac Address: "+ data +"</h5><br>");
    });
}
let mac = '';
let mac2 = '';
webOS.service.request("luna://com.webos.service.connectionmanager", {
    method: "getinfo",
    parameters: {},
    onSuccess: function (args) {
        mac = args.wiredInfo.macAddress;
        mac2 = args.wifiInfo.macAddress;
    },
    onFailure: function (args) {
        
    }
}); 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM