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

Set udev rules for YARP devices that require administrative rights #2

Open
PeterBowman opened this issue Mar 23, 2018 · 3 comments
Open

Comments

@PeterBowman
Copy link
Member

Currently, there are two desktop shortcuts in scripts/gnome/ due to the need of launching the serialport device with sudo (ref). This is handled via gksudo, see:

Exec=gksudo -k -u root yarpmanager

A better option: keep one single shortcut file and install udev rules for offending devices.

Examples of udev rules:

@jgvictores
Copy link
Member

Related: asrob-uc3m/yarp-devices#14

@PeterBowman
Copy link
Member Author

PeterBowman commented Jun 19, 2018

Another example (private repo, so copy-pasting):

/scripts/CMakeLists.txt@roboticslab-uc3m/amor-api

if(UNIX)
    configure_file(${CMAKE_SOURCE_DIR}/cmake/templates/10-amor.rules.in
                   ${CMAKE_BINARY_DIR}/10-amor.rules)

    install(PROGRAMS amor_init_can.sh
            DESTINATION ${CMAKE_INSTALL_BINDIR}
            COMPONENT udev
            RENAME amor_init_can)

    install(FILES ${CMAKE_BINARY_DIR}/10-amor.rules
            DESTINATION /etc/udev/rules.d
            COMPONENT udev)
endif()

/cmake/templates/10-amor.rules.in@roboticslab-uc3m/amor-api (hiding ids out of paranoia)

ACTION=="add", SUBSYSTEM=="usb", ATTR{idVendor}=="xxxx", ATTR{idProduct}=="xxxx", RUN+="${CMAKE_INSTALL_FULL_BINDIR}/amor_init_can"

...and Cpack support: https://github.com/roboticslab-uc3m/amor-api/commit/5c76580014ff1c0f324c1e64bd202c5689667956.

@PeterBowman
Copy link
Member Author

Might be useful: https://github.com/greatscottgadgets/ubertooth/blob/a6332a7d0b74c9becf5d250111c5b222333faa0a/host/misc/udev/CMakeLists.txt.

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