diff --git a/proto/ei-scanner b/proto/ei-scanner index 55c1d70..4d8b3ae 100755 --- a/proto/ei-scanner +++ b/proto/ei-scanner @@ -241,16 +241,20 @@ class Enum: name: str = attr.ib() since: int = attr.ib() interface: "Interface" = attr.ib() - is_bitmask: bool = attr.ib(default=False) + is_bitfield: bool = attr.ib(default=False) description: Optional[Description] = attr.ib(default=None) entries: list[Entry] = attr.ib(init=False, factory=list) @classmethod def create( - cls, name: str, interface: "Interface", since: int = 1, is_bitmask: bool = False + cls, + name: str, + interface: "Interface", + since: int = 1, + is_bitfield: bool = False, ) -> "Enum": - return cls(name=name, since=since, interface=interface, is_bitmask=is_bitmask) + return cls(name=name, since=since, interface=interface, is_bitfield=is_bitfield) def add_entry(self, entry: Entry) -> None: for e in self.entries: @@ -260,7 +264,7 @@ class Enum: if e.value == entry.value: raise ValueError(f"Duplicate enum value '{entry.value}'") - if self.is_bitmask: + if self.is_bitfield: if e.value < 0: raise ValueError("Bitmasks must not be less than zero") if e.value.bit_count() > 1: @@ -529,19 +533,22 @@ class ProtocolParser(xml.sax.handler.ContentHandler): self.location, ) - enum_type = attrs.get("type", None) - if enum_type is not None and enum_type not in ["bitmask"]: + try: + is_bitfield = { + "true": True, + "false": False, + }[attrs.get("bitfield", "false")] + except KeyError as e: raise XmlError.create( - f"Invalid enum type {enum_type} in element '{element}'", + f"Invalid value {e} for boolean bitfield attribute in '{element}'", self.location, ) - is_bitmask = enum_type == "bitmask" enum = Enum.create( name=name, since=since, interface=self.current_interface, - is_bitmask=is_bitmask, + is_bitfield=is_bitfield, ) try: self.current_interface.add_enum(enum) diff --git a/proto/protocol.xml b/proto/protocol.xml index 59750e3..3d4317a 100644 --- a/proto/protocol.xml +++ b/proto/protocol.xml @@ -406,7 +406,7 @@ - Notification that an object ID used in a prior request was + Notification that an object ID used in an earlier request was invalid and does not exist. This event is sent by the EIS implementation when an object that @@ -526,7 +526,7 @@ - + A set of capabilities possible available on this seat. A client may bind to these capabilies and an EIS implementation may then create device based on the bound @@ -734,7 +734,7 @@ - + These capabilities are binary compatible with ei_seat.capabilities.