@@ -48,23 +48,23 @@ def create_peripheral_from_data(mp: object) -> OtherPeripheral: ...
4848
4949
5050def create_peripheral_from_data (mp : MountedPeripheral ) -> Peripheral :
51- if isinstance (mp .peripheral , CameraPeripheralModel ):
52- return CameraPeripheral .from_config (mp .peripheral )
53- elif isinstance (mp .peripheral , CodecPeripheralModel ):
54- return CodecPeripheral .from_config (mp .peripheral )
55- elif isinstance (mp .peripheral , GenericDevicePeripheralModel ):
56- return GenericDevicePeripheral .from_config (mp .peripheral )
57- elif isinstance (mp .peripheral , GpioPeripheralModel ):
58- return GpioPeripheral .from_config (mp .peripheral )
59- elif isinstance (mp .peripheral , GpuPeripheralModel ):
60- return GpuPeripheral .from_config (mp .peripheral )
61- elif isinstance (mp .peripheral , I2cPeripheralModel ):
62- return I2cPeripheral .from_config (mp .peripheral )
63- elif isinstance (mp .peripheral , IspPeripheralModel ):
64- return IspPeripheral .from_config (mp .peripheral )
65- elif isinstance (mp .peripheral , RealSenseCameraPeripheralModel ):
66- return RealSenseCameraPeripheral .from_config (mp .peripheral )
67- elif isinstance (mp .peripheral , RenderingPeripheralModel ):
68- return RenderingPeripheral .from_config (mp .peripheral )
51+ if isinstance (mp .peripheral . root , CameraPeripheralModel ):
52+ return CameraPeripheral .from_config (mp .peripheral . root )
53+ elif isinstance (mp .peripheral . root , CodecPeripheralModel ):
54+ return CodecPeripheral .from_config (mp .peripheral . root )
55+ elif isinstance (mp .peripheral . root , GenericDevicePeripheralModel ):
56+ return GenericDevicePeripheral .from_config (mp .peripheral . root )
57+ elif isinstance (mp .peripheral . root , GpioPeripheralModel ):
58+ return GpioPeripheral .from_config (mp .peripheral . root )
59+ elif isinstance (mp .peripheral . root , GpuPeripheralModel ):
60+ return GpuPeripheral .from_config (mp .peripheral . root )
61+ elif isinstance (mp .peripheral . root , I2cPeripheralModel ):
62+ return I2cPeripheral .from_config (mp .peripheral . root )
63+ elif isinstance (mp .peripheral . root , IspPeripheralModel ):
64+ return IspPeripheral .from_config (mp .peripheral . root )
65+ elif isinstance (mp .peripheral . root , RealSenseCameraPeripheralModel ):
66+ return RealSenseCameraPeripheral .from_config (mp .peripheral . root )
67+ elif isinstance (mp .peripheral . root , RenderingPeripheralModel ):
68+ return RenderingPeripheral .from_config (mp .peripheral . root )
6969 else : # ("Other", "Speaker", "Keyboard", "Mouse")
70- return OtherPeripheral .from_config (mp .peripheral )
70+ return OtherPeripheral .from_config (mp .peripheral . root )
0 commit comments