[BRLTTY] [PATCH] don't steal abused USB ids

Stanislav Brabec sbrabec at suse.cz
Mon May 14 13:23:35 EDT 2018


Dave Mielke wrote:
> [quoted lines by Stanislav Brabec on 2018/05/14 at 17:23 +0200]

>> brltty cannot steal these USB ids. If the manufacturers fills at least
>> textual id of their devices, udev rules can use this for discrimination.
> 
> That's a good idea. Thanks. We'll look into it.

As I do not have any of these devices, I cannot verify that. If it is
possible, it could be easy and safe solution.

>> If not, such devices cannot be auto detected. (Or they can be detected
>> by an unsafe serial communication based helper.)
> 
> This turns out to be a matter of opinion. The users of braille devices with 
> those identifiers wouldn't like it very much if their devices weren't detected.

I am aware of this problem. But there is also a reverse side of the
problem: brltty is a part of default installation of many Linux
distributions (including all SUSE and openSUSE products). These rules
break many computers equipped with devices like USB-serial converters,
GPSes, AVR ISP programmers, Arduinos etc.

> Also, please try to imagine how difficult it is for a blind person to figure 
> out what the problem is when his braille debvice isn't working yet.

I am aware of this problem. Auto detection should be supported by the
manufacturers first in the order. Some UART bridge vendors even have a
special program to support unique USB id for commercial products based
on their devices.

But we have to live with such a broken devices.

Can you detect these devices by the serial communication somehow?

If not, we are lost and there is no automatic solution at all.


If yes, we can make a solution.

brltty is not only part of the default installation. It is even part of
the installer.

None of typical UART devices has to be supported by the installer.

Installer can relatively safely suppose that any USB UART bridge is a
Braille device. (With the above mentioned exception.)


Here is my proposal:

1. Distribute udev rules without generic USB UART ids.

2. Installer will suppose Braille device.

3. In the beginning of the installation something like
brltty-uart-detect will be called. If any UART device is detected as
Braille device, it will generate e. g. /etc/udev/rules.d/68-brltty.rules
with proper rules.

If we reach the worst case (no way to detect Braille device at all),
then brltty-uart-detect has to be interactive: ask user to reply,
whether it is a Braille device. In case of no response, it will be
considered as not Braille device.

Notes:

Serial communication with an unknown serial device is a bit unsafe.
Example: Serial UPS connected to USB UART Bridge. Some old UPS devices
have a single letter commands, including Power Off. If you send the
letter, computer will immediately turn off.

The above mentioned solution will still make impossible to use Arduino,
some GPS devices and generic USB to serial converters by blind people.
To solve this problem, it would be needed to limit the driver to a
particular USB port.

The (rejected) patch is not sufficient. Kernel still hooks to this
device. Here is an example of my GPS Qstarz BT-1000P with openSUSE
Leap 15.0:

lsusb
Bus 001 Device 009: ID 10c4:ea60 Cygnal Integrated Products, Inc. CP2102/CP2109 UART Bridge Controller [CP210x family]

dmesg
[48419.996278] usb 1-1.3: new full-speed USB device number 5 using ehci-pci
[48420.106379] usb 1-1.3: New USB device found, idVendor=10c4, idProduct=ea60
[48420.106386] usb 1-1.3: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[48420.106390] usb 1-1.3: Product: CP2102 USB to UART Bridge Controller
[48420.106394] usb 1-1.3: Manufacturer: Silicon Labs
[48420.106397] usb 1-1.3: SerialNumber: 0001
[48420.133630] usbcore: registered new interface driver usbserial_generic
[48420.133644] usbserial: USB Serial support registered for generic
[48420.135750] usbcore: registered new interface driver cp210x
[48420.135763] usbserial: USB Serial support registered for cp210x
[48420.135788] cp210x 1-1.3:1.0: cp210x converter detected
[48420.137735] usb 1-1.3: cp210x converter now attached to ttyUSB0
[48420.188395] usb 1-1.3: usbfs: interface 0 claimed by cp210x while 'brltty' sets config #1
[48420.189018] cp210x ttyUSB0: cp210x converter now disconnected from ttyUSB0
[48420.189041] cp210x 1-1.3:1.0: device disconnected
[48424.103414] input: BRLTTY 5.6 Linux Screen Driver Keyboard as /devices/virtual/input/input10

udevadm info --attribute-walk --path=/devices/virtual/input/input10
Udevadm info starts with the device specified by the devpath and then
walks up the chain of parent devices. It prints for every device
found, all possible attributes in the udev rules key format.
A rule to match, can be composed by the attributes of the device
and the attributes from one single parent device.

  looking at device '/devices/virtual/input/input10':
    KERNEL=="input10"
    SUBSYSTEM=="input"
    DRIVER==""
    ATTR{name}=="BRLTTY 5.6 Linux Screen Driver Keyboard"
    ATTR{phys}=="pid-11913/brltty/10"
    ATTR{properties}=="0"
    ATTR{uniq}==""

Reference to openSUSE bug:
https://bugzilla.opensuse.org/show_bug.cgi?id=1092839

-- 
Best Regards / S pozdravem,

Stanislav Brabec
software developer
---------------------------------------------------------------------
SUSE LINUX, s. r. o.                         e-mail: sbrabec at suse.com
Křižíkova 148/34 (Corso IIa)                  tel: +49 911 7405384547
186 00 Praha 8-Karlín                          fax:  +420 284 084 001
Czech Republic                                    http://www.suse.cz/
PGP: 830B 40D5 9E05 35D8 5E27 6FA3 717C 209F A04F CD76


More information about the BRLTTY mailing list