New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sys-usb doesn't recognize keyboard/mouse plugged in before system boot #1930

Closed
MarioGeckler opened this Issue Apr 22, 2016 · 16 comments

Comments

Projects
None yet
2 participants
@MarioGeckler

Qubes OS version:

R3.1

Affected TemplateVMs:

fedora23?

Expected behavior:

Dom0 should ask if InputMouse/InputKeyboard should be allowed even if the devices was connected before the system boots

Actual behavior:

Devices which are plugged in before the System starts must be reconnected to get the confirmation dialog

Steps to reproduce the behavior:

Setup working USBVM
Connect Keyboard/Mouse to the System before boot
Boot Qubes
reconnect the devices

@marmarek

This comment has been minimized.

Show comment
Hide comment
@marmarek

marmarek Apr 22, 2016

Member

This is because it isn't possible to show qrexec policy dialog (confirmation that user really want to allow that mouse control over dom0) before user login. This also means no way to use that mouse in login screen. Which may be even bigger problem for keyboards (which aren't enabled by default anyway).

I think the easiest solution is to change "ask" policy to "allow" for qubes.InputMouse service. @rootkovska do we want that by default when user enable USB VM? This may be risky step. But on the other hand, those confirmations are not as effective as we want: #1166

Member

marmarek commented Apr 22, 2016

This is because it isn't possible to show qrexec policy dialog (confirmation that user really want to allow that mouse control over dom0) before user login. This also means no way to use that mouse in login screen. Which may be even bigger problem for keyboards (which aren't enabled by default anyway).

I think the easiest solution is to change "ask" policy to "allow" for qubes.InputMouse service. @rootkovska do we want that by default when user enable USB VM? This may be risky step. But on the other hand, those confirmations are not as effective as we want: #1166

@MarioGeckler

This comment has been minimized.

Show comment
Hide comment
@MarioGeckler

MarioGeckler Apr 22, 2016

Is it possible to automatically Show These dialogs After login?

For #1166 : is it possible to get how long the Dialog was shown and Show it again if it was for example less then 1 second?

Is it possible to automatically Show These dialogs After login?

For #1166 : is it possible to get how long the Dialog was shown and Show it again if it was for example less then 1 second?

@marmarek

This comment has been minimized.

Show comment
Hide comment
@marmarek

marmarek Apr 27, 2016

Member

Is it possible to automatically Show These dialogs After login?

It may be possible, but not easily. I think of some script to restart failed input proxy services in sys-usb after user login. But there is a lot of corner cases...

Member

marmarek commented Apr 27, 2016

Is it possible to automatically Show These dialogs After login?

It may be possible, but not easily. I think of some script to restart failed input proxy services in sys-usb after user login. But there is a lot of corner cases...

@MarioGeckler

This comment has been minimized.

Show comment
Hide comment
@MarioGeckler

MarioGeckler Apr 29, 2016

The following Script just triggers the udev "add" event for all Keyboard and Mouse devices.
@marmarek could this be integrated in usb-vm to start after user login?

import subprocess
import os
import sys
from stat import *

eventFiles = os.listdir("/dev/input")
for file in eventFiles:
    if 'event' in file: # if filename contains 'event'
        eventDir = os.path.join("/dev/input", file)
        if S_ISCHR(os.stat(eventDir).st_mode) != 0: # is character device?
            udevreturn = subprocess.check_output(["udevadm","info","--query=property","--name=" + eventDir])
            if 'ID_INPUT_MOUSE' in udevreturn:
                subprocess.call(["sudo","/usr/bin/udevadm","trigger","--action=add","--sysname-match=" + file])
            if 'ID_INPUT_KEYBOARD' in udevreturn:
                subprocess.call(["sudo","/usr/bin/udevadm","trigger","--action=add","--sysname-match=" + file])

MarioGeckler commented Apr 29, 2016

The following Script just triggers the udev "add" event for all Keyboard and Mouse devices.
@marmarek could this be integrated in usb-vm to start after user login?

import subprocess
import os
import sys
from stat import *

eventFiles = os.listdir("/dev/input")
for file in eventFiles:
    if 'event' in file: # if filename contains 'event'
        eventDir = os.path.join("/dev/input", file)
        if S_ISCHR(os.stat(eventDir).st_mode) != 0: # is character device?
            udevreturn = subprocess.check_output(["udevadm","info","--query=property","--name=" + eventDir])
            if 'ID_INPUT_MOUSE' in udevreturn:
                subprocess.call(["sudo","/usr/bin/udevadm","trigger","--action=add","--sysname-match=" + file])
            if 'ID_INPUT_KEYBOARD' in udevreturn:
                subprocess.call(["sudo","/usr/bin/udevadm","trigger","--action=add","--sysname-match=" + file])
@marmarek

This comment has been minimized.

Show comment
Hide comment
@marmarek

marmarek Apr 29, 2016

Member

Yes, create launcher in ~/.config/autostart/something.desktop
Hmm, maybe simply systemctl restart-failed qubes-input* will do?

Best Regards,
Marek Marczykowski-Górecki
Invisible Things Lab
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?

Member

marmarek commented Apr 29, 2016

Yes, create launcher in ~/.config/autostart/something.desktop
Hmm, maybe simply systemctl restart-failed qubes-input* will do?

Best Regards,
Marek Marczykowski-Górecki
Invisible Things Lab
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?

@marmarek

This comment has been minimized.

Show comment
Hide comment
@marmarek

marmarek May 2, 2016

Member

Automated announcement from builder-github

The package qubes-input-proxy-1.0.4-1.fc21 has been pushed to the r3.1 testing repository for the Fedora fc21 template.
To test this update, please install it with the following command:

sudo yum update --enablerepo=qubes-vm-r3.1-current-testing

Changes included in this update

Member

marmarek commented May 2, 2016

Automated announcement from builder-github

The package qubes-input-proxy-1.0.4-1.fc21 has been pushed to the r3.1 testing repository for the Fedora fc21 template.
To test this update, please install it with the following command:

sudo yum update --enablerepo=qubes-vm-r3.1-current-testing

Changes included in this update

@marmarek

This comment has been minimized.

Show comment
Hide comment
@marmarek

marmarek May 2, 2016

Member

Automated announcement from builder-github

The package qubes-input-proxy-1.0.4-1.fc22 has been pushed to the r3.1 testing repository for the Fedora fc22 template.
To test this update, please install it with the following command:

sudo yum update --enablerepo=qubes-vm-r3.1-current-testing

Changes included in this update

Member

marmarek commented May 2, 2016

Automated announcement from builder-github

The package qubes-input-proxy-1.0.4-1.fc22 has been pushed to the r3.1 testing repository for the Fedora fc22 template.
To test this update, please install it with the following command:

sudo yum update --enablerepo=qubes-vm-r3.1-current-testing

Changes included in this update

@marmarek

This comment has been minimized.

Show comment
Hide comment
@marmarek

marmarek May 2, 2016

Member

Automated announcement from builder-github

The package qubes-input-proxy-1.0.4-1.fc23 has been pushed to the r3.1 testing repository for the Fedora fc23 template.
To test this update, please install it with the following command:

sudo yum update --enablerepo=qubes-vm-r3.1-current-testing

Changes included in this update

Member

marmarek commented May 2, 2016

Automated announcement from builder-github

The package qubes-input-proxy-1.0.4-1.fc23 has been pushed to the r3.1 testing repository for the Fedora fc23 template.
To test this update, please install it with the following command:

sudo yum update --enablerepo=qubes-vm-r3.1-current-testing

Changes included in this update

@marmarek

This comment has been minimized.

Show comment
Hide comment
@marmarek

marmarek May 2, 2016

Member

Automated announcement from builder-github

The package qubes-input-proxy-1.0.4-1.fc20 has been pushed to the r3.1 testing repository for dom0.
To test this update, please install it with the following command:

sudo qubes-dom0-update --enablerepo=qubes-dom0-current-testing

Changes included in this update

Member

marmarek commented May 2, 2016

Automated announcement from builder-github

The package qubes-input-proxy-1.0.4-1.fc20 has been pushed to the r3.1 testing repository for dom0.
To test this update, please install it with the following command:

sudo qubes-dom0-update --enablerepo=qubes-dom0-current-testing

Changes included in this update

@marmarek

This comment has been minimized.

Show comment
Hide comment
@marmarek

marmarek Jun 9, 2016

Member

Automated announcement from builder-github

The package qubes-input-proxy-1.0.5-1.fc21 has been pushed to the r3.1 stable repository for the Fedora fc21 template.
To install this update, please use the standard update command:

sudo yum update

Changes included in this update

Member

marmarek commented Jun 9, 2016

Automated announcement from builder-github

The package qubes-input-proxy-1.0.5-1.fc21 has been pushed to the r3.1 stable repository for the Fedora fc21 template.
To install this update, please use the standard update command:

sudo yum update

Changes included in this update

@marmarek

This comment has been minimized.

Show comment
Hide comment
@marmarek

marmarek Jun 9, 2016

Member

Automated announcement from builder-github

The package qubes-input-proxy-1.0.5-1.fc22 has been pushed to the r3.1 stable repository for the Fedora fc22 template.
To install this update, please use the standard update command:

sudo yum update

Changes included in this update

Member

marmarek commented Jun 9, 2016

Automated announcement from builder-github

The package qubes-input-proxy-1.0.5-1.fc22 has been pushed to the r3.1 stable repository for the Fedora fc22 template.
To install this update, please use the standard update command:

sudo yum update

Changes included in this update

@marmarek

This comment has been minimized.

Show comment
Hide comment
@marmarek

marmarek Jun 9, 2016

Member

Automated announcement from builder-github

The package qubes-input-proxy-1.0.5-1.fc23 has been pushed to the r3.1 stable repository for the Fedora fc23 template.
To install this update, please use the standard update command:

sudo yum update

Changes included in this update

Member

marmarek commented Jun 9, 2016

Automated announcement from builder-github

The package qubes-input-proxy-1.0.5-1.fc23 has been pushed to the r3.1 stable repository for the Fedora fc23 template.
To install this update, please use the standard update command:

sudo yum update

Changes included in this update

@marmarek

This comment has been minimized.

Show comment
Hide comment
@marmarek

marmarek Jun 9, 2016

Member

Automated announcement from builder-github

The package qubes-input-proxy-1.0.5-1.fc20 has been pushed to the r3.1 stable repository for dom0.
To install this update, please use the standard update command:

sudo qubes-dom0-update

Or update dom0 via Qubes Manager.

Changes included in this update

Member

marmarek commented Jun 9, 2016

Automated announcement from builder-github

The package qubes-input-proxy-1.0.5-1.fc20 has been pushed to the r3.1 stable repository for dom0.
To install this update, please use the standard update command:

sudo qubes-dom0-update

Or update dom0 via Qubes Manager.

Changes included in this update

marmarek added a commit to QubesOS/qubes-core-admin that referenced this issue Jun 24, 2016

marmarek added a commit to QubesOS/qubes-core-admin that referenced this issue Jun 25, 2016

@MarioGeckler

This comment has been minimized.

Show comment
Hide comment
@MarioGeckler

MarioGeckler Jul 7, 2016

@marmarek could you add this script in R3,2 also ?

@marmarek could you add this script in R3,2 also ?

@marmarek

This comment has been minimized.

Show comment
Hide comment
@marmarek

marmarek Jul 7, 2016

Member

@MarioGeckler it is there.

Member

marmarek commented Jul 7, 2016

@MarioGeckler it is there.

@MarioGeckler

This comment has been minimized.

Show comment
Hide comment
@MarioGeckler

MarioGeckler Jul 8, 2016

The script isn´t working in a debian USB-VM because udevadm is not in /usr/bin
I edited the script to dynamically search for udevadm:

import subprocess
import os
import sys
from stat import *

eventFiles = os.listdir("/dev/input")
for input_dev in eventFiles:
if 'event' in input_dev: # if filename contains 'event'
eventFile = os.path.join("/dev/input", input_dev)
if S_ISCHR(os.stat(eventFile).st_mode) != 0: # is character device?
udevreturn = subprocess.check_output([
"udevadm", "info", "--query=property", "--name=" + eventFile])
if 'ID_INPUT_MOUSE' in udevreturn or
'ID_INPUT_KEYBOARD' in udevreturn:
udevadm = subprocess.check_output([
"sudo", "which", "udevadm"])
udevadm = udevadm.rstrip('\n')
subprocess.call([
"sudo", udevadm, "trigger",
"--action=add", "--sysname-match=" + input_dev])

MarioGeckler commented Jul 8, 2016

The script isn´t working in a debian USB-VM because udevadm is not in /usr/bin
I edited the script to dynamically search for udevadm:

import subprocess
import os
import sys
from stat import *

eventFiles = os.listdir("/dev/input")
for input_dev in eventFiles:
if 'event' in input_dev: # if filename contains 'event'
eventFile = os.path.join("/dev/input", input_dev)
if S_ISCHR(os.stat(eventFile).st_mode) != 0: # is character device?
udevreturn = subprocess.check_output([
"udevadm", "info", "--query=property", "--name=" + eventFile])
if 'ID_INPUT_MOUSE' in udevreturn or
'ID_INPUT_KEYBOARD' in udevreturn:
udevadm = subprocess.check_output([
"sudo", "which", "udevadm"])
udevadm = udevadm.rstrip('\n')
subprocess.call([
"sudo", udevadm, "trigger",
"--action=add", "--sysname-match=" + input_dev])

marmarek added a commit to marmarek/qubes-app-linux-input-proxy that referenced this issue Jul 17, 2016

debian: udevadm is in /bin
On Fedora it doesn't matter because /bin is symlinked to /usr/bin

QubesOS/qubes-issues#1930
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment