kwo pushed a commit to branch master.

http://git.enlightenment.org/e16/e16-epplets.git/commit/?id=acefe58f1b0c6983ccc6b8551a606e4bc133af4c

commit acefe58f1b0c6983ccc6b8551a606e4bc133af4c
Author: Kim Woelders <k...@woelders.dk>
Date:   Fri Sep 3 06:08:40 2021 +0200

    E-Net: Enable specifying device in config (no UI).
---
 epplets/E-Net.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/epplets/E-Net.c b/epplets/E-Net.c
index adfb812..4c5208b 100644
--- a/epplets/E-Net.c
+++ b/epplets/E-Net.c
@@ -13,6 +13,7 @@ static int          up_val = 0;
 static int          down_val = 0;
 static double       up_last = 0;
 static double       down_last = 0;
+static const char  *netdev = "eth0";
 static Epplet_gadget load_up;
 static Epplet_gadget load_down;
 
@@ -22,12 +23,12 @@ cb_timer(void *data __UNUSED__)
    double              val = -1.0, val2 = -1.0, dval, dval2;
    unsigned char       invalid;
 
-   invalid = net_get_bytes_inout("eth0", &val, &val2);
+   invalid = net_get_bytes_inout(netdev, &val, &val2);
    if (invalid)
      {
        Epplet_dialog_ok
-          ("Unable to get network device statistics for eth0:  %s",
-           net_strerror(invalid));
+          ("Unable to get network device statistics for %s:  %s",
+           netdev, net_strerror(invalid));
        Epplet_Exit(1);
      }
    if (val != -1.0)
@@ -71,6 +72,8 @@ load_conf(void)
 
    s = Epplet_query_config_def("downstream_max", "1540000");
    downstream_max = (double)atof(s);
+
+   netdev = Epplet_query_config_def("device", "eth0");
 }
 
 static void

-- 


Reply via email to