+
     vi0  c                   s0   R t ^ RIt^ RIt^ RIt^ RIHtHt ^ RIHtH	t	 ]P                  ! ]4      tRtRtRtRtRtR	tR
tR^ R^/tR^ R^R^R^R^/tR^R^R^R^R^R^
R^	R^R^R^R^R^R^R^R ^/tR^ R^R^R^R^R ^/tR!^R"^/tR# tR$ t ! R% R&]4      tR# )'zliquidctl drivers for Lian Li Gallahad II Vision liquid coolers.

Supported devices:

- GA II LCD

Copyright Tom Frey, Jonas Malaco, Shady Nawara, Ilia Khubuluri and contributors
SPDX-License-Identifier: GPL-3.0-or-later
N)PyUsbDeviceUsbHidDriver)NotSupportedByDeviceNotSupportedByDriveri  i	  zLiquid temperaturez
Pump speedz	Pump dutyz	Fan speedzFan dutyforwardZbackwardZslowestZslowernormalZfasterZfastestZbouncezcolor-morphZburstzbig-bangzstatic-starry-nightzcolorful-starry-nightZtransmitZfluctuationzticker-tapeZmeteorZrunwayZ	breathingZstaticzrainbow-morphZrainbowfanpumpc                  s@    R P                  \        \        V 4      4      # )z, )ZjoinZmapZrepr)Znamess   *=/usr/lib/python3.14/site-packages/liquidctl/driver/ga2_lcd.py_quotedr	   K   s    99Su%&&    c                s   ^ .V,          WW#,           % \        V4      ^ 8  dE   V^ ,          ^ ,          W&   V^ ,          ^,          W^,           &   V^ ,          ^,          W^,           &   \        V4      ^8  dL   V^,          ^ ,          W^,           &   V^,          ^,          W^,           &   V^,          ^,          W^,           &   \        V4      ^8  dL   V^,          ^ ,          W^,           &   V^,          ^,          W^,           &   V^,          ^,          W^,           &   \        V4      ^8  dN   V^,          ^ ,          W^	,           &   V^,          ^,          W^
,           &   V^,          ^,          W^,           &   R# R# )zOWrite variable length 3-byte RGB color arrays
to a buffer at a specific offset.N)len)Zbuffercolorsoffsetlengths   &&&&r   _write_colorsr   O   s2    )*sV|FFO$
6{Q1#AYq\z#AYq\z
6{Q#AYq\z#AYq\z#AYq\z
6{Q#AYq\z#AYq\z#AYq\z
6{Q#AYq\z$Qil{$Qil{ r
   c                   s   a  ] tR t^ft o . tRRR/ 3.tRR ltRR ltRR ltR t	RR lt
R	 tR
 tR tR tR tR tR tR tR tR tRtV tR# )GA2LCDi  is  zLian Li GA II LCDc                s   V P                   P                  4        V P                  4       pR V9   g   \        RV 24      hV P                  P                  RVR34       RV n        RV n        \        V P                  4      # )zCA_II-Visionz>Device firmware version does not match expected GA_II format: zFirmware versionZ FT)	deviceclear_enqueued_reports_read_firmware_versionr   _statusappendsupports_lightingsupports_coolingZsorted)selfdirect_accesskwargsZversion   &&, r   
initializeZGA2LCD.initializeq   s|    **,--/')&PT[S\]  	/"=>!& $dll##r
   c                sL   V P                   P                  4        V P                  4       p\        VR,          R3\        VR,          R3\
        \        VR,          \        ,          ^d,          ^d4      R3\        VR,          R3\        VR,          \        ,          ^d,          R3.# )zJGet a status report.

Returns a list of `(property, value, unit)` tuples.
temperatureu   °Cfan_rpmZrpmZ%pump_rpm)r   r   _get_handshake_STATUS_TEMPERATURE_STATUS_FAN_SPEED_STATUS_FAN_DUTYmin_FAN_RPM_MAX_STATUS_PUMP_SPEED_STATUS_PUMP_DUTY_PUMP_RPM_MAX)r   r   r   Z	handshaker   r   
get_statusZGA2LCD.get_status   s    
 	**,'')	 )M":EB	) 4e<s9Y#7,#F#LcRTWX:!6>	* 5 E KSQ
 	
r
   c                s    VR8X  d   V P                   ! W#WE3/ VB  R# VR8X  d   V P                  ! W#WE3/ VB  R# \        RV R24      h)z*Set the color mode for a specific channel.r   r   zlighting control for   is not supported by this driverN)_set_pump_lighting_set_fan_lightingr   )r   channelmoder   speed	directionr   s   &&&&&&,r   	set_colorZGA2LCD.set_color   sX     f##D%MfM""4LVL&'y0PQ r
   c                    \        4       hzNot supported by this device.)r   )r   r-   Zprofiler   s   &&&,r   set_speed_profileZGA2LCD.set_speed_profile   s    "$$r
   c                s    V\         9  d   \        RV R24      h\        ^ \        ^dV4      4      pV P	                  \         V,          ^ V.4       R# )z"Set channel to a fixed speed duty.zfixed speed control for r*   N)_SPEED_CHANNELSr   Zmaxr$   _write_a_cmd_with_data)r   r-   Zdutyr   r   r/   s   &&&&, r   set_fixed_speedZGA2LCD.set_fixed_speed   sS     /)&*7)3ST  As3~&##OG$<q%jIr
   c                r2   r3   )r   )r   r-   r.   Zvaluer   s   &&&&,r   
set_screenZGA2LCD.set_screen   s     #$$r
   c                s   V'       g
   ^V^ ^ ^ ^ ..# ^ p^ p. pV\        V4      8  d   \        \        V4      V,
          ^:4      p^ .^@,          p^V^ &   W^&   ^ V^&   VP                  ^RR7      pV^ ,          V^&   V^,          V^&   Wg^&   W$WF,            V^^V,           % \        P	                  RVVVV4       V^,          pWF,          pVP                  V4       K  V# )i   bigZ	byteorderz=Command: 0x%02x, PDU Number: %d, Offset: %d, Data Length: %d
)r   r$   Zto_bytes_LOGGERdebugr   )	r   cmddataZnumr   Zcmd_pasZdata_lenZcmd_paZ	num_bytess	   &&&      r   _get_a_cmd_bytesZGA2LCD._get_a_cmd_bytes   s
    	 	  s4y 3t9v-r2HS2XFF1I1IF1IQ%8I!!F1I!!F1I 1I'+V5F'GF1q8|$MMP 1HCFNN6"r
   c                sZ    V P                  V. 4      pV P                  V^ ,          4       R# )    N)r?   _write)r   r=   packetss   && r   _write_a_cmdZGA2LCD._write_a_cmd   s$    ''R0GAJr
   c                s    V P                  W4      p\        P                  R V4       V F  pV P                  V4       K  	  R# )zWriting command: 0x%02xN)r?   r;   r<   rA   )r   r=   r>   rB   Zpackets   &&&  r   r6   ZGA2LCD._write_a_cmd_with_data   s7    ''2/5FKK r
   c                s<    V P                   P                  V4       R # )N)r   Zwrite)r   bytess   &&r   rA   ZGA2LCD._write   s    % r
   c           	     s   V P                   P                  ^@4      pV'       g   \        R4      h\        V4      ^8  d   \        R4      h\        P                  RV^ ,          V^,          V^,          V^,          V^,          4       V^ ,          ^8w  d   \        R4      hV^,          p\        P                  VR,          RR7      pV^,          p\        V^:4      p\        P                  ! V^:,          4      pV^^V,            pV^8  d   \        V^,
          4       F  pV P                   P                  ^@4      pV^ ,          ^8w  d   \        R4      hV^,          V8w  d   \        R4      h\        P                  VR,          RR7      pW8^,           8w  d   \        R	4      hV\        V4      ,
          p	\        V	^:4      pWq^^V,            ,          pK  	  R
VRVRVRV/# )i@   zDevice not respondingzUnexpected response from devicez`Read command: type: 0x%02X, command: 0x%02X, number_a: 0x%02X,  number_b: 0x%02X, length: 0x%02XzInvalid response from device:i   i   Nr9   r:   zUnexpected command in responsezUnexpected response numbercommandnumberr   r>   )r   Zread
ValueErrorr   r;   r<   int
from_bytesr$   mathZceilZrange)
r   rrE   rF   r   Zcurrent_lengthZpacket_countr>   ZiZlength_remainings
   &         r   _read_a_cmdZGA2LCD._read_a_cmd   s   KKR 455q6A:>??naDaDaDaDaD	
 Q419;<<A$#%81VRyy"-Q'(!<!+,KK$$R(Q419$%CDDQ47?$%EFF#%@U?$%ABB#)CI#5 !$%5r!:!a.011 - 7HfhPTUUr
   c                s   V P                  ^4       V P                  4       p^ VR,          9   d#   VR,          RVR,          P                  ^ 4       MVR,          p\        V4      pVP	                  RRR7      pV P                  4       p^ VR,          9   d#   VR,          RVR,          P                  ^ 4       MVR,          p\        V4      pVP	                  RRR7      pVP                  4       R,           VP                  4       ,           pV# )z*Read the firmware version from the device.r>   NZasciiZignore)ZerrorsZ )rC   rL   ZindexrD   ZdecodeZstrip)	r   Zp1Zp1_dataZstring_dataZascii_string_p1Zp2Zp2_dataZascii_string_p2Zascii_strings	   &        r   r   ZGA2LCD._read_firmware_version  s    $  89BvJ"V*2r&z//23BvJGn%,,WX,F78BvJ"V*2r&z//23BvJGn%,,WX,F&,,.47L7L7NNr
   c                s@   V P                   P                  4        V P                  ^4       V P                  4       pVR,          ^8w  d   \	        R4      hVR,          ^ 8w  d   \	        R4      hVR,          ^8w  d   \	        R4      h\
        P                  VR,          R,          R	R
7      p\
        P                  VR,          R,          R	R
7      pVR,          ^,          pVR,          ^,          pWER,          ,           p\        P                  RVVV4       RVRVRV/# )i   rE   zUnexpected handshake responserF   z$Unexpected handshake response numberr   z$Unexpected handshake response lengthr>   :r@      Nr9   r:   :rM   i   Ng      $@z;Handshake response: fan_rpm=%d, pump_rpm=%d, temperature=%fr   r   r   )	r   r   rC   rL   rG   rH   rI   r;   r<   )r   rK   r   r   Ztemp_intZ	temp_fracr   s   &      r   r    ZGA2LCD._get_handshake2  s   **,$Y<4<==X;!CDDX;$CDD..635.A>>!F)C.E>BV9Q<fIaL	T!11I		
 w;
 	
r
   c                s   ^ .^,          pV\         9  d   \        R\        \          24      hV\        9  d   \        R\        \          24      hV\        9  d   \        R\        \	          24      h\        V4      p^ V^ &   \         V,          V^&   ^V^&   \        V,          V^&   \        Wb^^4       \        V,          V^&   ^ V^&   ^ V^&   V P                  ^V4       R# )r@   z.unknown pump lighting mode, should be one of: z/unknown pump lighting speed, should be one of: .unknown lighting direction, should be one of: N)_PUMP_LIGHTING_MODESrG   r	   _PUMP_LIGHTING_SPEEDS_LIGHTING_DIRECTIONSZlistr   r6   r   r.   r   r/   r0   r   Zreq   &&&&&, r   r+   ZGA2LCD._set_pump_lightingS  s    cBh++@J^A_@`a  --A'K`BaAbc  00@J^A_@`a  fA%d+AA&u-Ac1b)&y1BBB##D#.r
   c                s   ^.^,          pV\         9  d   \        R\        \          24      hV\        9  d   \        R\        \          24      hV\        9  d   \        R\        \	          24      h\         V,          V^ &   ^V^&   \        V,          V^&   \        Wb^^4       \        V,          V^&   ^ V^&   ^ V^&   ^ V^&   ^V^&   V P                  ^V4       R# )i   z-unknown fan lighting mode, should be one of: z.unknown fan lighting speed, should be one of: rN   N)_FAN_LIGHTING_MODESrG   r	   rP   rQ   r   r6   rR   rS   r   r,   ZGA2LCD._set_fan_lightingr  s    cBh**?I\@]?^_  --@J_A`@ab  00@J^A_@`a  %T*AA&u-Ac1b)&y1BBBBB##D#.r
   )r   r   N)F)r   r   )__name__Z
__module__Z__qualname__Z__firstlineno__r   Z_MATCHESr   r)   r1   r4   r7   r8   r?   rC   r6   rA   rL   r   r    r+   r,   Z__static_attributes__Z__classdictcell__)Z__classdict__s   @r   r   r   f   sy     G 		
H$ 

%	J%-^  !,V\(
B/>/ /r
   r   )Z__doc__rJ   ZloggingZsysZliquidctl.driver.usbr    r   Zliquidctl.errorr   r   Z	getLoggerrU   r;   r(   r%   r!   r&   r'   r"   r#   rQ   rP   rO   rT   r5   r	   r   r   ) r
   r   <module>rV      s2     
 : F


H
%* !     t  scccs  d4T4T44dddTt & dddTt  
4
D'+.f/\ f/r
   