Считыватель QR-кодов в Ubuntu

Я пытаюсь использовать считыватель QR-кода в Ubuntu, но драйверы предназначены только для Windows. Есть ли возможность использовать его в Ubuntu?

Модель SL-QC15S .

lsusb:

Bus 002 Device 002: ID 058f:9360 Alcor Micro Corp. 8-in-1 Media Card Reader
Bus 002 Device 003: ID 0461:4d16 Primax Electronics, Ltd
Bus 002 Device 004: ID 0461:0010 Primax Electronics, Ltd
Bus 001 Device 005: ID 1871:0101 Aveo Technology Corp.
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub

xinput:

Virtual core pointer                        id=2    [master pointer  (3)]
⎜   ↳ Virtual core XTEST pointer                id=4    [slave  pointer  (2)]
⎜   ↳ USB Optical Mouse                         id=8    [slave  pointer  (2)]
⎣ Virtual core keyboard                     id=3    [master keyboard (2)]
    ↳ Virtual core XTEST keyboard               id=5    [slave  keyboard (3)]
    ↳ Power Button                              id=6    [slave  keyboard (3)]
    ↳ Power Button                              id=7    [slave  keyboard (3)]
    ↳ NOVATEK USB Keyboard                      id=9    [slave  keyboard (3)]
    ↳ NOVATEK USB Keyboard                      id=10   [slave  keyboard (3)]
    ↳ USB2.0 Camera                             id=11   [slave  keyboard (3)]

ls /dev/video*:

/dev/video0

Я думаю, что нужен драйвер, и у меня есть только драйверы Windows. Я думаю, что не могу сканировать коды, потому что в моем считывателе QR-кодов нет кнопок для сканирования. Запись такая:

Bus 001 Device 005: ID 1871:0101 Aveo Technology Corp.
Couldn't open device, some information will be missing
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               2.00
  bDeviceClass          239 Miscellaneous Device
  bDeviceSubClass         2 ?
  bDeviceProtocol         1 Interface Association
  bMaxPacketSize0        64
  idVendor           0x1871 Aveo Technology Corp.
  idProduct          0x0101
  bcdDevice            0.0c
  iManufacturer           1
  iProduct                2
  iSerial                 0
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength          419
    bNumInterfaces          2
    bConfigurationValue     1
    iConfiguration          0
    bmAttributes         0x80
      (Bus Powered)
    MaxPower              500mA
    Interface Association:
      bLength                 8
      bDescriptorType        11
      bFirstInterface         0
      bInterfaceCount         2
      bFunctionClass         14 Video
      bFunctionSubClass       3 Video Interface Collection
      bFunctionProtocol       0
      iFunction               2
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           1
      bInterfaceClass        14 Video
      bInterfaceSubClass      1 Video Control
      bInterfaceProtocol      0
      iInterface              2
      VideoControl Interface Descriptor:
        bLength                13
        bDescriptorType        36
        bDescriptorSubtype      1 (HEADER)
        bcdUVC               1.00
        wTotalLength           77
        dwClockFrequency       30.000000MHz
        bInCollection           1
        baInterfaceNr( 0)       1
      VideoControl Interface Descriptor:
        bLength                18
        bDescriptorType        36
        bDescriptorSubtype      2 (INPUT_TERMINAL)
        bTerminalID             1
        wTerminalType      0x0201 Camera Sensor
        bAssocTerminal          0
        iTerminal               0
        wObjectiveFocalLengthMin      0
        wObjectiveFocalLengthMax      0
        wOcularFocalLength            0
        bControlSize                  3
        bmControls           0x00000000
      VideoControl Interface Descriptor:
        bLength                 9
        bDescriptorType        36
        bDescriptorSubtype      3 (OUTPUT_TERMINAL)
        bTerminalID             2
        wTerminalType      0x0101 USB Streaming
        bAssocTerminal          0
        bSourceID               4
        iTerminal               0
      VideoControl Interface Descriptor:
        bLength                11
        bDescriptorType        36
        bDescriptorSubtype      5 (PROCESSING_UNIT)
      Warning: Descriptor too short
        bUnitID                 3
        bSourceID               1
        wMaxMultiplier          0
        bControlSize            2
        bmControls     0x0000053b
          Brightness
          Contrast
          Saturation
          Sharpness
          Gamma
          Backlight Compensation
          Power Line Frequency
        iProcessing             0
        bmVideoStandards     0x1a
          NTSC - 525/60
          SECAM - 625/50
          NTSC - 625/50
      VideoControl Interface Descriptor:
        bLength                26
        bDescriptorType        36
        bDescriptorSubtype      6 (EXTENSION_UNIT)
        bUnitID                 4
        guidExtensionCode         {52f2b8aa-d18e-7249-8ced-96b17f04408b}
        bNumControl             1
        bNrPins                 1
        baSourceID( 0)          3
        bControlSize            1
        bmControls( 0)       0x01
        iExtension              0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x85  EP 5 IN
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               7
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        1
      bAlternateSetting       0
      bNumEndpoints           0
      bInterfaceClass        14 Video
      bInterfaceSubClass      2 Video Streaming
      bInterfaceProtocol      0
      iInterface              0
      VideoStreaming Interface Descriptor:
        bLength                            14
        bDescriptorType                    36
        bDescriptorSubtype                  1 (INPUT_HEADER)
        bNumFormats                         1
        wTotalLength                      215
        bEndPointAddress                  131
        bmInfo                              0
        bTerminalLink                       2
        bStillCaptureMethod                 2
        bTriggerSupport                     1
        bTriggerUsage                       0
        bControlSize                        1
        bmaControls( 0)                    27
      VideoStreaming Interface Descriptor:
        bLength                            27
        bDescriptorType                    36
        bDescriptorSubtype                  4 (FORMAT_UNCOMPRESSED)
        bFormatIndex                        1
        bNumFrameDescriptors                5
        guidFormat                            {59555932-0000-1000-8000-00aa00389b71}
        bBitsPerPixel                      16
        bDefaultFrameIndex                  1
        bAspectRatioX                       0
        bAspectRatioY                       0
        bmInterlaceFlags                 0x00
          Interlaced stream or variable: No
          Fields per frame: 2 fields
          Field 1 first: No
          Field pattern: Field 1 only
          bCopyProtect                      0
      VideoStreaming Interface Descriptor:
        bLength                            30
        bDescriptorType                    36
        bDescriptorSubtype                  5 (FRAME_UNCOMPRESSED)
        bFrameIndex                         1
        bmCapabilities                   0x00
          Still image unsupported
        wWidth                            640
        wHeight                           480
        dwMinBitRate                147456000
        dwMaxBitRate                147456000
        dwMaxVideoFrameBufferSize      614400
        dwDefaultFrameInterval         333333
        bFrameIntervalType                  1
        dwFrameInterval( 0)            333333
      VideoStreaming Interface Descriptor:
        bLength                            30
        bDescriptorType                    36
        bDescriptorSubtype                  5 (FRAME_UNCOMPRESSED)
        bFrameIndex                         2
        bmCapabilities                   0x00
          Still image unsupported
        wWidth                            160
        wHeight                           120
        dwMinBitRate                  9216000
        dwMaxBitRate                  9216000
        dwMaxVideoFrameBufferSize       38400
        dwDefaultFrameInterval         333333
        bFrameIntervalType                  1
        dwFrameInterval( 0)            333333
      VideoStreaming Interface Descriptor:
        bLength                            30
        bDescriptorType                    36
        bDescriptorSubtype                  5 (FRAME_UNCOMPRESSED)
        bFrameIndex                         3
        bmCapabilities                   0x00
          Still image unsupported
        wWidth                            320
        wHeight                           240
        dwMinBitRate                 36864000
        dwMaxBitRate                 36864000
        dwMaxVideoFrameBufferSize      153600
        dwDefaultFrameInterval         333333
        bFrameIntervalType                  1
        dwFrameInterval( 0)            333333
      VideoStreaming Interface Descriptor:
        bLength                            30
        bDescriptorType                    36
        bDescriptorSubtype                  5 (FRAME_UNCOMPRESSED)
        bFrameIndex                         4
        bmCapabilities                   0x00
          Still image unsupported
        wWidth                            176
        wHeight                           144
        dwMinBitRate                 12165120
        dwMaxBitRate                 12165120
        dwMaxVideoFrameBufferSize       50688
        dwDefaultFrameInterval         333333
        bFrameIntervalType                  1
        dwFrameInterval( 0)            333333
      VideoStreaming Interface Descriptor:
        bLength                            30
        bDescriptorType                    36
        bDescriptorSubtype                  5 (FRAME_UNCOMPRESSED)
        bFrameIndex                         5
        bmCapabilities                   0x00
          Still image unsupported
        wWidth                            352
        wHeight                           288
        dwMinBitRate                 48660480
        dwMaxBitRate                 48660480
        dwMaxVideoFrameBufferSize      202752
        dwDefaultFrameInterval         333333
        bFrameIntervalType                  1
        dwFrameInterval( 0)            333333
      VideoStreaming Interface Descriptor:
        bLength                            18
        bDescriptorType                    36
        bDescriptorSubtype                  3 (STILL_IMAGE_FRAME)
        bEndpointAddress                    0
        bNumImageSizePatterns               3
        wWidth( 0)                        640
        wHeight( 0)                       480
        wWidth( 1)                        320
        wHeight( 1)                       240
        wWidth( 2)                        160
        wHeight( 2)                       120
        bNumCompressionPatterns             3
      VideoStreaming Interface Descriptor:
        bLength                             6
        bDescriptorType                    36
        bDescriptorSubtype                 13 (COLORFORMAT)
        bColorPrimaries                     1 (BT.709,sRGB)
        bTransferCharacteristics            1 (BT.709)
        bMatrixCoefficients                 4 (SMPTE 170M (BT.601))
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        1
      bAlternateSetting       1
      bNumEndpoints           1
      bInterfaceClass        14 Video
      bInterfaceSubClass      2 Video Streaming
      bInterfaceProtocol      0
      iInterface              0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x83  EP 3 IN
        bmAttributes            5
          Transfer Type            Isochronous
          Synch Type               Asynchronous
          Usage Type               Data
        wMaxPacketSize     0x020c  1x 524 bytes
        bInterval               1
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        1
      bAlternateSetting       2
      bNumEndpoints           1
      bInterfaceClass        14 Video
      bInterfaceSubClass      2 Video Streaming
      bInterfaceProtocol      0
      iInterface              0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x83  EP 3 IN
        bmAttributes            5
          Transfer Type            Isochronous
          Synch Type               Asynchronous
          Usage Type               Data
        wMaxPacketSize     0x030c  1x 780 bytes
        bInterval               1
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        1
      bAlternateSetting       3
      bNumEndpoints           1
      bInterfaceClass        14 Video
      bInterfaceSubClass      2 Video Streaming
      bInterfaceProtocol      0
      iInterface              0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x83  EP 3 IN
        bmAttributes            5
          Transfer Type            Isochronous
          Synch Type               Asynchronous
          Usage Type               Data
        wMaxPacketSize     0x03fc  1x 1020 bytes
        bInterval               1
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        1
      bAlternateSetting       4
      bNumEndpoints           1
      bInterfaceClass        14 Video
      bInterfaceSubClass      2 Video Streaming
      bInterfaceProtocol      0
      iInterface              0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x83  EP 3 IN
        bmAttributes            5
          Transfer Type            Isochronous
          Synch Type               Asynchronous
          Usage Type               Data
        wMaxPacketSize     0x0bfc  2x 1020 bytes
        bInterval               1
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        1
      bAlternateSetting       5
      bNumEndpoints           1
      bInterfaceClass        14 Video
      bInterfaceSubClass      2 Video Streaming
      bInterfaceProtocol      0
      iInterface              0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x83  EP 3 IN
        bmAttributes            5
          Transfer Type            Isochronous
          Synch Type               Asynchronous
          Usage Type               Data
        wMaxPacketSize     0x13fc  3x 1020 bytes
        bInterval               1

Драйверы для Windows

Нет, у меня нет веб-камеры на моем компьютере, только устройство для чтения QR-кодов.

5
задан 11 April 2015 в 03:04

4 ответа

QtQR является простым сканером QR-кода с помощью веб-камеры. Это может быть установлено от Центра программного обеспечения или из командной строки:

sudo apt-get install qtqr
7
ответ дан 11 April 2015 в 03:04

Кажется, что Ваше средство чтения QR-кода является просто камерой, и дополнительное программное обеспечение требуется считать QR-коды. Можно использовать zbarcam от zbar-tools для чтения QR-кодов.

zbarcam попытается декодировать штрихкоды и QR-коды от видеопотока, и произведет содержание просканированных кодов в stdout.

9
ответ дан 11 April 2015 в 03:04

Устройство является просто камерой, чтение обработки изображений и QR сделано в "dirver" компьютера. Если делают Вы хотите использовать его в Linux, поскольку это был "хороший" читатель, который имеет часть чтения на устройстве (Это действует как клавиатура, которая вводит все, что Вы сканируете), можно выполнить эти шаги:

  1. Установка необходимые пакеты: sudo apt-get install zbar-tools xdotool wmctrl
  2. Тип на терминале gksu gedit /etc/udev/rules.d/00-usb-qreader.rules
  3. текстовый редактор откроет, скопирует и вставит эти строки:

       ACTION=="add", SUBSYSTEM=="video4linux", ATTRS{idVendor}=="1871", ATTRS{idProduct}=="0101", ENV{XAUTHORITY}="/home/<your_username>/.Xauthority", ENV{DISPLAY}=":0", OWNER="<your_username>", RUN+="/usr/local/bin/usb-qreader", SYMLINK+="qreader"
       ACTION=="remove", SUBSYSTEM=="video4linux", ATTRS{idVendor}=="1871", ATTRS{idProduct}=="0101", ENV{XAUTHORITY}="/home/<your_username>/.Xauthority", ENV{DISPLAY}=":0", RUN+="/usr/local/bin/usb-qreader"
    
  4. Нажатие Ctrl + H для нахождения и заменения всего <your_username> случаи именем пользователя.
  5. Сохранили файл и закрывают текстовый редактор.
  6. Тип на терминале gksu gedit /usr/local/bin/usb-qreader
  7. На этом файле поместил эти строки (можно настроить его, если Вы знаете то, что делает):

    #!/bin/bash
    
    ZBAR_SETTINGS="--raw --nodisplay" # Put here the options
    ALWAYS_ON_TOP="true"              # Keep the zbar window always on top
    END_CHARACTER="Return"            # Character sent after code scan ("Return", "Tab", "space", "")
    TYPEIN_WINDOW=''                  # Title of the window onto type. If it's blank, it will type on the current window
    
    function scan() {
        zbarcam $ZBAR_SETTINGS /dev/qreader | while read line; do
            CODE=$(head -c -1 <<< "$line") 
            if [[ $TYPEIN_WINDOW != "" ]]; then
                WINDOW="--window $(xdotool search --name $TYPEIN_WINDOW | tail -n 1)"
            fi
            xdotool type $WINDOW "$CODE"
            xdotool key  $WINDOW "$END_CHARACTER"
        done
    }
    
    if [[ "${ACTION}" == "add" ]]; then
        scan &
        if [[ "$ALWAYS_ON_TOP" == "true" && ! "$OPTIONS" =~ "--nodisplay"  ]]; then
            while :; do wmctrl -l | grep -q "zbar barcode reader" && break; done
            wmctrl -r "zbar barcode reader" -b add,above
        fi
    elif [[ "${ACTION}" == "remove" ]]; then
        ps aux \
        | grep -e 'zbarcam.*/dev/qreader' \
        | grep -v grep \
        | awk '{print $2}' \
        | xargs -i kill {}
    fi
    
    1. Тип на Перезагрузке терминала sudo chmod a+x /usr/local/bin/usb-qreader
    2. udev правила с этой командой: sudo udevadm control --reload-rules
    3. Разъем Ваш удивительный читатель QR и обладают!

Однако, если, Вы хотите простое решение (который не даст потенциал этого, но прост), можно попробовать @Slaci решение ниже .

2
ответ дан 11 April 2015 в 03:04

В 2020 году вам следует использовать CoBang для сканирования QR-кода. Это приложение было написано мной недавно, чтобы уловить новые технологии на рабочем столе Linux.

Как установить в Ubuntu 20.04:

sudo add-apt-repository ppa:ng-hong-quan/ppa
sudo apt update
sudo apt install cobang
1
ответ дан 28 July 2020 в 18:32

Другие вопросы по тегам:

Похожие вопросы: