Forum Discussion

scottchiefbaker's avatar
13 years ago

Determining mac address and connection type (wired/wireless)

I've found GetDeviceEsn(), but I'm hoping I to get some more information out of my app. I'd like to pull out connection type (wired vs wireless), and also the mac address of the ethernet port. Is there any corollation between the Esn and the MAC Address? Another vendor I dealt with tied their serial numbers to the mac address like so: mac_address = hex(serial_number * 2). Is there any way I can determine the ethernet mac address inside my app?
  • You can get the connection type via roDeviceInfo.GetIPAddrs(). If eth0 has an IP address, it's wired. If eth1 has an IP address, it's wireless. I don't know of any way to get the MAC address.
  • I can't believe I'm the only one whose ever wanted to get the mac address! Why isn't there a way to grab it?
  • Mac addresses are guaranteed to be globally unique. All the rest of our infrastructure is based on MAC addresses: STBs, Modems, Routers, etc. Roku will be the exception. Now I have to have different code to handle Roku than my existing code.

    Ultimately I want to use it for STB authentication.
  • The DeviceUniqueId is also globally unique, actually with more guarantee of uniqueness than MAC addresses.

    --Mark
  • However, I should add, neither the MAC nor the DeviceUniqueId should be used to associate the device with an account, if that's what you meant by STB authentication. The SDK warns against this, so that a factory reset is guaranteed to remove any association between the device and any accounts. See section 4.2 of the Developer Guide.


    It is important not to keep any permanent device association stored on your server. Roku wants to give users the ability to do a "Factory Reset" and have any personally identifiable information wiped from the device. This includes removing any association with server side accounts.
  • I'd also point out that MAC addresses aren't guaranteed to be unique b/c it is very easy to change the mac address of an ethernet adaptor on a variety of platforms (not the Roku, but almost any platform with root access). Using mac address for authentication seems like a risky proposition.
  • "RokuMarkn" wrote:
    However, I should add, neither the MAC nor the DeviceUniqueId should be used to associate the device with an account, if that's what you meant by STB authentication. The SDK warns against this, so that a factory reset is guaranteed to remove any association between the device and any accounts. See section 4.2 of the Developer Guide.


    It is important not to keep any permanent device association stored on your server. Roku wants to give users the ability to do a "Factory Reset" and have any personally identifiable information wiped from the device. This includes removing any association with server side accounts.



    Indeed. The service should be generating a unique token for each Roku client. The Roku can then pass that token whenever authentication is needed (perhaps even on every API call). Should the subscription expire to the client otherwise need to be disconnected, just invalidate the token. With this, when the user removed the channel or resets their Roku, they will need to relink the Roku player to their account with the service, which is the desired behavior.