File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -837,15 +837,18 @@ def __str__(self):
837837 return "Microphone"
838838 return repr (self )
839839
840- @staticmethod
841- def _load_classes (bus : str ):
840+ @classmethod
841+ def _load_classes (cls , bus : str ):
842842 """
843843 List of known device classes, subclasses and programming interfaces.
844844 """
845845 # Syntax:
846846 # C class class_name
847847 # subclass subclass_name <-- single tab
848848 # prog-if prog-if_name <-- two tabs
849+ data = "_{}_known_classes" .format (bus )
850+ if hasattr (cls , data ):
851+ return getattr (cls , data )
849852 result = {}
850853 with open (
851854 f"/usr/share/hwdata/{ bus } .ids" , encoding = "utf-8" , errors = "ignore"
@@ -872,6 +875,7 @@ def _load_classes(bus: str):
872875 result [class_id + "****" ] = class_name
873876 subclass_id = None
874877
878+ setattr (cls , data , result )
875879 return result
876880
877881 def matches (self , other : "DeviceInterface" ) -> bool :
You can’t perform that action at this time.
0 commit comments