Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ev3dev-lang-cpp ready for ev3dev-stretch ? #47

Open
cho934 opened this issue Apr 5, 2019 · 5 comments
Open

ev3dev-lang-cpp ready for ev3dev-stretch ? #47

cho934 opened this issue Apr 5, 2019 · 5 comments

Comments

@cho934
Copy link
Contributor

cho934 commented Apr 5, 2019

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.

@ddemidov
Copy link
Owner

ddemidov commented Apr 5, 2019

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.

@cho934 cho934 mentioned this issue Apr 5, 2019
@cho934
Copy link
Contributor Author

cho934 commented Apr 6, 2019

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 ?

@ddemidov
Copy link
Owner

ddemidov commented Apr 6, 2019

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?

@cho934
Copy link
Contributor Author

cho934 commented Apr 8, 2019

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
Copy link
Contributor Author

cho934 commented Nov 1, 2019

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants