+
    i!                       a  R& t!0 t ^ RIt^ RIt^ RIHt ^ RIHt ^ RIHt ^ RI	H
t
 ^ RIHt ^ RIHt ]P                  ! ]4      tRtR	tR
tRRRRRR/tRtRtRtRtRtRRRR.R]R]./t] ^ k R R ltR R ltR  R! ltR" R# ltR$ R% lt R# )'    N)Union)subp)Cloud)Config)
MetaSchema)PER_INSTANCErpi
interfacesenable_usb_gadgetspido_spii2cdo_i2conewire
do_onewireserialdo_serial_consdo_serial_hwz/usr/bin/rpi-usb-gadgetz(Rebooting to apply config.txt changes...idcc_raspberry_pidistroszraspberry-pi-os	frequencyactivate_by_schema_keysc                0    V ^8  d   QhR\         R\         /# )   enablereturnbool)formats   "B/usr/lib/python3/dist-packages/cloudinit/config/cc_raspberry_pi.py__annotate__r"   (   s          $      c                   \         P                  RV 4       \        P                  P	                  \
        4      '       g   \         P                  R\
        4       R#  \        P                  ! \
        V '       d   RMRR.R^R7       R#   \        P                   d"   p\         P                  R	T4        R
p?R# R
p?ii ; i)zsEnable / Disable Raspberry Pi USB gadget mode when
the script is present.

Returns True when a reboot is required.
zEnable rpi-usb-gadget mode: %sz#rpi-usb-gadget script not found: %sFonoffz-f)capturetimeoutTz&Failed to configure rpi-usb-gadget: %sN)	LOGdebugospathexistsRPI_USB_GADGET_SCRIPTerrorr   ProcessExecutionError)r   es   & r!   configure_usb_gadgetr2   (   s     II.777>>/00		79NO		%E 
 	
  %% 		:A>s   B	 :B	 	B?B::B?c                $    V ^8  d   QhR\         /# )r   r   r   )r    s   "r!   r"   r"   K   s      4 r#   c                  p     \         P                   ! . RO4       R#   \         P                   d     R# i ; i)/usr/bin/raspi-configTF)r5   nonint	is_pifive)r   r0    r#   r!   r7   r7   K   s/    		BC%% s    55c                R    V ^8  d   QhR\         \        \        3,          R\        /# )r   cfgr   )r   dictr   )r    s   "r!   r"   r"   S   s'     K KE$*$5 K$ Kr#   c                   RR R llpRpRp\        V \        4      '       d   V! V R4      pV! V R4      pM\        V \        4      '       d   T p\        4       '       g   V'       d   Rp \        P                  ! RR\
        \        V'       d   ^ M^4      .4        \        P                  ! RR\        \        T'       d   ^ M^4      .4       R#   \        P                   d"   p\        P                  R	T4        R
p?R# R
p?ii ; i  \        P                   d"   p\        P                  RT4        R
p?R# R
p?ii ; i)a=  Configure the serial (UART) interface on Raspberry Pi.

Depending on the configuration, this enables or disables
the serial console and the hardware UART by invoking
`raspi-config` non-interactively.

Args:
    cfg: Either a boolean or a dictionary:
        - If a bool, enables or disables the serial
          console and hardware UART together.
        - If a dict, may contain the keys `console`
          and `hardware` with boolean values controlling
          each individually.

Returns:
    True if the configuration was applied successfully,
    False otherwise.
Fc                0    V ^8  d   QhR\         R\        /# )r   cfg_dictname)r;   str)r    s   "r!   r"   0configure_serial_interface.<locals>.__annotate__g   s     
 
 
S 
r#   c                     V P                  W4      p\        V\        4      '       g   \        P	                  R \
        VV4       V# V# )z"Invalid value for %s.serial.%s: %s)get
isinstancer   r)   warningRPI_INTERFACES_KEY)r>   r?   defaultvals   &&& r!   get_bool_field2configure_serial_interface.<locals>.get_bool_fieldg   sA    ll4)#t$$KK4"	 N
r#   consolehardwareTr5   r6   z&Failed to configure serial console: %sNz'Failed to configure serial hardware: %s)F)rD   r;   r   r7   r   RASPI_CONFIG_SERIAL_CONS_FNr@   r0   r)   r/   RASPI_CONFIG_SERIAL_HW_FN)r:   rI   enable_console	enable_hwr1   s   &    r!   configure_serial_interfacerQ   S   s
   (
 NI#t'Y7"3
3		C		 ;;> 			'+AQ/		
		')A*		
  %% 		:A> %% 		;Q?s0   )1C 1D D#C??DD=D88D=c                <    V ^8  d   QhR\         R\        R\        /# )r   ifacer   r   )r@   r   )r    s   "r!   r"   r"      s!      s D T r#   c                0   V \         P                  4       9   g   Q RV  24       h \        P                  ! RR\         V ,          \        V'       d   ^ M^4      .4       R#   \        P                   d"   p\
        P                  RY4        Rp?R# Rp?ii ; i)a  Enable or disable a supported hardware interface.

Supported interfaces are defined in `SUPPORTED_INTERFACES` and
currently include SPI, I2C, and 1-Wire. The function applies
the change using `raspi-config` in non-interactive mode.

Args:
    iface: The interface name (e.g. `"spi"` or `"i2c"`).
    enable: True to enable the interface, False to disable it.

Returns:
    True if the interface configuration succeeded, False otherwise.
zUnsupported interface: r5   r6   TzFailed to configure %s: %sNF)SUPPORTED_INTERFACESkeysr   r@   r0   r)   r/   )rS   r   r1   s   && r!   configure_interfacerW      s     	%**,,)	 (),		'$U+AQ'		
 %% 		.9s   8A B4BBc          
      L    V ^8  d   QhR\         R\        R\        R\        RR/# )r   r?   r:   cloudargsr   N)r@   r   r   list)r    s   "r!   r"   r"      s6     T T T6 T% Tt T Tr#   c                 4   \         V9  d   R # \        V\         ,          \        4      '       g)   \        P	                  R\         V\         ,          4       R # V\         ,          '       g   \        P                  R\         4       R # RpV\         ,           EF>  pV\        8X  dR   V\         ,          V,          p\        V\        4      '       d   V\        V4      ,          pM\        R\         24      hK`  V\        8X  Ed   \        V\         ,          V,          \        4      '       g1   \        P	                  R\         V\         ,          V,          4        R # V\         ,          V,          '       g   \        P                  RV4        R # \        V\         ,          V,          P                  4       4      pV F  pV\        P                  4       9  d)   V\        8w  d   \        P	                  R\        V4       KD  V\         ,          V,          V,          pV\        8X  dN   \        V\        \        34      '       g   \        P	                  R\        VV4       MV\        V4      ,          pK  \        V\        4      '       d   V\!        W4      ,          pK  \        P	                  R\        VV4       K  	  EK(  \        P	                  RV4       EKA  	  VRJ d;   VP"                  P%                  R	R
\&        R7      p	\(        P(                  ! V	4       R # R # )NzInvalid value for %s: %szEmpty value for %s. Skipping...FzInvalid value for zInvalid key for %s: %szInvalid value for %s.%s: %szUnsupported key: %sTrebootnow)modedelaymessage)RPI_BASE_KEYrD   r;   r)   rE   r*   ENABLE_USB_GADGET_KEYr   r2   
ValueErrorrF   r[   rV   rU   SERIAL_INTERFACErQ   rW   distroshutdown_command
REBOOT_MSGr   )
r?   r:   rY   rZ   want_rebootkeyr   subkeyssubkeycmds
   &&&&      r!   handlern      sg   3L)400&	

 			3\BK<  ''&s+F&$''3F;; #56K5L!MNN&&c,/4d;;. %c*
 &s++		;SA3|,S16689G ""6";";"=="22KK02Df \*3/7--%ftTl;;9.""	 $'A&'IIfd++#6v#FFKKK5*	7 "D KK-s3w !z dll++ , 

 			# r#   c                @    V ^8  d   Qh/ ^ \         9   d
   \        ;R&   # )r   meta)__conditional_annotations__r   )r    s   "r!   r"   r"      s    2 j 3 r#   )"rq   loggingr+   typingr   	cloudinitr   cloudinit.cloudr   cloudinit.configr   cloudinit.config.schemar   cloudinit.settingsr   	getLogger__name__r)   rb   rF   rc   rU   re   rM   rN   r.   rh   rp   r2   r7   rQ   rW   rn   r"   )rq   s   @r!   <module>r{      s     	   ! # . +!! + 	8	8| 
  . * 1 7
 	
!"~	  FK\DTr#   