Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/pr/217'
Browse files Browse the repository at this point in the history
* origin/pr/217:
  q-dev: remove qubes-device-attach-confirm
  q-dev: cleanup
  q-dev: better variable naming
  q-dev: add short way to create DeviceAssignment
  q-dev: rename attach-confirm -> qubes-device-attach-confirm
  q-dev: remove literals
  q-dev: make pylint happy
  q-dev: drop dependence on qubes core
  q-dev: remove guivm from args of attach-confirm
  q-dev: cleanup
  q-dev: simplification of device agent
  q-dev: update glade path
  q-dev: include tools
  q-dev: fix setup.py
  q-dev: move gui parts from core-admin
  q-dev: cleanup
  q-dev: virtual device
  q-dev: fix detaching
  q-dev: implement device_id
  • Loading branch information
marmarek committed Nov 17, 2024
2 parents 65e84b9 + b149981 commit 18f7535
Show file tree
Hide file tree
Showing 12 changed files with 739 additions and 47 deletions.
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ install-icons:

install-autostart:
mkdir -p $(DESTDIR)/etc/xdg/autostart
cp autostart/qubes-device-agent.desktop $(DESTDIR)/etc/xdg/autostart
cp autostart/qui-domains.desktop $(DESTDIR)/etc/xdg/autostart
cp autostart/qui-devices.desktop $(DESTDIR)/etc/xdg/autostart
cp autostart/qui-clipboard.desktop $(DESTDIR)/etc/xdg/autostart
Expand All @@ -48,6 +49,8 @@ install-autostart:
cp desktop/qubes-global-config.desktop $(DESTDIR)/usr/share/applications/
cp desktop/qubes-new-qube.desktop $(DESTDIR)/usr/share/applications/
cp desktop/qubes-policy-editor-gui.desktop $(DESTDIR)/usr/share/applications/
install -d $(DESTDIR)/usr/lib/qubes -m 0755
install -m 0755 qui/devices/qubes-device-agent-autostart $(DESTDIR)/usr/lib/qubes/qubes-device-agent-autostart

install-lang:
mkdir -p $(DESTDIR)/usr/share/gtksourceview-4/language-specs/
Expand Down
7 changes: 7 additions & 0 deletions autostart/qubes-device-agent.desktop
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[Desktop Entry]
Name=Qubes Device Agent
Comment=Agent for handling device attach confirmation prompts
Icon=qubes
Exec=/usr/lib/qubes/qubes-device-agent-autostart
Terminal=false
Type=Application
30 changes: 12 additions & 18 deletions qubes_config/tests/test_usb_devices.py
Original file line number Diff line number Diff line change
Expand Up @@ -845,15 +845,13 @@ def test_u2f_handler_add_without_service(test_qapp,
def test_devices_handler_unsaved(test_qapp, test_policy_manager, real_builder):
test_qapp.expected_calls[('sys-usb', "admin.vm.device.pci.Attached",
None, None)] = \
b"0\x00dom0+00_0d.0 ident='00_0d.0' devclass='pci' " \
b"backend_domain='dom0' required='yes' attach_automatically='yes' " \
b"0\x00dom0+00_0d.0 device_id='*' port_id='00_0d.0' devclass='pci' " \
b"backend_domain='dom0' mode='required' " \
b"_no-strict-reset='yes'\n"
test_qapp.expected_calls[('dom0', "admin.vm.device.pci.Available",
None, None)] = \
b"0\x0000_0d.0 ident='00_0d.0' devclass='pci' backend_domain='dom0' " \
b"serial='unknown' manufacturer='unknown' " \
b"self_identity='0000:0000::p0c0300' vendor='unknown' " \
b"product='unknown' name='unknown' interfaces='p0c0300' " \
b"0\x0000_0d.0 device_id='0000:0000::p0c0300' port_id='00_0d.0' " \
b"devclass='pci' backend_domain='dom0' interfaces='p0c0300' " \
b"_function='0' _bus='00' _libvirt_name='pci_0000_00_0d_0' " \
b"_device='0d'\n"

Expand All @@ -878,26 +876,22 @@ def test_devices_handler_detect_usbvms(test_qapp,
test_policy_manager, real_builder):
test_qapp.expected_calls[('sys-usb', "admin.vm.device.pci.Attached",
None, None)] = \
b"0\x00dom0+00_0d.0 ident='00_0d.0' devclass='pci' " \
b"backend_domain='dom0' required='yes' attach_automatically='yes' " \
b"0\x00dom0+00_0d.0 device_id='*' port_id='00_0d.0' devclass='pci' " \
b"backend_domain='dom0' mode='required' " \
b"_no-strict-reset='yes'\n"
test_qapp.expected_calls[('test-standalone', "admin.vm.device.pci.Attached",
None, None)] = \
b"0\x00dom0+00_0f.0 ident='00_0f.0' devclass='pci' " \
b"backend_domain='dom0' required='yes' attach_automatically='yes' " \
b"0\x00dom0+00_0f.0 device_id='*' port_id='00_0f.0' devclass='pci' " \
b"backend_domain='dom0' mode='required' " \
b"_no-strict-reset='yes'\n"
test_qapp.expected_calls[('dom0', "admin.vm.device.pci.Available",
None, None)] = \
b"0\x0000_0f.0 ident='00_0f.0' devclass='pci' backend_domain='dom0' " \
b"serial='unknown' manufacturer='unknown' " \
b"self_identity='0000:0000::p0c0300' vendor='unknown' " \
b"product='unknown' name='unknown' interfaces='p0c0300' " \
b"0\x0000_0f.0 device_id='0000:0000::p0c0300' port_id='00_0f.0' " \
b"devclass='pci' backend_domain='dom0' interfaces='p0c0300' " \
b"_function='0' _bus='00' _libvirt_name='pci_0000_00_0f_0' " \
b"_device='0f'\n" \
b"00_0d.0 ident='00_0d.0' devclass='pci' backend_domain='dom0' " \
b"serial='unknown' manufacturer='unknown' " \
b"self_identity='0000:0000::p0c0300' vendor='unknown' " \
b"product='unknown' name='unknown' interfaces='p0c0300' " \
b"00_0d.0 device_id='0000:0000::p0c0300' port_id='00_0d.0' " \
b"devclass='pci' backend_domain='dom0' interfaces='p0c0300' " \
b"_function='0' _bus='00' _libvirt_name='pci_0000_00_0d_0' " \
b"_device='0d'\n"

Expand Down
2 changes: 1 addition & 1 deletion qui/decorators.py
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ def device_hbox(device) -> Gtk.Box:
dev_icon = create_icon(icon)

name_label = Gtk.Label(xalign=0)
name = f"{device.backend_domain}:{device.ident} - {device.description}"
name = f"{device.backend_domain}:{device.port_id} - {device.description}"
if device.attachments:
dev_list = ", ".join(list(device.attachments))
name_label.set_markup(f'<b>{name} ({dev_list})</b>')
Expand Down
Loading

0 comments on commit 18f7535

Please sign in to comment.