Difference between revisions of "Linux Tools"
From Healthcare Robotics Wiki
Advaitjain (Talk | contribs) (→udev for persistent device naming) |
Advaitjain (Talk | contribs) (→Steps in brief) |
||
| Line 44: | Line 44: | ||
* ''sudo /etc/init.d/udev restart'' | * ''sudo /etc/init.d/udev restart'' | ||
* ls /dev/robot -- to check whether the devices appear. | * ls /dev/robot -- to check whether the devices appear. | ||
| + | |||
| + | ==== Sample file ==== | ||
| + | Here is a sample 10-ROBOT.rules file that we use on our robot. | ||
| + | |||
| + | BUS=="usb", KERNEL=="ttyUSB*", SYSFS{idVendor}=="0403", SYSFS{idProduct}=="6001", SYSFS{serial}=="A7003N1b", SYMLINK+="robot/servo0" | ||
| + | BUS=="usb", KERNEL=="ttyUSB*", SYSFS{idVendor}=="0403", SYSFS{idProduct}=="6001", SYSFS{serial}=="ftDXR6FS", SYMLINK+="robot/zenither" <br> | ||
| + | SUBSYSTEMS=="usb", KERNEL=="ttyACM*", PROGRAM="/home/advait/ros/pkgs/ros-pkg-trunk/stacks/laser_drivers/hokuyo_node/bin/getID /dev/ttyACM%n q", ATTRS{manufacturer}=="Hokuyo Data Flex for USB", ATTRS{product}=="URG-Series USB Driver", SYMLINK+="robot/hokuyo_%c" <br> | ||
| + | BUS=="usb", SYSFS{idVendor}=="0403", SYSFS{idProduct}=="e729", SYSFS{serial}=="00000215", SYMLINK+="robot/segway_front" | ||
| + | BUS=="usb", SYSFS{idVendor}=="0403", SYSFS{idProduct}=="e729", SYSFS{serial}=="00000201", SYMLINK+="robot/segway_back" <br> | ||
| + | SUBSYSTEM!="usb", GOTO="robot_rules_end" | ||
| + | ACTION!="add", GOTO="robot_rules_end" | ||
| + | ATTRS{idVendor}=="0403", ATTRS{idProduct}=="e729", MODE="0660", GROUP="plugdev" | ||
| + | LABEL="robot_rules_end" | ||
==== More information ==== | ==== More information ==== | ||
* http://www.reactivated.net/writing_udev_rules.html#why | * http://www.reactivated.net/writing_udev_rules.html#why | ||
* detailed info about writing udev rules: http://www.reactivated.net/writing_udev_rules.html | * detailed info about writing udev rules: http://www.reactivated.net/writing_udev_rules.html | ||
Revision as of 14:08, 17 October 2009
Contents |
ssh-keygen
To be able to ssh to another machine without needing to type your passwd:
Generate keys: $ ssh-keygen -t rsa -b 1024
Use the default file name and empty pass phrase for password less authentication. This will generate keys in
$ .ssh/id_rsa.pub
Then secure shell copy to another host as authorized_keys
$ scp ~/.ssh/id_rsa.pub <machine name>:~/.ssh/authorized_keys
Instructions copied from: http://pr.willowgarage.com/wiki/GB_ssh-keygen
Additional keys can be named authorized_keys2 and so on.
command line tools: find, sed etc.
The find command is pretty nifty:
- find all directories whose name does not contain svn
- find . ! -path "*.svn*" -type d
- remove .svn folders, e.g. after copying a directory which is a local copy of a subversion repository
- rm -rvf `find . -name "*.svn"`
- recursively remove all the .pycs
- alias rmpyc='rm -vf *.pyc; rm -vf `find . -name *.pyc`'
- remove the pesky .pycs from the repository
- svn rm `find . -name "*.pyc"`
So is sed:
- replace update_path with load_manifest. (-i is doing an in-place replace, I believe)
- sed -i 's/update_path/load_manifest/' `find . -name "*.py"`
udev for persistent device naming
Steps in brief
- sudo lsusb -v >pre # with device being unplugged
- sudo lsusb -v >post # with device being plugged in
- diff pre post (or use meld for a nicer graphical tool for comparing files) # you can read the Serial Number on the line "iSerial" etc.
- Now edit the udev rules in /etc/udev/rules.d/10-ROBOT.rules
- sudo /etc/init.d/udev restart
- ls /dev/robot -- to check whether the devices appear.
Sample file
Here is a sample 10-ROBOT.rules file that we use on our robot.
BUS=="usb", KERNEL=="ttyUSB*", SYSFS{idVendor}=="0403", SYSFS{idProduct}=="6001", SYSFS{serial}=="A7003N1b", SYMLINK+="robot/servo0"
BUS=="usb", KERNEL=="ttyUSB*", SYSFS{idVendor}=="0403", SYSFS{idProduct}=="6001", SYSFS{serial}=="ftDXR6FS", SYMLINK+="robot/zenither"
SUBSYSTEMS=="usb", KERNEL=="ttyACM*", PROGRAM="/home/advait/ros/pkgs/ros-pkg-trunk/stacks/laser_drivers/hokuyo_node/bin/getID /dev/ttyACM%n q", ATTRS{manufacturer}=="Hokuyo Data Flex for USB", ATTRS{product}=="URG-Series USB Driver", SYMLINK+="robot/hokuyo_%c"
BUS=="usb", SYSFS{idVendor}=="0403", SYSFS{idProduct}=="e729", SYSFS{serial}=="00000215", SYMLINK+="robot/segway_front"
BUS=="usb", SYSFS{idVendor}=="0403", SYSFS{idProduct}=="e729", SYSFS{serial}=="00000201", SYMLINK+="robot/segway_back"
SUBSYSTEM!="usb", GOTO="robot_rules_end"
ACTION!="add", GOTO="robot_rules_end"
ATTRS{idVendor}=="0403", ATTRS{idProduct}=="e729", MODE="0660", GROUP="plugdev"
LABEL="robot_rules_end"
More information
- http://www.reactivated.net/writing_udev_rules.html#why
- detailed info about writing udev rules: http://www.reactivated.net/writing_udev_rules.html