Skip to content

Instantly share code, notes, and snippets.

@raydac
Last active April 22, 2017 10:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save raydac/2d7bb49494b55ffd1bfc91a4616723ca to your computer and use it in GitHub Desktop.
Save raydac/2d7bb49494b55ffd1bfc91a4616723ca to your computer and use it in GitHub Desktop.
Script to make UDEV rule (for Ubuntu 16.04) to enable access of "scanner" group to port of Brother DCP-7055
#!/bin/bash
echo Make rule to enable USB port of Brother DCP-7055
if [ "$(id -u)" != "0" ]; then
echo "This script must be run as root" 1>&2
exit 1
fi
RULE_FOLDER=/etc/udev/rules.d
if [ -d $RULE_FOLDER ]
then
RULE_FILE="$RULE_FOLDER/99-brother_scanner.rules"
if [ -f $RULE_FILE ]
then
echo "File $RULE_FILE already presented!" 1>&2
else
echo "# Rule to enable USB port of Brother device DCP-7055 for 'scanner' group" >> $RULE_FILE
echo "# the file must be added into /etc/udev/rules.d under name 99-brother_scanner.rules" >> $RULE_FILE
echo "SUBSYSTEM==\"usb\", ACTION==\"add\", ATTRS{idVendor}==\"04f9\", ATTRS{idProduct}==\"0248\", OWNER=\"root\", GROUP=\"scanner\"" >> $RULE_FILE
echo "File $RULE_FILE has been successfuly generated"
fi
else
echo "Can't find UDEV rule folder $RULE_FOLDER" 1>&2
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment