Commit f25b102d authored by kirk's avatar kirk

Remove zstick-configtty.sh and its documentation

parent 65f116b8
---
title: "Z-Stick Config TTY"
date: 2019-09-11T06:19:06-07:00
anchor: "configtty"
weight: 100
---
# Z-Stick Config TTY
Configure *udev* to give a predictable name to a USB Z-Wave controller using information obtained via `lsusb`.
## Script
[zstick-configtty.sh][]
## Usage
```bash
./zstick-configtty.sh -v VENDOR -p PRODUCT -n NAME
```
## Additional Information
Use lsusb before and after inserting the USB [Z-Wave][] controller to
find the values for `idVendor` and `idProduct`.
For example, before inserting an [Aeotec Z-Stick Gen5][] into my Pi,
`lsusb` displayed:
```bash
lsusb
Bus 001 Device 009: ID 1058:25ee Western Digital Technologies, Inc.
Bus 001 Device 008: ID 1058:25a2 Western Digital Technologies, Inc.
Bus 001 Device 007: ID 045b:0209 Hitachi, Ltd
Bus 001 Device 005: ID 045b:0209 Hitachi, Ltd
Bus 001 Device 006: ID 0424:7800 Standard Microsystems Corp.
Bus 001 Device 003: ID 0424:2514 Standard Microsystems Corp. USB 2.0 Hub
Bus 001 Device 002: ID 0424:2514 Standard Microsystems Corp. USB 2.0 Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
```
After inserting the [Z-Stick][Aeotec Z-Stick Gen5]:
```bash
Bus 001 Device 009: ID 1058:25ee Western Digital Technologies, Inc.
Bus 001 Device 008: ID 1058:25a2 Western Digital Technologies, Inc.
Bus 001 Device 007: ID 045b:0209 Hitachi, Ltd
Bus 001 Device 005: ID 045b:0209 Hitachi, Ltd
Bus 001 Device 004: ID 0658:0200 Sigma Designs, Inc.
Bus 001 Device 006: ID 0424:7800 Standard Microsystems Corp.
Bus 001 Device 003: ID 0424:2514 Standard Microsystems Corp. USB 2.0 Hub
Bus 001 Device 002: ID 0424:2514 Standard Microsystems Corp. USB 2.0 Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
```
So the info for the stick is:
```bash
Bus 001 Device 004: ID 0658:0200 Sigma Designs, Inc.
```
Meaning `vendorId` is `0658` and `productId` is `0200`. So to give the
Z-Stick the name `tty-zstick` you would invoke this script as:
```bash
./rpi-zstick-configtty -v 0658 -p 0200 -n tty-zstick
```
> You must run `lsusb` on your own system and substitute the values it
> displays for `Device` and `ID`. Using the values shown above will
> only work if you have exactly the same make and model of [Z-Wave][]
> controller as I.
[zstick-configtty.sh]: /rpi-config/zstick-configtty.sh
[Aeotec Z-Stick Gen5]: https://aeotec.com/z-wave-usb-stick/
[z-wave]: https://z-wavealliance.org/
#!/bin/bash
# use lsusb before and after inserting the Z-Stick to find the values for idVendor and idProduct
# e.g. before inserting, lsusb displayed
# Bus 001 Device 009: ID 1058:25ee Western Digital Technologies, Inc.
# Bus 001 Device 008: ID 1058:25a2 Western Digital Technologies, Inc.
# Bus 001 Device 007: ID 045b:0209 Hitachi, Ltd
# Bus 001 Device 005: ID 045b:0209 Hitachi, Ltd
# Bus 001 Device 006: ID 0424:7800 Standard Microsystems Corp.
# Bus 001 Device 003: ID 0424:2514 Standard Microsystems Corp. USB 2.0 Hub
# Bus 001 Device 002: ID 0424:2514 Standard Microsystems Corp. USB 2.0 Hub
# Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
# after inserting,
# Bus 001 Device 009: ID 1058:25ee Western Digital Technologies, Inc.
# Bus 001 Device 008: ID 1058:25a2 Western Digital Technologies, Inc.
# Bus 001 Device 007: ID 045b:0209 Hitachi, Ltd
# Bus 001 Device 005: ID 045b:0209 Hitachi, Ltd
# Bus 001 Device 004: ID 0658:0200 Sigma Designs, Inc.
# Bus 001 Device 006: ID 0424:7800 Standard Microsystems Corp.
# Bus 001 Device 003: ID 0424:2514 Standard Microsystems Corp. USB 2.0 Hub
# Bus 001 Device 002: ID 0424:2514 Standard Microsystems Corp. USB 2.0 Hub
# Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
# so the info for the stick is
# Bus 001 Device 004: ID 0658:0200 Sigma Designs, Inc.
# meaning vendorId=[0658], productId=[0200] so to give the Z-Stick the
# name tty-zstick you would invoke this script as:
# ./rpi-zstick-configtty -v 0658 -p 0200 -n tty-zstick
usage() {
if [[ -n "$2" ]]; then
echo "$2" 1>&2
fi
echo "Usage: $0 -v vendorId -p productId -n name" 1>&2
exit $1
}
while getopts 'hv:p:n:' current; do
case "${current}" in
h)
usage 0
;;
v)
VENDOR="${OPTARG}"
;;
p)
PRODUCT="${OPTARG}"
;;
n)
NAME="${OPTARG}"
;;
:)
usage 4 "Missing value for -${OPTARG}"
;;
*)
usage 5
;;
esac
done
if [[ -z "${VENDOR}" ]]; then
usage 1 "Missing -v parameter"
fi
if [[ -z "${PRODUCT}" ]]; then
usage 2 "Missing -p parameter"
fi
if [[ -z "${NAME}" ]]; then
usage 3 "Missing -n parameter"
fi
cat <<EOF | sudo tee /etc/udev/rules.d/10-com.rules
SUBSYSTEM=="tty", ATTRS{idVendor}=="${VENDOR}", ATTRS{idProduct}=="${PRODUCT}", SYMLINK+="${NAME}", GROUP="dialout", MODE="0666"
EOF
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment