File: usb-template.rules.in

package info (click to toggle)
brltty 6.9-1
  • links: PTS, VCS
  • area: main
  • in suites:
  • size: 44,828 kB
  • sloc: ansic: 154,246; java: 13,514; sh: 9,934; xml: 5,672; tcl: 2,679; makefile: 2,346; awk: 713; lisp: 366; python: 321; ml: 301
file content (84 lines) | stat: -rw-r--r-- 3,035 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
###############################################################################
# BRLTTY - A background process providing access to the console screen (when in
#          text mode) for a blind person using a refreshable braille display.
#
# Copyright (C) 1995-2025 by The BRLTTY Developers.
#
# BRLTTY comes with ABSOLUTELY NO WARRANTY.
#
# This is free software, placed under the terms of the
# GNU Lesser General Public License, as published by the Free Software
# Foundation; either version 2.1 of the License, or (at your option) any
# later version. Please see the file LICENSE-LGPL for details.
#
# Web Page: http://brltty.app/
#
# This software is maintained by Dave Mielke <dave@mielke.cc>.
###############################################################################

#########################################################################
# Udev rules for starting BRLTTY when a USB braille device is connected #
#########################################################################

SUBSYSTEM=="usb_device", GOTO="brltty_usb_begin"
SUBSYSTEM=="usb", KERNEL!="*:*", GOTO="brltty_usb_begin"
GOTO="brltty_device_end"

LABEL="brltty_usb_begin"
# BEGIN_USB_BRAILLE_DEVICES
# END_USB_BRAILLE_DEVICES
GOTO="brltty_device_end"

LABEL="brltty_usb_run"
SYMLINK+="brltty/USB-Mfr:$attr{manufacturer}-Prd:$attr{product}-Ser:$attr{serial}"
ENV{BRLTTY_BRAILLE_DEVICE}="usb:vendor=0X$sysfs{idVendor}+product=0X$sysfs{idProduct}+serial=$sysfs{serial}"
GOTO="brltty_device_run"

LABEL="brltty_device_run"
TEST=="/sys/fs/cgroup/systemd", GOTO="brltty_systemd"
TEST=="/run/systemd/system", GOTO="brltty_systemd"
ENV{BRLTTY_PID_FILE}="/run/brltty/brltty.$kernel.pid"

TEST=="/etc/init", GOTO="brltty_upstart"
TEST=="/etc/event.d", GOTO="brltty_upstart"

ACTION=="add", GOTO="brltty_udev_add"
ACTION=="remove", GOTO="brltty_udev_remove"
GOTO="brltty_device_end"

LABEL="brltty_udev_add"
RUN+="@HELPERS_DIRECTORY@/udev-wrapper"
GOTO="brltty_device_end"

LABEL="brltty_udev_remove"
RUN+="@HELPERS_DIRECTORY@/udev-wrapper -C"
GOTO="brltty_device_end"

LABEL="brltty_upstart"
ACTION=="add", GOTO="brltty_upstart_start"
ACTION=="remove", GOTO="brltty_upstart_stop"
GOTO="brltty_device_end"

LABEL="brltty_upstart_start"
PROGRAM="/sbin/initctl status brltty", RESULT=="*running*", GOTO="brltty_upstart_restart"
RUN+="/sbin/initctl start --quiet --no-wait brltty 'BRLTTY_BRAILLE_DEVICE=$env{BRLTTY_BRAILLE_DEVICE}' 'BRLTTY_BRAILLE_DRIVER=$env{BRLTTY_BRAILLE_DRIVER}'"
GOTO="brltty_device_end"

LABEL="brltty_upstart_restart"
RUN+="/sbin/initctl restart --quiet --no-wait brltty 'BRLTTY_BRAILLE_DEVICE=$env{BRLTTY_BRAILLE_DEVICE}' 'BRLTTY_BRAILLE_DRIVER=$env{BRLTTY_BRAILLE_DRIVER}'"
GOTO="brltty_device_end"

LABEL="brltty_upstart_stop"
RUN+="/sbin/initctl stop --quiet --no-wait brltty"
GOTO="brltty_device_end"

LABEL="brltty_systemd"
TAG+="systemd"
ACTION=="add", GOTO="brltty_systemd_add"
GOTO="brltty_device_end"

LABEL="brltty_systemd_add"
ENV{SYSTEMD_WANTS}+="brltty-device@.service"
GOTO="brltty_device_end"

LABEL="brltty_device_end"