我正在尝试通过 Remmina 将 USB 重定向到 RDP 会话(Linux 上的 FreeRDP)。
当我以 root 身份运行 Remmina 时,对 USB 摄像头的访问工作正常,但由于显而易见的原因,这不是一个理想的场景。
当我以普通用户身份运行 Remmina 时,我需要允许普通用户访问此设备。所以,我尝试了以下方法:
- 将我的用户添加到
video
组中,然后注销/登录 - 为了更好的措施,将 ,的权限更改
/dev/video0
为 777,然后从那里返回。
以下是 之前的权限/dev/video0
:
$ ls -a -l /dev/video0
crw-rw----+ 1 root video 81, 0 Jul 25 08:36 /dev/video0
然后我跑了:
$ sudo chmod 777 /dev/video0
运行上述命令后再次授予权限:
$ ls -a -l /dev/video0
crwxrwxrwx+ 1 root video 81, 0 Jul 25 08:36 /dev/video0
在进行任何这些权限更改之前,我只需将我的用户添加到video
组中并注销/登录。
lsusb
与我的设备相关的输出:
Bus 003 Device 003: ID 046d:0892 Logitech, Inc. C920 HD Pro Webcam
使用的选项Remmina
:
USB device Redirection: id:046d:0892,addr:003:003
Remmina 的错误输出:
[08:57:34:285] [1821:1848] [INFO][com.freerdp.channels.urbdrc.client] - VID: 0x046D, PID: 0x0892
[08:57:34:285] [1821:1848] [ERROR][com.freerdp.channels.urbdrc.client] - libusb_open: error LIBUSB_ERROR_ACCESS[-3]
[08:57:34:285] [1821:1848] [ERROR][com.freerdp.channels.urbdrc.client] - libusb_open [b=0x03,p=0x06,a=0x03,VID=0x046D,PID=0x0892]: error LIBUSB_ERROR_ACCESS[-3]
[08:57:34:285] [1821:1848] [ERROR][com.freerdp.channels.urbdrc.client] - libusb_open: error LIBUSB_ERROR_ACCESS[-3]
[08:57:34:285] [1821:1848] [ERROR][com.freerdp.channels.urbdrc.client] - libusb_open [b=0x03,p=0x06,a=0x03,VID=0x046D,PID=0x0892]: error LIBUSB_ERROR_ACCESS[-3]
编辑:
输出来自:$ udevadm info -a /dev/video0
looking at device '/devices/pci0000:00/0000:00:14.0/usb3/3-6/3-6:1.0/video4linux/video0':
KERNEL=="video0"
SUBSYSTEM=="video4linux"
DRIVER==""
ATTR{dev_debug}=="0"
ATTR{index}=="0"
ATTR{name}=="HD Pro Webcam C920"
ATTR{power/control}=="auto"
ATTR{power/runtime_active_time}=="0"
ATTR{power/runtime_status}=="unsupported"
ATTR{power/runtime_suspended_time}=="0"
looking at parent device '/devices/pci0000:00/0000:00:14.0/usb3/3-6/3-6:1.0':
KERNELS=="3-6:1.0"
SUBSYSTEMS=="usb"
DRIVERS=="uvcvideo"
ATTRS{authorized}=="1"
ATTRS{bAlternateSetting}==" 0"
ATTRS{bInterfaceClass}=="0e"
ATTRS{bInterfaceNumber}=="00"
ATTRS{bInterfaceProtocol}=="00"
ATTRS{bInterfaceSubClass}=="01"
ATTRS{bNumEndpoints}=="01"
ATTRS{iad_bFirstInterface}=="00"
ATTRS{iad_bFunctionClass}=="0e"
ATTRS{iad_bFunctionProtocol}=="00"
ATTRS{iad_bFunctionSubClass}=="03"
ATTRS{iad_bInterfaceCount}=="02"
ATTRS{supports_autosuspend}=="1"
looking at parent device '/devices/pci0000:00/0000:00:14.0/usb3/3-6':
KERNELS=="3-6"
SUBSYSTEMS=="usb"
DRIVERS=="usb"
ATTRS{authorized}=="1"
ATTRS{avoid_reset_quirk}=="0"
ATTRS{bConfigurationValue}=="1"
ATTRS{bDeviceClass}=="ef"
ATTRS{bDeviceProtocol}=="01"
ATTRS{bDeviceSubClass}=="02"
ATTRS{bMaxPacketSize0}=="64"
ATTRS{bMaxPower}=="500mA"
ATTRS{bNumConfigurations}=="1"
ATTRS{bNumInterfaces}==" 4"
ATTRS{bcdDevice}=="0019"
ATTRS{bmAttributes}=="80"
ATTRS{busnum}=="3"
ATTRS{configuration}==""
ATTRS{devnum}=="3"
ATTRS{devpath}=="6"
ATTRS{idProduct}=="0892"
ATTRS{idVendor}=="046d"
ATTRS{ltm_capable}=="no"
ATTRS{maxchild}=="0"
ATTRS{power/active_duration}=="1610000"
ATTRS{power/autosuspend}=="2"
ATTRS{power/autosuspend_delay_ms}=="2000"
ATTRS{power/connected_duration}=="2594730"
ATTRS{power/control}=="auto"
ATTRS{power/level}=="auto"
ATTRS{power/persist}=="1"
ATTRS{power/runtime_active_time}=="1610678"
ATTRS{power/runtime_status}=="suspended"
ATTRS{power/runtime_suspended_time}=="983716"
ATTRS{product}=="HD Pro Webcam C920"
ATTRS{quirks}=="0x0"
ATTRS{removable}=="unknown"
ATTRS{rx_lanes}=="1"
ATTRS{serial}=="66BA81DF"
ATTRS{speed}=="480"
ATTRS{tx_lanes}=="1"
ATTRS{urbnum}=="1561744"
ATTRS{version}==" 2.00"
looking at parent device '/devices/pci0000:00/0000:00:14.0/usb3':
KERNELS=="usb3"
SUBSYSTEMS=="usb"
DRIVERS=="usb"
ATTRS{authorized}=="1"
ATTRS{authorized_default}=="1"
ATTRS{avoid_reset_quirk}=="0"
ATTRS{bConfigurationValue}=="1"
ATTRS{bDeviceClass}=="09"
ATTRS{bDeviceProtocol}=="01"
ATTRS{bDeviceSubClass}=="00"
ATTRS{bMaxPacketSize0}=="64"
ATTRS{bMaxPower}=="0mA"
ATTRS{bNumConfigurations}=="1"
ATTRS{bNumInterfaces}==" 1"
ATTRS{bcdDevice}=="0510"
ATTRS{bmAttributes}=="e0"
ATTRS{busnum}=="3"
ATTRS{configuration}==""
ATTRS{devnum}=="1"
ATTRS{devpath}=="0"
ATTRS{idProduct}=="0002"
ATTRS{idVendor}=="1d6b"
ATTRS{interface_authorized_default}=="1"
ATTRS{ltm_capable}=="no"
ATTRS{manufacturer}=="Linux 5.10.52-1-lts xhci-hcd"
ATTRS{maxchild}=="15"
ATTRS{power/active_duration}=="2595210"
ATTRS{power/autosuspend}=="0"
ATTRS{power/autosuspend_delay_ms}=="0"
ATTRS{power/connected_duration}=="2595210"
ATTRS{power/control}=="auto"
ATTRS{power/level}=="auto"
ATTRS{power/runtime_active_time}=="2595211"
ATTRS{power/runtime_status}=="active"
ATTRS{power/runtime_suspended_time}=="0"
ATTRS{power/wakeup}=="disabled"
ATTRS{power/wakeup_abort_count}==""
ATTRS{power/wakeup_active}==""
ATTRS{power/wakeup_active_count}==""
ATTRS{power/wakeup_count}==""
ATTRS{power/wakeup_expire_count}==""
ATTRS{power/wakeup_last_time_ms}==""
ATTRS{power/wakeup_max_time_ms}==""
ATTRS{power/wakeup_total_time_ms}==""
ATTRS{product}=="xHCI Host Controller"
ATTRS{quirks}=="0x0"
ATTRS{removable}=="unknown"
ATTRS{rx_lanes}=="1"
ATTRS{serial}=="0000:00:14.0"
ATTRS{speed}=="480"
ATTRS{tx_lanes}=="1"
ATTRS{urbnum}=="147"
ATTRS{version}==" 2.00"
looking at parent device '/devices/pci0000:00/0000:00:14.0':
KERNELS=="0000:00:14.0"
SUBSYSTEMS=="pci"
DRIVERS=="xhci_hcd"
ATTRS{ari_enabled}=="0"
ATTRS{broken_parity_status}=="0"
ATTRS{class}=="0x0c0330"
ATTRS{consistent_dma_mask_bits}=="64"
ATTRS{d3cold_allowed}=="1"
ATTRS{device}=="0x8c31"
ATTRS{dma_mask_bits}=="64"
ATTRS{driver_override}=="(null)"
ATTRS{enable}=="1"
ATTRS{irq}=="27"
ATTRS{local_cpulist}=="0-3"
ATTRS{local_cpus}=="f"
ATTRS{msi_bus}=="1"
ATTRS{msi_irqs/27}=="msi"
ATTRS{numa_node}=="-1"
ATTRS{power/control}=="on"
ATTRS{power/runtime_active_time}=="2596888"
ATTRS{power/runtime_status}=="active"
ATTRS{power/runtime_suspended_time}=="0"
ATTRS{power/wakeup}=="enabled"
ATTRS{power/wakeup_abort_count}=="0"
ATTRS{power/wakeup_active}=="0"
ATTRS{power/wakeup_active_count}=="0"
ATTRS{power/wakeup_count}=="0"
ATTRS{power/wakeup_expire_count}=="0"
ATTRS{power/wakeup_last_time_ms}=="0"
ATTRS{power/wakeup_max_time_ms}=="0"
ATTRS{power/wakeup_total_time_ms}=="0"
ATTRS{revision}=="0x05"
ATTRS{subsystem_device}=="0x220e"
ATTRS{subsystem_vendor}=="0x17aa"
ATTRS{vendor}=="0x8086"
looking at parent device '/devices/pci0000:00':
KERNELS=="pci0000:00"
SUBSYSTEMS==""
DRIVERS==""
ATTRS{power/control}=="auto"
ATTRS{power/runtime_active_time}=="0"
ATTRS{power/runtime_status}=="unsupported"
ATTRS{power/runtime_suspended_time}=="0"
答案1
答案是允许访问总线上的设备。
我的设备已Device 003
开启Bus 003
:
$ lsusb
Bus 003 Device 003: ID 046d:0892 Logitech, Inc. C920 HD Pro Webcam
所以我设置了文件的权限/dev/bus/usb/003/003
:
$ sudo chmod a+rw /dev/bus/usb/003/*
现在,普通用户可以访问该总线上的所有设备(如果我只想要该设备,我会指定例如.../usb/003/003)。
编辑:应该注意的是,这是一个临时解决方案,为了实现持久性,必须编写 udev 规则(一旦我可持续地创建了我的规则,将进一步更新)