+
     viS  c                   s    R t ^ RIt^ RIt^ RIt^ RIHt ^ RIHtHt ^ RI	H
t
HtHt ]P                  ! ]4      tRt^t^t^t^t^t^t^ t^tR t ! R R]4      tR# )	a  liquidctl driver for Aquacomputer family of watercooling devices.

Aquacomputer D5 Next watercooling pump
--------------------------------------
The pump sends a status HID report every second with no initialization
being required.

The status HID report exposes sensor values such as liquid temperature and
two groups of fan sensors, for the pump and the optionally connected fan.
These groups provide RPM speed, voltage, current and power readings. The
pump additionally exposes +5V and +12V voltage rail readings and eight virtual
temperature sensors.

The pump and fan can be set to a fixed speed (0-100%).

Aquacomputer Farbwerk 360
-------------------------
Farbwerk 360 is an RGB controller and sends a status HID report every second
with no initialization being required.

The status HID report exposes four physical and sixteen virtual temperature
sensor values.

Aquacomputer Octo
-------------------------
Octo is a fan/RGB controller and sends a status HID report every second with
no initialization being required.

The status HID report exposes four temperature sensor values and eight groups
of fan sensors for optionally connected fans. Octo additionaly exposes sixteen
virtual temp sensors through this report.

Aquacomputer Quadro
-------------------------
Quadro is a fan/RGB controller and sends a status HID report every second with
no initialization being required.

The status HID report exposes four physical and sixteen virtual temperature sensor
values, and four groups of fan sensors for optionally connected fans.

Driver
------
Linux has the aquacomputer_d5next driver available since v5.15. Subsequent
releases have more functionality and support a wider range of devices
(detailed below). If present, it's used instead of reading the status
reports directly.

Hwmon support:
    - D5 Next watercooling pump: sensors - 5.15+, direct PWM control - not yet in fully
    - Farbwerk 360: sensors - 5.18+
    - Octo: sensors - 5.19+, direct PWM control - not yet in fully
    - Quadro: sensors - 6.0+, direct PWM control - not yet in fully

Virtual temp sensor reading is supported in 6.0+.

Copyright Aleksa Savic and contributors
SPDX-License-Identifier: GPL-3.0-or-later
N)UsbHidDriver)NotSupportedByDriverNotSupportedByDevice)
u16be_fromclampmkCrcFuni  c                 sx    \        V P                  ^R4      4      pV^ ,          V^,          uW&   W^,           &   R# )i   ZbigN)Z	bytearrayZto_bytes)ZvalueZdataoffsetZvalue_bes   &&& B/usr/lib/python3.14/site-packages/liquidctl/driver/aquacomputer.pyput_unaligned_be16r   S   s4    512H%-a[(1+"DL$z"    c            +       s  aa ] tR t^Xt oRtRtRtRtRt]/ R]bR^l^_.bR^W.bR	]	! ^ ^4       U u. uF  p ^?V ^,          ,           NK  	  up bR
^9bR^7bRR.bR]	! ^^	4       Uu. uF  pRV 2NK
  	  upbRRR.bRRR.bRRR.bRRR.bR^bRRbRR ^R!^A/bR"R R#R!R$/b]R]R. RJOR. RKOR^/]R]R. RLOR	]	! ^ ^4       U u. uF  p ^:V ^,          ,           NK  	  up R. RKOR]	! ^^4       Uu. uF  pRV 2NK
  	  upR^/]R]R. RMOR. RNOR	]	! ^ ^4       U u. uF  p ^EV ^,          ,           NK  	  up R. RKOR]	! ^^4       Uu. uF  pRV 2NK
  	  upR]	! ^^	4       Uu. uF	  pR%V R&2NK  	  upR]	! ^^	4       Uu. uF	  pR%V R'2NK  	  upR]	! ^^	4       Uu. uF	  pR%V R(2NK  	  upR]	! ^^	4       Uu. uF	  pR%V R)2NK  	  upRR*RR+R]
! ]	! ^^	4       Uu. uF  pR!V 2NK
  	  up. ROO4       UU u/ uF  w  r0W0bK	  	  up p/]R]R. RPOR. RQOR	]	! ^ ^4       U u. uF  p ^<V ^,          ,           NK  	  up R. RKOR]	! ^^4       Uu. uF  pRV 2NK
  	  upR]	! ^^4       Uu. uF	  pR%V R&2NK  	  upR]	! ^^4       Uu. uF	  pR%V R'2NK  	  upR]	! ^^4       Uu. uF	  pR%V R(2NK  	  upR]	! ^^4       Uu. uF	  pR%V R)2NK  	  upR,^nR^RR-R]
! ]	! ^^4       Uu. uF  pR!V 2NK
  	  up. RRO4       UU u/ uF  w  r0W0bK	  	  up p//tR.R/R0R1]],          /3R.R2R3R1]],          /3R.R4R5R1]],          /3R.R6R7R1]],          /3R.R8R9R1]],          /3.tV3R: ltR; tR< tR= tRSR> ltR? tR@ tRA tRB tRSRC ltRD tRE t]RF 4       t]RG 4       tRTRH ltRItVtV;t# u up i u upi u up i u upi u up i u upi u upi u upi u upi u upi u upi u up pi u up i u upi u upi u upi u upi u upi u upi u up pi )UAquacomputerzD5 NextZFarbwerkzFarbwerk 360ZOctoZQuadrotypefan_sensorstemp_sensorsvirt_temp_sensorsplus_5v_voltageplus_12v_voltagetemp_sensors_labelzLiquid temperaturevirt_temp_sensors_labelzSoft. Sensor fan_speed_labelz
Pump speedz	Fan speedfan_power_labelz
Pump powerz	Fan powerfan_voltage_labelzPump voltagezFan voltagefan_current_labelzPump currentzFan currentstatus_report_lengthctrl_report_lengthi)  fan_ctrlZpumpfanhwmon_ctrl_mappingZpwm1Zpwm2zFan z speedz powerz voltagez currentiG  i_  flow_sensor_offseti  ip  i  zAquacomputer D5 Nextdevice_infoi
  zAquacomputer Farbwerki  zAquacomputer Farbwerk 360i  zAquacomputer Octoi  zAquacomputer Quadroc                sN   < \         SV `  W4       R V n        R V n        W0n        R # N)Zsuper__init___firmware_version_serial_device_info)selfdeviceZdescriptionr   kwargs	__class__s   &&&&,r   r   ZAquacomputer.__init__   s'    - "&'r	   c                sF    V P                   pV P                  pRVR3RVR3.# )a  Initialize the device and the driver.

This method should be called every time the system boots, resumes from
a suspended state, or if the device has just been (re)connected.  In
those scenarios, no other method, except `connect()` or `disconnect()`,
should be called until the device and driver has been (re-)initialized.

Returns None or a list of `(property, value, unit)` tuples, similarly
to `get_status()`.
zFirmware versionZ zSerial number)firmware_version_serial_number)r#   r%   ZfwZserial_numbers   &,  r   
initializeZAquacomputer.initialize   s3     ""++#R,r.RSSr	   c                s  a aa VV V3R  lpS P                  4       o. oV! RR4       V! RR4       \        S P                  P                  R. 4      4       EF'  w  r#S P                  R,          V,          \	        SV\
        ,           4      R3pSP                  V4       S P                  R,          V,          \	        SV\        ,           4      R	,          R
3pSP                  V4       S P                  R,          V,          \	        SV\        ,           4      R	,          R3pSP                  V4       S P                  R,          V,          \	        SV\        ,           4      R,          R3pSP                  V4       EK*  	  S P                  R,          S P                  8X  ds   R\	        SS P                  R,          4      R	,          R3pSP                  V4       R\	        SS P                  R,          4      R	,          R3p	SP                  V	4       S# S P                  R,          S P                  8X  d2   R\	        SS P                  R,          4      R3p
SP                  V
4       S# )c                 s   < \        SP                  P                  V . 4      4       FS  w  r#\        SV4      pV\        8w  g   K  SP                  V,          V,          VR ,          R3pSP                  V4       KU  	  R# ){Gz?   °CN)	enumerater"   getr   _AQC_TEMP_SENSOR_DISCONNECTEDappend)	offsets_key
labels_keyidxtemp_sensor_offsetZtemp_sensor_valuetemp_sensor_readingmsgr#   sensor_readingss	   &&    r   _read_temp_sensorsZ=Aquacomputer._get_status_directly.<locals>._read_temp_sensors   sx    +4T5F5F5J5J;XZ5[+\'$.s4F$G!$(EE))*5c:)D0+'
 $**+>? ,]r	   r   r   r   r   r   r   rpmr   r*   Wr   Vr   MbP?Ar   +5V voltager   +12V voltager   Flow sensorr   dL/h)_readr,   r"   r-   r   _AQC_FAN_SPEED_OFFSETr/   _AQC_FAN_POWER_OFFSET_AQC_FAN_VOLTAGE_OFFSET_AQC_FAN_CURRENT_OFFSET_DEVICE_D5NEXT_DEVICE_QUADRO)r#   r7   r2   fan_sensor_offset	fan_speed	fan_powerfan_voltagefan_currentr   r   flow_sensor_valuer5   r6   s   f          @@r   _get_status_directlyZ!Aquacomputer._get_status_directly   sa   		@ jjl 	>+?@ 	.0IJ '00A0A0E0EmUW0X&Y"C!!"34S93 14I IJI
 ""9- !!"34S93 14I IJTQI
 ""9- !!"56s;3 14K KLtSK
 "";/ !!"56s;3 14K KLtSK
 "";/7 'Z< V$(;(;; 3 1 12C DELO
 ""?3 3 1 12D EFM 
 ""#34  v&$*=*== 3 1 12F GH!
 ""#45r	   c           
     s  a a RV V3R llp. oV! RR4       V! RR\        S P                  P                  R. 4      4      4       \        S P                  P                  R. 4      4       EF\  w  r#S P                  R,          V,          S P                  P                  RV^,            R	24      R
3pSP                  V4       S P                  R,          V,          S P                  P                  RV^,            R	24      R,          R3pSP                  V4       S P                  R,          V,          S P                  P                  RV R	24      R,          R3pSP                  V4       S P                  R,          V,          S P                  P                  RV^,            R	24      R,          R3pSP                  V4       EK_  	  S P                  R,          S P                  8X  d   RS P                  P                  R4      R,          R3pSP                  V4       S P                  P                  R4      '       d9   RS P                  P                  R4      R,          R3p	SP                  V	4       S# \        P                  RS P                  P                  4        S# S P                  R,          S P                  8X  d0   RS P                  P                  R4      R3p
SP                  V
4       S# )     c                 s
  < R p\        S	P                  P                  V . 4      4       Fh  w  rE S	P                  P	                  RV^,           V,            R24      R,          pS	P                  T,          T,          TR3pS
P                  T4       Kj  	  V'       d-   \        P                  RS	P                  P                  4       R# R#   \
         d-   pTP                  \        P                  8X  d   Rp Rp?K  Rp?ii ; i)FZtemp_inputr;   TNr+   z6some temp sensors cannot be read from %s kernel driver)r,   r"   r-   _hwmonread_intZOSErrorerrnoZENOENTr/   _LOGGERwarningdriver)r0   r1   Zidx_addZencountered_errorsr2   r3   Z	hwmon_valZos_errorr4   r#   r6   s   &&&      r   r7   Z?Aquacomputer._get_status_from_hwmon.<locals>._read_temp_sensors9  s    !&+4T5F5F5J5J;XZ5[+\' $ 4 4tC!Gg<M;Nf5U VY] ]I %%j1#6'#
  &&':; ,]" "LKK&& "    ~~5-1*s   4CD!C==Dr   r   r   r   r   r   r   rP   r8   r   Zpowergư>r9   r   Zinr;   r:   r   Zcurrr<   r   r=   Z	in2_inputZ	in3_inputr>   z1+12V voltage cannot be read from %s kernel driverr?   Z
fan5_inputr@   )rO   )Zlenr"   r-   r,   rQ   rR   r/   rF   has_attributerT   rU   rV   rG   )r#   r7   r2   rH   rI   rJ   rK   rL   r   r   rM   r6   s   f          @r   _get_status_from_hwmonZ#Aquacomputer._get_status_from_hwmon8  s   	 	4  	>+?@ 	%!!%%nb9:	
 '00A0A0E0EmUW0X&Y"C!!"34S9$$s37)6%:;I
 ""9- !!"34S9$$uS1WIV%<=DI
 ""9- !!"56s;$$r#f%56=K
 "";/ !!"56s;$$tC!G9F%;<tCK
 "";/7 'Z< V$(;(;;,dkk.B.B;.ORV.VX[\O""?3{{((55$2DKK4H4H4UX\4\^a#b &&'78  GI[I[  v&$*=*==!.0D0D\0RTZ [""#45r	   c                sB   V P                   '       dC   V'       g;   \        P                  RV P                   P                  4       V P	                  4       # V P                   '       d+   \        P                  RV P                   P                  4       V P                  4       # )zJGet a status report.

Returns a list of `(property, value, unit)` tuples.
z4bound to %s kernel driver, reading status from hwmonz4directly reading the status despite %s kernel driver)rQ   rT   inforV   rX   rU   rN   )r#   direct_accessr%   s   &&,r   
get_statusZAquacomputer.get_status  so     ;;;}LLOQUQ\Q\QcQcd..00;;;OOFHZHZ ((**r	   c                sV   V P                   R ,          V P                  8X  gE   V P                   R ,          V P                  8X  g#   V P                   R ,          V P                  8X  d   \	        4       hV P                   R ,          V P
                  V P                  39   d   \        4       hR# )r   N)r"   rF   _DEVICE_OCTOrG   r   _DEVICE_FARBWERK360_DEVICE_FARBWERKr   )r#   channelZprofiler%   s   &&&,r   set_speed_profileZAquacomputer.set_speed_profile  s    f%)<)<<  (D,=,==  (D,?,?? '((v&4+C+CTEZEZ*[[&(( \r	   c                s~    R V P                   9   d   V P                   R ,          V,          pMRV^,           2pW" R23# )r   ZpwmZ_enable)r"   )r#   r_   Zpwm_name   && r   _fan_name_to_hwmon_namesZ%Aquacomputer._fan_name_to_hwmon_names  sH    4#4#44(()=>wGH WQZL)H:W---r	   c                s    V P                  V4      w  r4V P                  P                  V^4       \        P                  ! R4       V^,          ^d,          pV P                  P                  W54       R# )i   皙?N)rb   rQ   Z	write_inttimesleep)r#   r_   dutyhwmon_pwm_namehwmon_pwm_enable_nameZpwm_dutys   &&&   r   _set_fixed_speed_hwmonZ#Aquacomputer._set_fixed_speed_hwmon  s]    040M0Mg0V- 	3Q7 	

3 #:$ 	n7r	   c                s   V P                   R ,          pV P                  P                  \        V4      pV P                   R,          V,          p^ WE\        ,           &   \        V^d,          VV\        ,           4       \        R4      p\        V^V^,
          ^,            4      pV! V4      p\        WV^,
          4       \        P                  ! R4       V P                  P                  V4       R# )r   r   z
crc-16-usbrc   N)r"   r$   Zget_feature_report_AQC_CTRL_REPORT_ID_AQC_FAN_TYPE_OFFSETr   _AQC_FAN_PERCENT_OFFSETr   Zbytesrd   re   Zsend_feature_report)	r#   r_   rf   Zreport_lengthZctrl_settingsZfan_ctrl_offsetZcrc16usb_funcZchecksum_partZchecksum_bytess	   &&&      r   _set_fixed_speed_directlyZ&Aquacomputer._set_fixed_speed_directly  s    ))*>?667JMZ++J7@ AB(<<= 	3J55	
 !.mD=13Dq3HIJ&}5>-!:KL 	

3''6r	   c                s   V P                   R ,          V P                  8X  d   \        4       h\        V^ ^d4      pV P                  '       Ed   V P                  V4      w  rVV P                  P                  V4      '       d   V P                  P                  V4      '       d   V'       d<   \        P                  RV P                  P                  4       V P                  W4      # \        P                  RV P                  P                  4       V P                  W4      # V'       g+   \        P                  RV P                  P                  4       V P                  W4       R# )r   zDdirectly writing fixed speed despite %s kernel driver having supportz7bound to %s kernel driver, writing fixed speed to hwmonz^required PWM functionality is not available in %s kernel driver, falling back to direct accessN)r"   r]   r   r   rQ   rb   rW   rT   rU   rV   rm   rY   ri   )r#   r_   rf   rZ   r%   rg   rh   s   &&&&,  r   set_fixed_speedZAquacomputer.set_fixed_speed  s   V$(@(@@&(( T1c";;;484Q4QRY4Z1N {{((88T[[=V=V%> > !OO^**  99'HHMt{{OaOa 227AA"tKK&&
 	&&w5r	   c                s    \        4       hr   )r   )r#   r_   ZmodeZcolorsr%   s   &&&&,r   	set_colorZAquacomputer.set_color	  s    "$$r	   c                s    V P                   e   V P                  fH   V P                  RR7      p\        V^4      V n         \        V^4      R R\        V^4      R 2V n        R # R # )NF)clear_firstZ05Z-)r    r!   rA   r   )r#   r5   s   & r   _read_device_staticsZ!Aquacomputer._read_device_statics  sb    !!)T\\-A***/C%/S%9D"(c226a
38LR7PQDL	 .Br	   c                :    V P                  4        V P                  # r   )rq   r    r#      &r   r'   ZAquacomputer.firmware_version  s    !!#%%%r	   c                rr   r   )rq   r!   rs   rt   r   r(   ZAquacomputer._serial_number  s    !!#||r	   c                s    V'       d   V P                   P                  4        V P                   P                  V P                  R ,          4      pV# )r   )r$   Zclear_enqueued_reportsZreadr"   )r#   rp   r5   ra   r   rA   ZAquacomputer._read  s:    KK..0kkt001GHI
r	   )r"   r    r!   )i/   i1   i3   i5   )zSensor 1zSensor 2zSensor 3zSensor 4)i2   4   6   8   )}         i   i   i   i   i   )i=   i?   iA   iC   )iZ   i   i  iY  i  i  iX  i  )ip   rx   ry   rz   )ru   rv   rw   i:   )rv   i   i   i5  )F)T) __name__Z
__module__Z__qualname__Z__firstlineno__rF   r^   r]   r\   rG   ZrangeZzipZ_DEVICE_INFOZ_MATCHESr   r)   rN   rX   r[   r`   rb   ri   rm   rn   ro   rq   Zpropertyr'   r(   rA   Z__static_attributes__Z__classdictcell__Z__classcell__)r   ZnumZiZnamer&   Z__classdict__s   0000@@r   r
   r
   X   s    N!(LN 	 
N
D$<
 TF
  %1+!N+$!"3"3+!N	

 t
 
 !#7"8
 &qRW'Y#-u(='Y
 k:
 k:
  .-!@
  .-!@
 #D
 !%
 ud3
  !665&"A!
$ 	$4 "R"D	
 	'4%2,!O,$!"3"3,!O "R%qRXIY'ZIY#-u(=IY'Z"D
 	LK4%2,!O,$!"3"3,!O "R%qRXIY'ZIY#-u(=IY'ZeAuoNos$se6 2oNeAuoNos$se6 2oN%5/!R/3DX"6/!R%5/!R/3DX"6/!R"E %&)(-a81s1#Y8J''NT '
* 	N34%2,!O,$!"3"3,!O "R%qRXIY'ZIY#-u(=IY'ZeAuoNos$se6 2oNeAuoNos$se6 2oN%5/!R/3DX"6/!R%5/!R/3DX"6/!R $"D %&)(-a81s1#Y8-''NT '
mLL` "L89		
 #L)9:;		
 'L)<=>		
 L67		
 !L89		
3HB(T"N`Xt+"	).87:#6J%R & &   u "O (Z& "P'Z "P'ZNN!R!R 9 "P'ZNN!R!R 9s{   N
!N
;N&N$ N) ;N.(N3,4N80N=4.O8OA,OAO$?O,O08O!4O&82O+<O0A2O5Ar
   )Z__doc__Zloggingrd   rS   Zliquidctl.driver.usbr    Zliquidctl.errorr   r   Zliquidctl.utilr   r   r   Z	getLoggerr{   rT   r.   rD   rE   rC   rB   Z_AQC_STATUS_READ_ENDPOINTrj   rk   rl   r   r
   ) r	   r   <module>r|      sx   9z   - F 6 6


H
% &          >
J< Jr	   