Ë
     oÞZ‘€  ã                   óH  — d dl Z d dlZd dlZd dlZd dlmZ d dlmZ d dlmZ d dlmZ d dlmZ d dlm	Z	 d dlm
Z
 d	Zd
ZdZdZ G d„ dej                  «      Z G d„ dej                  «      Z G d„ de«      Z G d„ de«      Z G d„ dej                  «      Z G d„ de«      Zy)é    N)Úc_char_p)Úc_int)Úc_uint)Úc_void_p)Úc_long)Úc_int32)Úc_uint16é   é   é   é   c                   ó4   — e Zd ZdefdefdefdefdefdefgZy)Ú_InputAbsinfoÚvalueÚminimumÚmaximumÚfuzzÚflatÚ
resolutionN)Ú__name__Ú
__module__Ú__qualname__r   Ú_fields_© ó    ú0/usr/lib/python3/dist-packages/libevdev/_clib.pyr   r   *   s9   „ Ø˜'Ð"Ø˜GÐ$Ø˜GÐ$Ø˜Ð!Ø˜Ð!Ø˜wÐ'ð)�Hr   r   c                   ó.   — e Zd ZdefdefdefdefdefgZy)Ú_InputEventÚsecÚusecÚtypeÚcoder   N)r   r   r   r   r	   r   r   r   r   r   r   r   3   s0   „ Ø˜�Ø˜Ð Ø˜Ð"Ø˜Ð"Ø˜'Ð"ð	$�Hr   r   c                   óJ   ‡ — e Zd ZdZdZi Zˆ fd„Zed„ «       Ze	d„ «       Z
ˆ xZS )Ú_LibraryWrapperzH
    Base class for wrapping a shared library. Do not use directly.
    Nc                 óJ   •— t         t        | �  «        | j                  «        y ©N)Úsuperr$   Ú__init__Ú_load)ÚselfÚ	__class__s    €r   r(   z_LibraryWrapper.__init__J   s   ø€ ÜŒo˜tÑ-Ô/Ø�
‰
�r   c                 óp  — | j                   �| j                   S | j                  «       | _         | j                  j                  «       D ]a  \  }}t	        | j                   |«      }|d   |_        |d   |_        t        d«      }t        j                  |d||d  «      }t        | ||«       Œc | j                   S )NÚargtypesÚrestypeÚlibevdevÚname)Ú_libÚ_cdllÚ_api_prototypesÚitemsÚgetattrr-   r.   ÚlenÚdictÚgetÚsetattr)Úclsr0   ÚattrsÚfuncÚprefixÚpynames         r   r)   z_LibraryWrapper._loadN   s¦   € à�8‰8ÐØ—8‘8ˆOà—9‘9“;ˆŒØ ×0Ñ0×6Ñ6Ó8ò 
	'‰MˆT�5Ü˜3Ÿ8™8 TÓ*ˆDØ! *Ñ-ˆDŒMØ  Ñ+ˆDŒLô
 ˜“_ˆFÜ—X‘X˜e V¨T°&°'¨]Ó;ˆFÜ�C˜ Õ&ð
	'ð �x‰xˆr   c                  ó   — t         ‚)zOverride in subclass)ÚNotImplementedErrorr   r   r   r2   z_LibraryWrapper._cdllb   s
   € ô "Ð!r   )r   r   r   Ú__doc__r1   r3   r(   Úclassmethodr)   Ústaticmethodr2   Ú__classcell__©r+   s   @r   r$   r$   ;   sC   ø„ ñð €Dð€Oôð ñó ðð& ñ"ó ô"r   r$   c                   ó<  ‡ — e Zd ZdZed„ «       Zi defedœ“defedœ“deefedœ“deefedœ“defedœ“d	efedœ“d
efedœ“dde	dœ“de	fddœ“de	fedœ“de	efddœ“de	fedœ“de	efddœ“de	fedœ“de	efddœ“de	fedœ“de	efedœ“i de	fedœ“de	fedœ“de	fedœ“de	fedœ“de	efddœ“de	efddœ“de	efddœ“de	efddœ“de	efedœ“d e	efedœ“d!e	fedœ“d"e	efedœ“d#e	ef e
j                  e«      dœ“d$e	e e
j                  e«      fedœ“d%e	efedœ“d&e	efedœ“d'e	eefedœ“¥e	eeefedœe	eefedœe	efedœe	eee	fedœe	efedœe	eefedœe	efedœe	e e
j                  e«      fedœe	fedœe	fedœe	eefedœe	eeefedœe	fedœd(œ¥ZdJˆ fd)„	Zd*„ Zed+„ «       Zej&                  d,„ «       Zed-„ «       Zej&                  d.„ «       Zed/„ «       Zej&                  d0„ «       Zed1„ «       Zed2„ «       Zej&                  d3„ «       Zd4„ Zed5„ «       Zej&                  d6„ «       ZdKd7„ZdLd8„Zed9„ «       Zed:„ «       Zed;„ «       ZedJd<„«       Z edJd=„«       Z!d>„ Z"dJd?„Z#d@„ Z$dJdA„Z%edB„ «       Z&edC„ «       Z'dJdD„Z(dMdE„Z)dJdF„Z*dG„ Z+dH„ Z,e-fdI„Z.ˆ xZ/S )NÚLibevdevaÒ  
    This class provides a wrapper around the libevdev C library.

    The API is modelled closely after the C API. API documentation in this
    document only lists the specific behavior of the Phython API. For
    information on the behavior of libevdev itself, see

    https://www.freedesktop.org/software/libevdev/doc/latest/

    Properties in this class are read-write unless specified otherwise.

    .. warning::

        Do not use this class directly
    c                  ó0   — t        j                  dd¬«      S ©Nzlibevdev.so.2T)Ú	use_errno©ÚctypesÚCDLLr   r   r   r2   zLibevdev._cdlly   ó   € ä�{‰{˜?°dÔ;Ð;r   Úlibevdev_event_type_get_name©r-   r.   Úlibevdev_event_type_from_nameÚlibevdev_event_code_get_nameÚlibevdev_event_code_from_nameÚlibevdev_property_get_nameÚlibevdev_property_from_nameÚlibevdev_event_type_get_maxÚlibevdev_newr   Úlibevdev_freeNÚlibevdev_get_nameÚlibevdev_set_nameÚlibevdev_get_physÚlibevdev_set_physÚlibevdev_get_uniqÚlibevdev_set_uniqÚlibevdev_get_driver_versionÚlibevdev_set_clock_idÚlibevdev_get_id_bustypeÚlibevdev_get_id_vendorÚlibevdev_get_id_productÚlibevdev_get_id_versionÚlibevdev_set_id_bustypeÚlibevdev_set_id_vendorÚlibevdev_set_id_productÚlibevdev_set_id_versionÚlibevdev_set_fdÚlibevdev_change_fdÚlibevdev_get_fdÚlibevdev_grabÚlibevdev_get_abs_infoÚlibevdev_kernel_set_abs_infoÚlibevdev_has_propertyÚlibevdev_has_event_typeÚlibevdev_has_event_code)Úlibevdev_set_event_valueÚlibevdev_get_event_valueÚlibevdev_enable_event_typeÚlibevdev_enable_event_codeÚlibevdev_disable_event_typeÚlibevdev_disable_event_codeÚlibevdev_enable_propertyÚlibevdev_next_eventÚlibevdev_get_num_slotsÚlibevdev_get_current_slotÚlibevdev_get_slot_valueÚlibevdev_set_slot_valueÚlibevdev_has_event_pendingc                 óv   •— t         t        | �  «        | j                  «       | _        d| _        |�|| _        yy)a>  
        :param fd: A file-like object

        Create a new libevdev instance. If a file is given this call is
        equivalent to ``libevdev_new_from_fd()``, otherwise it is equivalent
        to ``libevdev_new()``::

                fd = open("/dev/input/event0", "rb")
                l = libevdev.Libevdev(fd)
                # l now represents the device on event0

                l2 = libevdev.Libevdev()
                l2.name = "test device"
                l2.enable("EV_REL", "REL_X")
                # l2 is an unbound device with the REL_X bit set

        N)r'   rG   r(   Ú_newÚ_ctxÚ_fileÚfd)r*   rƒ   r+   s     €r   r(   zLibevdev.__init__j  s7   ø€ ô$ 	Œh˜Ñ&Ô(Ø—I‘I“KˆŒ	ØˆŒ
Øˆ>ØˆD�Gð r   c                 óT   — t        | d«      r| j                  | j                  «       y y )Nr�   )ÚhasattrÚ_freer�   ©r*   s    r   Ú__del__zLibevdev.__del__‚  s!   € Ü�4˜Ô Ø�J‰J�t—y‘yÕ!ð !r   c                 óV   — | j                  | j                  «      j                  d«      S )zB
        :return: A string with the device's kernel name.
        ú	iso8859-1)Ú	_get_namer�   Údecoder‡   s    r   r0   zLibevdev.name†  s"   € ð
 �~‰~˜dŸi™iÓ(×/Ñ/°Ó<Ð<r   c                 ó`   — |€d}| j                  | j                  |j                  d«      «      S ©NÚ rŠ   )Ú	_set_namer�   Úencode)r*   r0   s     r   r0   zLibevdev.name�  s*   € àˆ<ØˆDØ�~‰~˜dŸi™i¨¯©°[Ó)AÓBÐBr   c                 ó`   — | j                  | j                  «      }|sy|j                  d«      S )zJ
        :return: A string with the device's kernel phys or None.
        NrŠ   )Ú	_get_physr�   rŒ   ©r*   Úphyss     r   r•   zLibevdev.phys“  ó+   € ð
 �~‰~˜dŸi™iÓ(ˆÙØØ�{‰{˜;Ó'Ð'r   c                 ó`   — |€d}| j                  | j                  |j                  d«      «      S rŽ   )Ú	_set_physr�   r‘   r”   s     r   r•   zLibevdev.phys�  ó,   € ð ˆ<ØˆDØ�~‰~˜dŸi™i¨¯©°[Ó)AÓBÐBr   c                 ó`   — | j                  | j                  «      }|sy|j                  d«      S )zJ
        :return: A string with the device's kernel uniq or None.
        NrŠ   )Ú	_get_uniqr�   rŒ   ©r*   Úuniqs     r   r�   zLibevdev.uniq¤  r–   r   c                 ó`   — |€d}| j                  | j                  |j                  d«      «      S rŽ   )Ú	_set_uniqr�   r‘   rœ   s     r   r�   zLibevdev.uniq®  r™   r   c                 ó8   — | j                  | j                  «      S )z"
        :note: Read-only
        )Ú_get_driver_versionr�   r‡   s    r   Údriver_versionzLibevdev.driver_versionµ  s   € ð
 ×'Ñ'¨¯	©	Ó2Ð2r   c                 óè   — | j                  | j                  «      }| j                  | j                  «      }| j                  | j                  «      }| j	                  | j                  «      }||||dœS )a+  
        :return: A dict with the keys 'bustype', 'vendor', 'product', 'version'.

        When used as a setter, only existing keys are applied to the
        device. For example, to update the product ID only::

                ctx = Libevdev()
                id["property"] = 1234
                ctx.id = id

        This is a combined version of the libevdev calls
        ``libevdev_get_id_busytype()``, ``libevdev_get_id_vendor()``,
        ``libevdev_get_id_product()``, ``libevdev_get_id_version()`` and the
        respective setters.

        )ÚbustypeÚvendorÚproductÚversion)Ú_get_id_bustyper�   Ú_get_id_vendorÚ_get_id_productÚ_get_id_version)r*   ÚbusÚvdrÚproÚvers        r   ÚidzLibevdev.id¼  sj   € ð$ ×"Ñ" 4§9¡9Ó-ˆØ×!Ñ! $§)¡)Ó,ˆØ×"Ñ" 4§9¡9Ó-ˆØ×"Ñ" 4§9¡9Ó-ˆØØØØñ ð 	 r   c                 ó  — d|v r| j                  | j                  |d   «       d|v r| j                  | j                  |d   «       d|v r| j                  | j                  |d   «       d|v r | j	                  | j                  |d   «       y y )Nr¤   r¥   r¦   r§   )Ú_set_id_bustyper�   Ú_set_id_vendorÚ_set_id_productÚ_set_id_version)r*   Úvalss     r   r°   zLibevdev.id×  s‡   € à˜ÑØ× Ñ  §¡¨D°©OÔ<Ø�tÑØ×Ñ §	¡	¨4°©>Ô:Ø˜ÑØ× Ñ  §¡¨D°©OÔ<Ø˜ÑØ× Ñ  §¡¨D°©OÕ<ð r   c                 ó:   — | j                  | j                  |«      S )zr
        :param clock: time.CLOCK_MONOTONIC
        :return: a negative errno on failure or 0 on success.
        )Ú_set_clock_idr�   )r*   Úclocks     r   Úset_clock_idzLibevdev.set_clock_idâ  s   € ð
 ×!Ñ! $§)¡)¨UÓ3Ð3r   c                 ó   — | j                   S )aO  
        :return: The file-like object used during constructor or in the most
                 recent assignment to self.fd.

        When assigned the first time and no file has been passed to the
        constructor, the assignment is equivalent to ``libevdev_set_fd()``.
        Subsequently, any assignments are equivalent to
        ``libevdev_change_fd``::

                fd = open("/dev/input/event0", "rb")
                l = libevdev.Libevdev(fd)
                assert(l.fd == fd)

                fd2 = open("/dev/input/event0", "rb")
                l.fd = fd2
                assert(l.fd == fd2)

                l = libevdev.Libevdev()
                l.fd = fd
                assert(l.fd == fd)
                l.fd = fd2
                assert(l.fd == fd2)

        :note: libevdev uses the ``fileno()`` of the object.
        )r‚   r‡   s    r   rƒ   zLibevdev.fdé  s   € ð6 �z‰zÐr   c                 ó–  — 	 |j                  «       }| j                  €| j                  | j                  |«      }n| j                  | j                  |«      }|dk7  r!t        | t        j                  | «      «      ‚| j                  | j                  «      |k7  rt        d«       || _        y # t        $ r t        j                  ‚w xY w)Nr   zFIXME: fileno() != get_fd())ÚfilenoÚAttributeErrorr/   ÚInvalidFileErrorr‚   Ú_set_fdr�   Ú
_change_fdÚOSErrorÚosÚstrerrorÚ_get_fdÚprint)r*   Úfileobjrƒ   Úrs       r   rƒ   zLibevdev.fd  s«   € ð	,Ø—‘Ó!ˆBð �:‰:ÐØ—‘˜TŸY™Y¨Ó+‰Aà—‘ §	¡	¨2Ó.ˆAà�Š6Ü˜1˜"œbŸk™k¨1¨"›oÓ.Ð.ð �<‰<˜Ÿ	™	Ó" bÒ(ÜÐ/Ô0àˆ�
øô ò 	,Ü×+Ñ+Ð+ð	,ús   ‚B. Â.Cc                 ó–   — |rd}nd}| j                  | j                  |«      }|dk7  r!t        | t        j                  | «      «      ‚y)z€
        :param enable_grab: True to grab, False to ungrab
        :return: 0 on success or a negative errno on failure
        é   r   r   N)Ú_grabr�   rÂ   rÃ   rÄ   )r*   Úenable_grabÚmoderÈ   s       r   ÚgrabzLibevdev.grab  sJ   € ñ Ø‰DàˆDØ�J‰J�t—y‘y $Ó'ˆØ�Š6Ü˜1˜"œbŸk™k¨1¨"›oÓ.Ð.ð r   c                 ój  — t        |t        «      s-|j                  d«      s
t        «       ‚| j	                  d|«      }| j                  | j                  |«      }|sy|�Õd|v r|d   |j                  _        d|v r|d   |j                  _	        d|v r|d   |j                  _
        d|v r|d   |j                  _        d|v r|d   |j                  _        d	|v r|d	   |j                  _        |rC| j                  | j                  ||«      }|d
k7  r!t        | t!        j"                  | «      «      ‚|j                  j                  |j                  j                  |j                  j                  |j                  j                  |j                  j                  |j                  j                  dœS )aò  
        :param code: the ABS_<*> code as integer or as string
        :param new_values: a dict with the same keys as the return values.
        :param kernel: If True, assigning new values corresponds to ``libevdev_kernel_set_abs_info``
        :return: a dictionary with the keys "value", "min", "max",
                 "resolution", "fuzz", "flat"; ``None`` if the code does not exist on
                 this device

        :note: The returned value is a copy of the value returned by
               libevdev. Changing a value in the dictionary does not change the
               matching property. To change the device, reassign the
               dictionary to the absinfo code.
               This is different to the libevdev behavior.
        ÚABS_ÚEV_ABSNr   r   r   r   r   r   r   )r   r   r   r   r   r   )Ú
isinstanceÚintÚ
startswithÚ
ValueErrorÚevent_to_valueÚ_get_abs_infor�   Úcontentsr   r   r   r   r   r   Ú_kernel_set_abs_inforÂ   rÃ   rÄ   )r*   r"   Ú
new_valuesÚkernelÚabsinfoÚrcs         r   rÜ   zLibevdev.absinfo)  s˜  € ô ˜$¤Ô$Ø—?‘? 6Ô*Ü “lÐ"Ø×&Ñ& x°Ó6ˆDØ×$Ñ$ T§Y¡Y°Ó5ˆáØàÐ!Ø˜JÑ&Ø+5°iÑ+@�× Ñ Ô(Ø˜JÑ&Ø+5°iÑ+@�× Ñ Ô(Ø˜*Ñ$Ø)3°GÑ)<�× Ñ Ô&Ø˜Ñ#Ø(2°6Ñ(:�× Ñ Ô%Ø˜Ñ#Ø(2°6Ñ(:�× Ñ Ô%Ø˜zÑ)Ø.8¸Ñ.F�× Ñ Ô+áØ×.Ñ.¨t¯y©y¸$ÀÓH�Ø˜’7Ü! 2 #¤r§{¡{°B°3Ó'7Ó8Ð8à ×)Ñ)×/Ñ/Ø"×+Ñ+×3Ñ3Ø"×+Ñ+×3Ñ3Ø×(Ñ(×-Ñ-Ø×(Ñ(×-Ñ-Ø%×.Ñ.×9Ñ9ñ;ð 	;r   c                 óL   — | j                  |«      }|sy|j                  d«      S )zÅ
        :param prop: the numerical property value
        :return: A string with the property name or ``None``

        This function is the equivalent to ``libevdev_property_get_name()``
        NrŠ   )Ú_property_get_namerŒ   )r:   Úpropr0   s      r   Úproperty_to_namezLibevdev.property_to_name[  s)   € ð ×%Ñ% dÓ+ˆÙØØ�{‰{˜;Ó'Ð'r   c                 óR   — | j                  |j                  d«      «      }|dk(  ry|S )zÂ
        :param prop: the property name as string
        :return: The numerical property value or ``None``

        This function is the equivalent to ``libevdev_property_from_name()``
        rŠ   éÿÿÿÿN)Ú_property_from_namer‘   )r:   rà   Úvs      r   Úproperty_to_valuezLibevdev.property_to_valueh  s,   € ð ×#Ñ# D§K¡K°Ó$<Ó=ˆØ�Š7ØØˆr   c                 óx   — t        |t        «      s| j                  |«      }| j                  |«      }|dkD  r|S dS )z˜
        :param type: the EV_<*> event type
        :return: the maximum code for this type or ``None`` if the type is
                 invalid
        rã   N)rÒ   rÓ   rÖ   Ú_event_type_get_max)r:   r!   Úms      r   Útype_maxzLibevdev.type_maxu  s?   € ô ˜$¤Ô$Ø×%Ñ% dÓ+ˆDØ×#Ñ# DÓ)ˆØ˜’FˆqÐ$ Ð$r   c                 óv   — |�| j                  ||«      }n| j                  |«      }|sy|j                  d«      S )am  
        :param event_type: the numerical event type value
        :param event_code: optional, the numerical event code value
        :return: the event code name if a code is given otherwise the event
                 type name.

        This function is the equivalent to ``libevdev_event_code_get_name()``
        and ``libevdev_event_type_get_name()``
        NrŠ   )Ú_event_code_get_nameÚ_event_type_get_namerŒ   )r:   Ú
event_typeÚ
event_coder0   s       r   Úevent_to_namezLibevdev.event_to_name�  sA   € ð Ð!Ø×+Ñ+¨J¸
ÓC‰Dà×+Ñ+¨JÓ7ˆDÙØØ�{‰{˜;Ó'Ð'r   c                 óÜ   — |�Ct        |t        «      s| j                  |«      }| j                  ||j	                  d«      «      }n | j                  |j	                  d«      «      }|dk(  ry|S )ae  
        :param event_type: the event type as string
        :param event_code: optional, the event code as string
        :return: the event code value if a code is given otherwise the event
                 type value.

        This function is the equivalent to ``libevdev_event_code_from_name()``
        and ``libevdev_event_type_from_name()``
        NrŠ   rã   )rÒ   rÓ   rÖ   Ú_event_code_from_namer‘   Ú_event_type_from_name)r:   rî   rï   rå   s       r   rÖ   zLibevdev.event_to_value”  sk   € ð Ð!Ü˜j¬#Ô.Ø ×/Ñ/°
Ó;�
Ø×)Ñ)¨*°j×6GÑ6GÈÓ6TÓU‰Aà×)Ñ)¨*×*;Ñ*;¸KÓ*HÓIˆAØ�Š7ØØˆr   c                 ó’   — t        |t        «      s| j                  |«      }| j                  | j                  |«      }t        |«      S )zŒ
        :param prop: a property, either as integer or string
        :return: True if the device has the property, False otherwise
        )rÒ   rÓ   ræ   Ú_has_propertyr�   Úbool)r*   rà   rÈ   s      r   Úhas_propertyzLibevdev.has_property©  s=   € ô
 ˜$¤Ô$Ø×)Ñ)¨$Ó/ˆDØ×Ñ˜tŸy™y¨$Ó/ˆÜ�A‹wˆr   c                 ó*  — t        |t        «      s| j                  |«      }|€'| j                  | j                  |«      }t        |«      S t        |t        «      s| j                  ||«      }| j                  | j                  ||«      }t        |«      S )a  
        :param event_type: the event type, either as integer or as string
        :param event_code: optional, the event code, either as integer or as
                           string
        :return: True if the device has the type and/or code, False otherwise
        )rÒ   rÓ   rÖ   Ú_has_event_typer�   Ú_has_event_coderö   )r*   rî   rï   rÈ   s       r   Ú	has_eventzLibevdev.has_event³  s„   € ô ˜*¤cÔ*Ø×,Ñ,¨ZÓ8ˆJàÐØ×$Ñ$ T§Y¡Y°
Ó;ˆAô
 �A‹wˆô ˜j¬#Ô.Ø!×0Ñ0°¸ZÓH�
Ø×$Ñ$ T§Y¡Y°
¸JÓGˆAÜ�A‹wˆr   c                 ó”   — t        |t        «      s| j                  |«      }|�"t        |t        «      s| j                  ||«      }||fS )z„
        Resolves a type+code tuple, either of which could be integer or
        string. Returns a (t, c) tuple in integers
        )rÒ   rÓ   rÖ   )r*   ÚtÚcs      r   Ú_codezLibevdev._codeÅ  sG   € ô
 ˜!œSÔ!Ø×#Ñ# AÓ&ˆAØˆ=¤¨A¬sÔ!3Ø×#Ñ# A qÓ)ˆAØ�1ˆvˆr   c                 óÐ   — | j                  ||«      \  }}| j                  ||«      sy|�| j                  | j                  |||«       | j	                  | j                  ||«      }|S )aH  
        :param event_type: the event type, either as integer or as string
        :param event_code: the event code, either as integer or as string
        :param new_value: optional, the value to set to
        :return: the current value of type + code, or ``None`` if it doesn't
                 exist on this device
        N)rÿ   rû   Ú_set_event_valuer�   Ú_get_event_value)r*   rî   rï   Ú	new_valuerý   rþ   rå   s          r   Úevent_valuezLibevdev.event_valueÐ  sd   € ð �z‰z˜* jÓ1‰ˆˆ1à�~‰~˜a Ô#ØàÐ Ø×!Ñ! $§)¡)¨Q°°9Ô=à×!Ñ! $§)¡)¨Q°Ó2ˆØˆr   c                 óJ   — | j                  | j                  «      }|dk\  r|S dS )zš
        :return: the number of slots on this device or ``None`` if this device
                 does not support slots

        :note: Read-only
        r   N)Ú_get_num_slotsr�   ©r*   Úss     r   Ú	num_slotszLibevdev.num_slotsã  s)   € ð ×Ñ §	¡	Ó*ˆØ˜’FˆqÐ$ Ð$r   c                 óJ   — | j                  | j                  «      }|dk\  r|S dS )z›
        :return: the current of slots on this device or ``None`` if this device
                 does not support slots

        :note: Read-only
        r   N)Ú_get_current_slotr�   r  s     r   Úcurrent_slotzLibevdev.current_slotî  s)   € ð ×"Ñ" 4§9¡9Ó-ˆØ˜’FˆqÐ$ Ð$r   c                 óª   — | j                  d|«      \  }}|�| j                  | j                  |||«       | j                  | j                  ||«      }|S )a>  
        :param slot: the numeric slot number
        :param event_code: the ABS_<*> event code, either as integer or string
        :param new_value: optional, the value to set this slot to
        :return: the current value of the slot's code, or ``None`` if it doesn't
                 exist on this device
        rÑ   )rÿ   Ú_set_slot_valuer�   Ú_get_slot_value)r*   Úslotrï   r  rý   rþ   rå   s          r   Ú
slot_valuezLibevdev.slot_valueù  sS   € ð �z‰z˜( JÓ/‰ˆˆ1àÐ Ø× Ñ  §¡¨D°!°YÔ?à× Ñ  §¡¨D°!Ó4ˆØˆr   c                 ó  — | j                  ||«      \  }}|€| j                  | j                  |«       y|dk(  r†t        |j	                  dd«      |j	                  dd«      |j	                  dd«      |j	                  dd«      |j	                  dd«      |j	                  d	d«      «      }t        j                  |«      }n#|d
k(  rt        j                  t        |«      «      }| j                  | j                  |||«       y)aò  
        :param event_type: the event type, either as integer or as string
        :param event_code: optional, the event code, either as integer or as string
        :param data: if event_code is not ``None``, data points to the
                     code-specific information.

        If event_type is EV_ABS, then data must be a dictionary as returned
        from absinfo. Any keys missing are replaced with 0, i.e. the
        following example is valid and results in a fuzz/flat/resolution of
        zero::

                ctx = Libevdev()
                abs = { "minimum" : 0,
                        "maximum" : 100 }
                ctx.enable("EV_ABS", "ABS_X", data)

        If event_type is EV_REP, then data must be an integer.
        NrÊ   r   r   r   r   r   r   r   é   )	rÿ   Ú_enable_event_typer�   r   r8   rL   Úpointerr   Ú_enable_event_code)r*   rî   rï   Údatarý   rþ   s         r   ÚenablezLibevdev.enable	  s×   € ð& �z‰z˜* jÓ1‰ˆˆ1Øˆ9Ø×#Ñ# D§I¡I¨qÕ1à�DŠyÜ$ T§X¡X¨g°qÓ%9Ø%)§X¡X¨i¸Ó%;Ø%)§X¡X¨i¸Ó%;Ø%)§X¡X¨f°aÓ%8Ø%)§X¡X¨f°aÓ%8Ø%)§X¡X¨l¸AÓ%>ó@�ô —~‘~ dÓ+‘Ø�d’Ü—~‘~¤e¨D£kÓ2�Ø×#Ñ# D§I¡I¨q°!°TÕ:r   c                 ó¦   — | j                  ||«      \  }}|€| j                  | j                  |«       y| j                  | j                  ||«       y)z§
        :param event_type: the event type, either as integer or as string
        :param event_code: optional, the event code, either as integer or as string
        N)rÿ   Ú_disable_event_typer�   Ú_disable_event_code)r*   rî   rï   rý   rþ   s        r   ÚdisablezLibevdev.disable,  sG   € ð
 �z‰z˜* jÓ1‰ˆˆ1Øˆ9Ø×$Ñ$ T§Y¡Y°Õ2à×$Ñ$ T§Y¡Y°°1Õ5r   c                 ó~   — t        |t        «      s| j                  |«      }| j                  | j                  |«       y)z@
        :param prop: the property as integer or string
        N)rÒ   rÓ   ræ   Ú_enable_propertyr�   )r*   rà   s     r   Úenable_propertyzLibevdev.enable_property7  s2   € ô ˜$¤Ô$Ø×)Ñ)¨$Ó/ˆDà×Ñ˜dŸi™i¨Õ.r   c                 ót   — | j                  d|«      \  }}|rdnd}| j                  | j                  ||«       y)zi
        :param led: the LED_<*> name
        :on: True to turn the LED on, False to turn it off
        ÚEV_LEDrÊ   r   N)rÿ   Ú_set_led_valuer�   )r*   ÚledÚonrý   rþ   Úwhichs         r   Úset_ledzLibevdev.set_led@  s7   € ð
 �z‰z˜( CÓ(‰ˆˆ1Ù‘˜QˆØ×Ñ˜DŸI™I q¨%Õ0r   c                 ó¤   — t        «       }| j                  | j                  |t        j                  |«      «      }|t
        j                   k(  ry|S )a  
        :param flags: a set of libevdev read flags. May be omitted to use
                      the normal mode.
        :return: the next event or ``None`` if no event is available

        Event processing should look like this::

            fd = open("/dev/input/event0", "rb")
            ctx = libevdev.Libevdev(fd)
            ev = ctx.next_event()
            if ev is None:
                print("no event available right now")
            elif ev.matches("EV_SYN", "SYN_DROPPED"):
                sync_ev = ctx.next_event(libevdev.READ_FLAG_SYNC)
                while ev is not None:
                    print("First event in sync sequence")
                    sync_ev = ctx.next_event(libevdev.READ_FLAG_SYNC)
                print("sync complete")

        N)r   Ú_next_eventr�   rL   ÚbyrefÚerrnoÚEAGAIN)r*   ÚflagsÚevrÝ   s       r   Ú
next_eventzLibevdev.next_eventI  sB   € ô* ‹]ˆØ×Ñ˜dŸi™i¨´·±¸RÓ0@ÓAˆØ”%—,‘,�ÒØàˆ	r   r&   )T)NF)NN)0r   r   r   rA   rC   r2   r   r   r   r   rL   ÚPOINTERr   r   r3   r(   rˆ   Úpropertyr0   Úsetterr•   r�   r¢   r°   rº   rƒ   rÎ   rÜ   rB   rá   ræ   rê   rð   rÖ   r÷   rû   rÿ   r  r	  r  r  r  r  r  r&  ÚREAD_FLAG_NORMALr.  rD   rE   s   @r   rG   rG   h   sµ  ø„ ñð  ñ<ó ð<ðkà&Ø˜	Øñ)
ðkð 	(Ø!˜Øñ*
ðkð 	'Ø Ð)Øñ)
ðkð" 	(Ø Ð+Øñ*
ð#kð, 	%Ø˜	Øñ'
ð-kð6 	&Ø!˜Øñ(
ð7kð@ 	&Ø˜	Øñ(
ðAkðJ 	ØØñ
ðKkðT 	Ø!˜Øñ
ðUkðd 	Ø!˜Øñ
ðekðn 	Ø! 8Ð,Øñ
ðokðx 	Ø!˜Øñ
ðykðB 	Ø! 8Ð,Øñ
ðCkðL 	Ø!˜Øñ
ðMkðV 	Ø! 8Ð,Øñ
ðWkð` 	&Ø!˜Øñ(
ðakðj 	 Ø! 5Ð)Øñ"
ñkkðz 	"Ø!˜Øñ$
ð{kðD 	!Ø!˜Øñ#
ðEkðN 	"Ø!˜Øñ$
ðOkðX 	"Ø!˜Øñ$
ðYkðb 	"Ø! 5Ð)Øñ$
ðckðl 	!Ø! 5Ð)Øñ#
ðmkðv 	"Ø! 5Ð)Øñ$
ðwkð@ 	"Ø! 5Ð)Øñ$
ðAkðJ 	Ø! 5Ð)Øñ
ðKkðT 	Ø! 5Ð)Øñ
ðUkð^ 	Ø!˜Øñ
ð_kðh 	Ø! 5Ð)Øñ
ðikðr 	 Ø! 5Ð)Ø%�v—~‘~ mÓ4ñ"
ðskðB 	'Ø! 5¨.¨&¯.©.¸Ó*GÐHØñ)
ðCkðP 	 Ø! 5Ð)Øñ"
ðQkðX 	"Ø! 5Ð)Øñ$
ðYkð` 	"Ø! 5¨%Ð0Øñ$
ñakðp " 5¨%°Ð7Øñ%
ð
 " 5¨%Ð0Øñ%
ð
 " 5Ð)Øñ'
ð
 " 5¨%°Ð:Øñ'
ð
 " 5Ð)Øñ(
ð
 " 5¨%Ð0Øñ(
ð
 " 5Ð)Øñ%
ð
 " 6¨>¨6¯>©>¸+Ó+FÐGØñ 
ð
 "˜Øñ#
ð
 "˜Øñ&
ð
 " 6¨6Ð2Øñ$
ð
 " 6¨6°5Ð9Øñ$
ð
 "˜Øñ'
òOk€OõZò0"ð ñ=ó ð=ð 
‡[�[ñCó ðCð
 ñ(ó ð(ð 
‡[�[ñCó ðCð ñ(ó ð(ð 
‡[�[ñCó ðCð ñ3ó ð3ð ñ ó ð ð4 ‡Y�Yñ=ó ð=ò4ð ñó ðð8 ‡Y�Yñó ðó(/ó0;ðd ñ
(ó ð
(ð ñ
ó ð
ð ñ	%ó ð	%ð ò(ó ð(ð$ òó ðò(óò$	óð& ñ%ó ð%ð ñ%ó ð%óó !;óF	6ò/ò1ð  0÷ r   rG   c                   ó   — e Zd Zy)Ú_UinputDeviceN)r   r   r   r   r   r   r4  r4  f  s   „ Ør   r4  c                   óò   ‡ — e Zd ZdZed„ «       Zee ej                   ej                  e
«      «      fedœefddœefedœefedœeeeefedœdœZdˆ fd„	Zd„ Zed„ «       Zd	„ Zed
„ «       Zed„ «       Zˆ xZS )ÚUinputDevicez
    This class provides a wrapper around the libevdev C library

    .. warning::

        Do not use this class directly
    c                  ó0   — t        j                  dd¬«      S rI   rK   r   r   r   r2   zUinputDevice._cdlls  rN   r   rP   N)Ú"libevdev_uinput_create_from_deviceÚlibevdev_uinput_destroyÚlibevdev_uinput_get_devnodeÚlibevdev_uinput_get_syspathÚlibevdev_uinput_write_eventc                 óh  •— t         t        | �  «        || _        |€d}n|j	                  «       } t        j                  t        «      «       | _        | j                  |j                  |t        j                  | j                  «      «      }|dk7  r!t        | t        j                  | «      «      ‚y)a�  
        Create a new uinput device based on the source libevdev device. The
        uinput device will mirror all capabilities from the source device.

        :param source: A libevdev device with all capabilities set.
        :param fileobj: A file-like object to the /dev/uinput node. If None,
        libevdev will open the device in managed mode. See the libevdev
        documentation for details.
        Néþÿÿÿr   )r'   r6  r(   Ú_fileobjr½   rL   r/  r4  Ú_uinput_deviceÚ_uinput_create_from_devicer�   r)  rÂ   rÃ   rÄ   )r*   ÚsourcerÇ   rƒ   rÝ   r+   s        €r   r(   zUinputDevice.__init__“  s’   ø€ ô 	Œl˜DÑ*Ô,àˆŒØˆ?Ø‰Bà—‘Ó!ˆBà;œfŸn™n¬]Ó;Ó=ˆÔØ×,Ñ,¨V¯[©[¸"¼f¿l¹lÈ4×K^ÑK^Ó>_Ó`ˆØ�Š7Ü˜2˜#œrŸ{™{¨B¨3Ó/Ó0Ð0ð r   c                 óT   — | j                   �| j                  | j                   «       y y r&   )r@  Ú_uinput_destroyr‡   s    r   rˆ   zUinputDevice.__del__ª  s'   € Ø×ÑÐ*Ø× Ñ  ×!4Ñ!4Õ5ð +r   c                 ó   — | j                   S )zH
        :return: the file-like object used in the constructor.
        )rÇ   r‡   s    r   rƒ   zUinputDevice.fd®  s   € ð
 �|‰|Ðr   c                 ó@   — | j                  | j                  |||«       y r&   )Ú_uinput_write_eventr@  )r*   r!   r"   r   s       r   Úwrite_eventzUinputDevice.write_eventµ  s   € Ø× Ñ  ×!4Ñ!4°d¸DÀ%ÕHr   c                 óZ   — | j                  | j                  «      }|j                  d«      S ©zH
        Return a string with the /dev/input/eventX device node
        rŠ   )Ú_uinput_get_devnoder@  rŒ   )r*   Údevnodes     r   rL  zUinputDevice.devnode¸  ó)   € ð
 ×*Ñ*¨4×+>Ñ+>Ó?ˆØ�~‰~˜kÓ*Ð*r   c                 óZ   — | j                  | j                  «      }|j                  d«      S rJ  )Ú_uinput_get_syspathr@  rŒ   )r*   Úsyspaths     r   rP  zUinputDevice.syspathÀ  rM  r   r&   )r   r   r   rA   rC   r2   r   r   rL   r/  r4  r   r   r3   r(   rˆ   r0  rƒ   rH  rL  rP  rD   rE   s   @r   r6  r6  j  sÜ   ø„ ñð ñ<ó ð<ð " 5¨.¨&¯.©.¸¸¿¹ÈÓ9VÓ*WÐXØñ/
ð "˜Øñ$
ð "˜Øñ(
ð "˜Øñ(
ð " 6¨6°5Ð9Øñ(
ñ-€Oõ81ò.6ð ñó ðòIð ñ+ó ð+ð ñ+ó ô+r   r6  )r/   rÃ   rL   r*  r   r   r   r   r   r   r	   ÚREAD_FLAG_SYNCr2  ÚREAD_FLAG_FORCE_SYNCÚREAD_FLAG_BLOCKINGÚ	Structurer   r   Úobjectr$   rG   r4  r6  r   r   r   ú<module>rV     sŸ   ðó. ã 	Û Û Ý Ý Ý Ý Ý Ý Ý à€ØÐ ØÐ ØÐ ô)�F×$Ñ$ô )ô$�&×"Ñ"ô $ô*"�fô *"ôZ{ˆô {ô|	�F×$Ñ$ô 	ô\+�?õ \+r   