Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
    Sekilsgs2
    @Sekilsgs2
    I'm think no body help.. because need have cc board for this and.. my work not commercial. Now i'm using latest fw with my fix (using const struct) and writing ota backend - now all working but with simple changes...
    DrBomb
    @DrBomb
    Again, this could be better seen if you made a repro app and filed an issue
    Mark
    @markterrill
    mmm. stupid question time. how do you output a mg_str with frozen (ie a mg_rpc_send_responsef )
    presuming its: return json_printf(out, "{mac: %.Q, manu_hex: %.Q, sr_hex: %.*Q, model: %d}", p->mac.len, p->mac.p, p->manu_hex.len, p->manu_hex.p, p->sr_hex.len, p->sr_hex.p, (int)p->model);
    Mark
    @markterrill
    think i've realised my issue, I'm not outputting a struct, i'm outputting an array of structs.
    Mark
    @markterrill
    that's got me stumped. appreciate any advice on how I could output an array of struct ie mystruct[1] = {'mark', 'terrill',99}; mystruct[2]={'john','citizen',30}; becomes json of people:[{name:"Mark",surname:"Terrill",age:99}, {name:"John", surname:"Citizen",age:30}]
    Mark
    @markterrill
    think I've figured out how json_printf effectively concats output, along with using len = json ... it seems to be working. Just struggling with passing some variable values around.
    Liviu
    @nliviu
    json_printf_array() might help.
    Mark
    @markterrill
    i basically used that as a base
    it seems to be looping and working
    just having issues between the various BLE advertisement fields and outputting to RPC!
    ie, i trigger a scan via rpc. it outputs the current 'nearby' array of structs and then starts a ble scan. the scan stores the results of the scan (mac, manu, service data, and interpreted hardware device model enum).
    so basically you call the same thing 6 seconds apart and you've got the nearby devices. i may separate that into 'scan' and 'retrieve' but it suits my purposes at the mo.
    Mark
    @markterrill
    i had been trying to store the ble_data->adv_data and & scan_rsp as a mg_str, but that doesn't seem to have worked out well
    gadget-man
    @gadget-man
    I’m trying to make a basic api call to https://api.ipify.org, but I get the following error appearing:
    mg_ssl_if_mbedtls.c:30  0x3ffefa14 ciphersuite: TLS-ECDHE-RSA-WITH-AES-128-GCM-SHA256
    mg_ssl_if_mbedtls.c:30  0x3ffefa14 x509_verify_cert returned -9984
    mg_ssl_if_mbedtls.c:30  0x3ffefa14   The certificate is not correctly signed by the trusted CA
    The certificate is signed with an unacceptable hash.
    mg_ssl_if_mbedtls.c:206 0x3ffefa14 mbedTLS error: -0x2700
    I’ve tried just browsing to the site from a browser and the certificate seems, fine, expires 19 Feb 2022, issued by Sectigo RAS Domain Validation Secure Server CA. Is there something I should be doing in my firmware to recognise this CA?
    Liviu
    @nliviu
    Did you include the ca-bundle library?
    Liviu
    @nliviu
    [Feb 17 21:26:40.258] mongoose.c:4912         0x3ffc7ad8 ciphersuite: TLS-ECDHE-RSA-WITH-AES-128-GCM-SHA256
    [Feb 17 21:26:40.264] mgos_mongoose.c:66      New heap free LWM: 211996
    [Feb 17 21:26:41.042] mgos_mongoose.c:66      New heap free LWM: 207700
    [Feb 17 21:26:41.046] mgos_sntp.c:98          SNTP query to time.google.com
    [Feb 17 21:26:41.109] mgos_sntp.c:61          SNTP reply from 216.239.35.12: time 1613590001.858544, local 4.775971, delta 1613589997.082573
    [Feb 17 21:26:41.205] main.c:40               ipify_handler:40 - MG_EV_CONNECT - ev_data=0
    [Feb 17 21:26:41.365] main.c:44               ipify_handler:44 - MG_EV_HTTP_REPLY - body: [my_ip]
    gadget-man
    @gadget-man
    No as it’s such a large file - so I include my own ca.pem!!! Thanks I’ll have a look at the latest ca-bundle and try and work out which one i’m missing
    gadget-man
    @gadget-man
    Wierd - I updated my ca.pem to include everything from ca-bundle’s version (plus one additional one for COMODO RSA Certification Authority) but it still fails with the same error
    Sergio R. Caprile
    @scaprile
    @gadget-man I've had a similar problem some time ago. Unfortunately I can't remember exactly what. The main issue (IIRC) turned out to be mbed-TLS not accepting certificates signed with SHA1. Try signing with a different hash algorithm
    Sergio R. Caprile
    @scaprile
    SHA256 should be fine, as that seems to be what I used.
    gadget-man
    @gadget-man
    But this is a public website I’m trying to access. And what’s really odd is that it worked for @nliviu using the same ca.pem (unless I’ve done something wrong)
    Sergio R. Caprile
    @scaprile
    I've found my issue (1 year ago) and yes, I was using SHA-1 signed certificates and I got that very same error message when trying TLS dual authentication (mOS was the server). The problem might be your certificate. I re-signed with SHA-256 and it worked. I'm sorry I can't run that again to check the ciphersuite string.
    Sekilsgs2
    @Sekilsgs2

    Гыыы. I'm finaly find where problem for me - due to incorrect result of this function -

    bool mgos_config_is_default_str(const char *s) {
      int num_str = (sizeof(mgos_config_str_table) / sizeof(mgos_config_str_table[0]));
      for (int i = 0; i < num_str; i++) {
        if (mgos_config_str_table[i] == s) return true;  // this not always correct
      }
      return false;
    }

    And fix for this -

    bool mgos_config_is_default_str(const char *s) {
      int num_str = (sizeof(mgos_config_str_table) / sizeof(mgos_config_str_table[0]));
      for (int i = 0; i < num_str; i++) {
        if (strcmp(mgos_config_str_table[i],s) == 0) return true;
      }
      return false;
    }

    Now my cc3220 never crashing.
    Need make PR.

    gadget-man
    @gadget-man

    I've found my issue (1 year ago) and yes, I was using SHA-1 signed certificates and I got that very same error message when trying TLS dual authentication (mOS was the server). The problem might be your certificate. I re-signed with SHA-256 and it worked. I'm sorry I can't run that again to check the ciphersuite string.

    Many thanks for this, but I’m not clear what I can do about it. I’m using the standard ca.pem file and the server isn’t under my control. Is there something I need to do to re-sign a certificate with SHA-256 that is saved to my firmware?

    Sergio R. Caprile
    @scaprile
    Can you tell if your connection is simple TLS (your client verifies server's identity) or dual/mutual TLS (both parties authenticate each other) ? In the second case you require your own certificate and key; you can check your certificate signature by opening it on a computer. In the first case you shouldn't have problems, but I didn't try mOS as a HTTP client so I don't know.
    gadget-man
    @gadget-man
    I’m just calling a basic http query:
    let ipURL = "https://api.ipify.org/?format=json";
        HTTP.query({
          url: ipURL,
          success: function (body, full_http_msg) {
            let response = JSON.parse(body);
            li("IP: " + js(response.ip));
    etc...
    Sergio R. Caprile
    @scaprile
    I would guess that the server will not ask for mutual authentication... so you should not need your own certificate and key; just the CA certificate to validate the server's claim of being himself should do.
    I don't know if mbed-TLS would complain if this cert is SHA-1 signed, but since you say it worked for Liviu, if the site is the same, I'm clueless.
    Jan
    @janko.valiska:matrix.org
    [m]
    Hi, please is there some general guide how to make esp8266 AP+STA mode stable? Currently sometimes the client is disconnected from AP and connected back within one second.
    AP and STA uses different channels
    Jan
    @janko.valiska:matrix.org
    [m]
    Hi, are wifi credentials stored unencryoted in the mongoose configuration file? Or are they readable by viewing FW binary?
    DrBomb
    @DrBomb
    Unencrypted on the mongoose config yes, readable by the viewing FW binary. Yes too
    But the latter could be deterred by enabling flash encryption
    Jan
    @janko.valiska:matrix.org
    [m]
    but probably flash encryption isn't case for ESP8266 right? I found that flash encryption is added to ESP32, but i didn't found something similar for ESP8266.
    DrBomb
    @DrBomb
    Oh yeah, I thought you were working with the esp32
    Deomid Ryabkov
    @rojer
    right, ESP8266 lacks any kind of confidentiality protection capabilities
    Márk Antal Csizmadia
    @mark-antal-csizmadia

    Hi all,

    I've had an issue lately with changing STA the configuration and reconnecting to a network.

    My goal is: to reconfigure WiFi credentials without having to reboot. The use case here is that the WiFi credentials were initially misconfigured (wrong password, for example), and I would like the end user to be able to correct the password without rebooting the device. The configuration is done through connecting to the ESP32 in AP mode, so I don’t want the bonding between device and user (mobile phone via app) to be broken.
    My actions are: I’ve tried two methods. Each begins with setting the new credentials with mgos_sys_config_set_wifi_sta_ssid() and mgos_sys_config_set_wifi_sta_pass().

    I’ve tried (1) calling mgos_wifi_disconnect() and then mgos_wifi_connect(), (2) trying to reset the WiFi sta like so:

    struct mgos_config_wifi_sta sta_config = {
            .enable = true,
            .ssid = ssid,
            .pass = pass,
    };
    
    mgos_wifi_disconnect();
    
    if (mgos_wifi_setup_sta(&sta_config)) {
            mg_rpc_send_responsef(ri, "ok");
    } else {
            mg_rpc_send_responsef(ri, "couldn't set up sta");
    }

    where ssid and pass are the new SSID and password, respectively, and (3) seting up the entire WiFi modoule (both AP and STA) such that

    mgos_wifi_setup((struct mgos_config_wifi *)mgos_sys_config_get_wifi())

    in which case the AP is also restarted, which I do not want. I only want the STA to restart, but not the AP.

    The result I see is: I’m still connecting to the same network. Nevertheless, observing

    sta_cfg.ssid

    and

    sta_cfg.pass

    seems to have the correct credentials. However, my ESP32 still seems to be connecting with the previous, incorrect password.

    Trying to set an incorrect password, for example, will not disconnect me from the AP.
    My expectation & question is: I expect to be able to smoothly change WiFi creds while the device is running without any restarts. Is this possible?

    I would greatly appreciate your help! Have a great day!

    hdmt-hock
    @hdmt-hock

    Hello, anyone know of solution to change mos latest 74 to mos release 2.19 in mac mojave?

    $ mos version
    The Mongoose OS command line tool
    Version: 74
    Build ID: 74~brew
    Update channel: latest

    I have tried "mos update release", brew uninstall and re-install, delete and install. At the end still end up mos latest.

    ALSO, mos local build on mac os is stuck at "Docker arguments: run ..." for the last 2 hr, cancel build and retry still the same, but was working at least 1 build this morning. However, running mos build in AWS EC2 linux with mos release 2.19 is working.

    janko.valiska
    @janko.valiska:matrix.org
    [m]
    Hi guys, on ESP8266 platform is time_t defined as number of seconds since epoch? Or is it in another(platform defined) units? If yes, is there some nice way how can i convert value stored in time_t to seconds?
    Liviu
    @nliviu
    @janko.valiska:matrix.org Yes.
    janko.valiska
    @janko.valiska:matrix.org
    [m]
    Sorry i placed 3 questions. So your yes belongs to first question? 😀
    Liviu
    @nliviu
    Sure.
    janko.valiska
    @janko.valiska:matrix.org
    [m]
    Thank you
    Liviu
    @nliviu
    @hdmt-hock Did you try this?
    Giuseppe Bertucci
    @giuseppe-bertucci

    hello folks, having a weird behaviour in mos tool while trying to add a library to my project.
    The library is https://github.com/ellavas/mongoose-lib-hlw8012, when I checkout the project and build it by itself it works fine (it returns a nice Lib saved to build/lib.a)
    Although, when I add the dependency to my project with

    libs:
      - origin: https://github.com/ellavas/mongoose-lib-hlw8012

    I get the following error:

      CC    /home/leo/dev/mos/app-demo/build/gen/build_info.c
      LD    /home/leo/dev/mos/app-demo/build/objs/app-demo.elf
    /opt/Espressif/xtensa-lx106-elf/lib/gcc/xtensa-lx106-elf/9.2.0/../../../../xtensa-lx106-elf/bin/ld: /home/leo/dev/mos/app-demo/build/objs/mgos_deps_init.c.o:(.rodata.mgos_libs_info+0x104): undefined reference to `mgos_mongoose_lib_hlw8012_init'
    collect2: error: ld returned 1 exit status
    /home/leo/dev/mos/app-demo/deps/modules/mongoose-os/platforms/esp8266/Makefile.build:360: recipe for target '/home/leo/dev/mos/app-demo/build/objs/app-demo.elf' failed
    make: Leaving directory '/app'
    make: *** [/home/leo/dev/mos/app-demo/build/objs/app-demo.elf] Error 1
    Error: exit status 2

    any ideas or workaround? I'd be happy to use directly the lib.a file if there's a way to do so (though is not ideal)

    Giuseppe Bertucci
    @giuseppe-bertucci

    answering my own question for other people benefit, I could either use

    binary_libs:
      - mylib/mylib.a

    as per documentation, or override lib name (the init method apparently is built conventionally using lib name) via

      - origin: https://github.com/ellavas/mongoose-lib-hlw8012
        name: hlw8012 # this makes the trick