ev3dev-lang-cpp icon indicating copy to clipboard operation
ev3dev-lang-cpp copied to clipboard

ev3dev-lang-cpp ready for ev3dev-stretch ?

Open cho934 opened this issue 6 years ago • 5 comments

Hello,

Is everything is generated and modified for ev3dev-stretch ?

The first thing which is crashing is the power_supply... aïe.

Is it possible to make the update as soon as possible, please ? I'm testing all my devices on stretch this weekend.

cho934 avatar Apr 05 '19 19:04 cho934

Hi, I did not use the library myself for a long time, so the answer is probably no. I guess to make it useable again with stretch, you would need to adjust a couple of string constants (paths to devices, addresses, etc). If you are willing to test the changes and propose a pull request with fixes, I will be glad to accept it.

ddemidov avatar Apr 05 '19 19:04 ddemidov

I just found a boring bug to set a variable IR-PROX using proximity() to the IR Sensor

Using the function set_attr_string,

void device::set_attr_string(const std::string &name, const std::string &value)
{
    using namespace std;

    if (_path.empty())
        throw system_error(make_error_code(errc::function_not_supported),
                "no device connected ; [set_attr_string] path=" + _path + " name=" + name + " value=" + value);

    ofstream &os = ofstream_open(_path + name);
    if (os.is_open()) {
        if (!(os << value))
            throw system_error(std::error_code(errno, std::system_category()));
        return;
    }
    throw system_error(make_error_code(errc::no_such_device), "ofstream_open ; [set_attr_string] " + _path + name);
}

I received the following error:

terminate called after throwing an instance of 'std::system_error'
  what():  ofstream_open ; [set_attr_string] /sys/class/lego-sensor/sensor41/mode: No such device
Aborted

If I used my program with sudo, no error If I used shell cmd echo "IR-PROX" > /sys/class/lego-sensor/sensor41/mode , no error

What's wrong ? permissions ?

cho934 avatar Apr 06 '19 11:04 cho934

Does not look like a problem with permissions, since you were able to modify the value from the shell without sudo. Could the device be in an uninitialized state when you ran your first test? Would a delay of 0.5 seconds before setting the mode help?

ddemidov avatar Apr 06 '19 13:04 ddemidov

I'm currently using the MUX, So I need to initialize the device as an ir sensor first. Then I tried without delay to set the mode to continue to configure it. I'm going to check if I have the same issue without the MUX, and try with a delay...

cho934 avatar Apr 08 '19 23:04 cho934

Did someone already test the new release ev3dev-stretch-ev3-generic-2019-10-23 with ev3dev-lang-cpp ?

cho934 avatar Nov 01 '19 21:11 cho934