Skip to content

Commit

Permalink
q-dev: update device protocol v2
Browse files Browse the repository at this point in the history
  • Loading branch information
piotrbartman committed May 26, 2024
1 parent 623c3ef commit dc2cda7
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions qubesadmin/device_protocol.py
Original file line number Diff line number Diff line change
Expand Up @@ -582,10 +582,10 @@ def interfaces(self) -> List[DeviceInterface]:
@property
def parent_device(self) -> Optional[Device]:
"""
The parent device if any.
The parent device, if any.
If the device is part of another device (e.g. it's a single
partition of an usb stick), the parent device id should be here.
If the device is part of another device (e.g., it's a single
partition of a USB stick), the parent device id should be here.
"""
return self._parent

Expand All @@ -594,7 +594,7 @@ def subdevices(self) -> List['DeviceInfo']:
"""
The list of children devices if any.
If the device has subdevices (e.g. partitions of an usb stick),
If the device has subdevices (e.g., partitions of a USB stick),
the subdevices id should be here.
"""
return [dev for dev in self.backend_domain.devices[self.devclass]
Expand Down Expand Up @@ -626,7 +626,7 @@ def serialize(self) -> bytes:

if self.attachment:
properties = self.pack_property(
properties, 'attachment', self.attachment.name)
'attachment', self.attachment.name)

properties += b' ' + self.pack_property(
'interfaces',
Expand Down Expand Up @@ -764,6 +764,7 @@ def sanitize_str(
if replace_char is None:
not_allowed_chars = set(untrusted_value) - allowed_chars
if not_allowed_chars:
print(untrusted_value)
raise ProtocolError(error_message + repr(not_allowed_chars))
return untrusted_value
result = ""
Expand Down

0 comments on commit dc2cda7

Please sign in to comment.