%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /lib/python3/dist-packages/libevdev/__pycache__/
Upload File :
Create Path :
Current File : //lib/python3/dist-packages/libevdev/__pycache__/device.cpython-312.pyc

�

�o�ZLm����ddlZddlZddlZddlmZmZddlmZmZmZm	Z	ddl
mZddlm
Z
Gd�de�ZGd	�d
e�ZGd�de�ZGd
�de�ZGd�de�ZGd�de�Zy)�N�)�Libevdev�UinputDevice)�READ_FLAG_SYNC�READ_FLAG_NORMAL�READ_FLAG_FORCE_SYNC�READ_FLAG_BLOCKING)�
InputEvent)�
InputPropertyc��eZdZdZy)�InvalidFileErrorzx
    A file provided is not a valid file descriptor for libevdev or this
    device must not have a file descriptor
    N��__name__�
__module__�__qualname__�__doc__���1/usr/lib/python3/dist-packages/libevdev/device.pyr
r
!s���	rr
c��eZdZdZdd�Zd�Zy)�InvalidArgumentExceptionz�
    A function was called with an invalid argument. This indicates a bug in
    the calling program.

    .. attribute:: message

        A human-readable error message
    Nc��||_y�N��message)�self�msgs  r�__init__z!InvalidArgumentException.__init__2s	����rc��|jSrr�rs r�__repr__z!InvalidArgumentException.__repr__5s���|�|�rr)rrrrrr!rrrrr)s����rrc��eZdZdZy)�DeviceGrabErrorz�
    A device grab failed to be issued. A caller must not assume that it has
    exclusive access to the events on the device.
    Nrrrrr#r#9s��rr#c��eZdZdZy)�EventsDroppedExceptiona@
    Notification that the device has dropped events, raised in response to a
    EV_SYN SYN_DROPPED event.

    This exception is raised AFTER the EV_SYN, SYN_DROPPED event has been
    passed on. If SYN_DROPPED events are processed manually, then this
    exception can be ignored.

    Once received (or in response to a SYN_DROPPED event) a caller should
    call device.sync() and process the events accordingly (if any).

    Example::

            fd = open("/dev/input/event0", "rb")
            ctx = libevdev.Device(fd)

            while True:
                try:
                    for e in ctx.events():
                        print(e):
                except EventsDroppedException:
                    print('State lost, re-synching:')
                    for e in ctx.sync():
                        print(e)
    Nrrrrr%r%@s���2	rr%c�(�eZdZdZ		dd�Zd�Zd�Zy)�InputAbsInfoa7
    A class representing the struct input_absinfo for a given EV_ABS code.

    Any of the attributes may be set to None, those that are None are simply
    ignored by libevdev.

    .. attribute:: minimum

        the minimum value of this axis

    :property minimum: the minimum value for this axis
    :property maximum: the maximum value for this axis
    :property fuzz: the fuzz value for this axis
    :property flat: the flat value for this axis
    :property resolution: the resolution for this axis
    :property value: the current value of this axis
    Nc�X�||_||_||_||_||_||_yr)�minimum�maximum�fuzz�flat�
resolution�value)rr)r*r+r,r-r.s       rrzInputAbsInfo.__init__os,����������	���	�$�����
rc��dj|j|j|j|j|j
|j�S)Nz4min:{} max:{} fuzz:{} flat:{} resolution:{} value:{})�formatr)r*r+r,r-r.r s rr!zInputAbsInfo.__repr__xs;��E�L�L��|�|�T�\�\�4�9�9�d�i�i�����
�
�,�	,rc�B�|j|jk(xr�|j|jk(xrj|j|jk(xrO|j|jk(xr4|j|jk(xr|j
|j
k(Sr)r)r*r.r-r+r,)r�others  r�__eq__zInputAbsInfo.__eq__}s�������
�
�-�(�����
�
�-�(��
�
�e�k�k�)�(����5�#3�#3�3�(��	�	�U�Z�Z�'�	(�
�	�	�U�Z�Z�'�	)r)NNNNNN)rrrrrr!r3rrrr'r']s ���"DH�(,��,�
)rr'c�@�eZdZdZGd�d�ZGd�d�ZGd�d�Zd)d	�Zed
��Z	e	jd��Z	ed��Zejd
��Zed��Zejd��Zed��Z
ed��Zejd��Zed��Zejd��Zed��Zed��Zd�Zd�Zed��Zed��Zed��Zd�Zd�Zd*d�Zed��Zed ��Zd)d!�Zd"�Zed#��Zed$��Zd)d%�Z d&�Z!d'�Z"d(�Z#y)+�Devicea�
    This class represents an evdev device backed by libevdev. The device may
    represent a real device in the system or a constructed device where the
    caller supplies all properties of the device.

    If a file is given, the device initializes from that file, otherwise the
    device is uninitialized and needs to be set up by the caller::

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

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

    Note that if a device is constructed manually, the fd of the device
    is always None.

    .. note:: The device is always set to CLOCK_MONOTONIC.

    :param fd: fd pointing to a ``/dev/input/eventX`` event node
    :type fd: A file-like object

    c��eZdZd�Zd�Zy)�Device._EventValueSetc��||_yr��_device�r�
parent_devices  rrzDevice._EventValueSet.__init__��	��(�D�Lrc�@�|jtjk(r>|tjjk\r!|jj
�t
d��|jjj|jj|j�S)NzCannot fetch value for MT axes)
�type�libevdev�EV_ABS�ABS_MT_SLOTr:�	num_slotsr�	_libevdev�event_valuer.�r�codes  r�__getitem__z!Device._EventValueSet.__getitem__�si���	�	�X�_�_�,��x���2�2�2��|�|�%�%�1�.�/O�P�P��<�<�)�)�5�5�d�i�i�o�o�t�z�z�R�RrN)rrrrrHrrr�_EventValueSetr7�s
��	)�	SrrIc��eZdZd�Zd�Zd�Zy)�Device._InputAbsInfoSetc��||_yrr9r;s  rrz Device._InputAbsInfoSet.__init__�r=rc	���|jtjk(sJ�|jjj|j�}|�|St|d|d|d|d|d|d�S)Nr)r*r+r,r-r.)r?r@rAr:rD�absinfor.r')rrG�rs   rrHz#Device._InputAbsInfoSet.__getitem__�ss���9�9����/�/�/����&�&�.�.�t�z�z�:�A��y�����)��a�	�l� !�&�	�1�V�9� !�,���7��=�
=rc�6�|jtjk(sJ�|jj	|�std��i}|j�|j|d<|j�|j|d<|j�|j|d<|j�|j|d<|j�|j|d<|j�|j|d<|jjj|j|�y)NzDevice does not have event coder)r*r+r,r-r.)r?r@rAr:�hasrr)r*r+r,r-r.rDrN)rrGrN�datas    r�__setitem__z#Device._InputAbsInfoSet.__setitem__�s����9�9����/�/�/��<�<�#�#�D�)�.�/P�Q�Q��D����*�")�/�/��Y�����*�")�/�/��Y���|�|�'�&�|�|��V���|�|�'�&�|�|��V���!�!�-�%,�%7�%7��\�"��}�}�(� '�
�
��W�
��L�L�"�"�*�*�4�:�:�t�<rN�rrrrrHrSrrr�_InputAbsInfoSetrK�s��	)�		=�	=rrUc��eZdZd�Zd�Zd�Zy)�Device._SlotValuec� �||_||_yr)r:�_slot)r�device�slots   rrzDevice._SlotValue.__init__�s��!�D�L��D�Jrc�6�|jtjus|tjjkrt	d��|j
j
|�sy|j
jj|j|j�S)N�)Event code must be one of EV_ABS.ABS_MT_*�r?r@rArBrr:rQrD�
slot_valuerYr.rFs  rrHzDevice._SlotValue.__getitem__�sj���	�	����0��x���2�2�2�.�/Z�[�[��<�<�#�#�D�)���<�<�)�)�4�4�T�Z�Z����L�Lrc�P�|jtjus|tjjkrt	d��|j
j
|�st	d��|j
jj|j|j|��y)Nr]zEvent code does not exist)�	new_valuer^)rrGr.s   rrSzDevice._SlotValue.__setitem__�sv���	�	����0��x���2�2�2�.�/Z�[�[��<�<�#�#�D�)�.�/J�K�K��L�L�"�"�-�-�d�j�j�$�*�*�PU�-�VrNrTrrr�
_SlotValuerW�s��	�	M�	WrrbNc�V�t|�|_d|_d|_tj|�|_tj|�|_|�+	|jjtj�yy#t$r|jjd�YywxYw)NFr)
rrD�_uinput�_is_grabbedr5rI�_valuesrU�	_absinfos�set_clock_id�time�CLOCK_MONOTONIC�AttributeError)r�fds  rrzDevice.__init__�s���!�"������� ����,�,�T�2����0�0��6���
�>�
/����+�+�D�,@�,@�A���"�
/����+�+�A�.�
/�s�)B�$B(�'B(c�.�|jjS)z+
        :returns: the device name
        �rD�namer s rrozDevice.name����
�~�~�"�"�"rc�&�||j_yrrn)rros  rrozDevice.name����"����rc�.�|jjS)z=
        :returns: the device's kernel phys or None.
        �rD�physr s rruzDevice.physrprc�&�||j_yrrt)rrus  rruzDevice.phys
rrrc�.�|jjS)z<
        :returns: the device's uniq string or None
        �rD�uniqr s rryzDevice.uniqrprc�&�||j_yrrx)rrys  rryzDevice.uniqrrrc�.�|jjS)z7
        :returns: the device's driver version
        )rD�driver_versionr s rr|zDevice.driver_versions��
�~�~�,�,�,rc�.�|jjS)aA
        :returns: 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 = Device()
                id["property"] = 1234
                ctx.id = id

        �rD�idr s rrz	Device.id s���~�~� � � rc�&�||j_yrr~)r�valss  rrz	Device.id/s�� ����rc�.�|jjS)a�
        This fd represents the file descriptor to this device, if any. If no
        fd was provided in the constructor, None is returned. If the device
        was used to create a uinput device, None is returned.

        The fd may only be changed if it was not initially None and then it
        overwrites the file object provided in the constructor (or a
        previous call to this function). The new file object becomes the
        object referencing this device, further events are polled from that
        file.

        .. warning::

            A device initialized without a file descriptor may not change
            its fd.

        Note that libevdev does not synchronize the device and relies on the
        caller to ensure that the new file object points to the same device
        as this context. If the underlying device changes, the behavior
        is undefined.

        :raises: InvalidFileError - the file is invalid or this device does
            not allow a file to be set

        )rDrlr s rrlz	Device.fd3s��6�~�~� � � rc�H�|jj�
t��||j_	|jjtj
�|jr|j�yy#t$r|jjd�Y�DwxYw)Nr)	rDrlr
rhrirjrkre�grab)r�fileobjs  rrlz	Device.fdPs����>�>���$�"�$�$�#�����	+��N�N�'�'��(<�(<�=�����I�I�K����	+��N�N�'�'��*�	+�s�)A:�:$B!� B!c���i}tjD]O}|j|�s�g}|jD]%}|j|�s�|j	|��'|||<�Q|S)a
        Returns a dict with all supported event types and event codes, in
        the form of::

            {
              libevdev.EV_ABS: [libevdev.EV_ABS.ABS_X, ...],
              libevdev.EV_KEY: [libevdev.EV_KEY.BTN_LEFT, ...],
            }
        )r@�typesrQ�codes�append)rr��tr��cs     r�evbitsz
Device.evbits\sm�������		�A��8�8�A�;���E��W�W�
 ���x�x��{�����Q��
 ��E�!�H�		��rc�l�tjD�cgc]}|j|�s�|��c}Scc}w)zB
        Returns a list of all supported input properties
        )r@�props�has_property)r�ps  r�
propertieszDevice.propertiesus)��
$�>�>�B�a�T�->�->�q�-A��B�B��Bs�1�1c�L�|jj|j�S)zp
        :param prop: a property
        :returns: True if the device has the property, False otherwise
        )rDr�r.)r�props  rr�zDevice.has_property|s��
�~�~�*�*�4�:�:�6�6rc���	|jj|jj|j�S#t$r(|jj|j�cYSwxYw)z�
        :param evcode: the event type or event code
        :type evcode: EventType or EventCode
        :returns: True if the device has the type and/or code, False otherwise
        )rD�	has_eventr?r.rk)r�evcodes  rrQz
Device.has�sT��	:��>�>�+�+�F�K�K�,=�,=�v�|�|�L�L���	:��>�>�+�+�F�L�L�9�9�	:�s�9<�.A-�,A-c�.�|jjS)z�
        :returns: the number of slots on this device or ``None`` if this device
                 does not support slots

        :note: Read-only
        )rDrCr s rrCzDevice.num_slots�s���~�~�'�'�'rc�.�|jjS)z�
        :returns: the current slot on this device or ``None`` if this device
                 does not support slots

        :note: Read-only
        )rD�current_slotr s rr�zDevice.current_slot�s���~�~�*�*�*rc��|jS)a
        Query the device's absinfo for the given event code. This attribute
        can both query and modify the :class:`InputAbsInfo` values of this
        device::

            >>> ai = d.absinfo[libevdev.EV_ABS.ABS_X]
            >>> print(f'Resolution is {ai.resolution}')
            Resolution is 33
            >>> ai = d.absinfo[libevdev.EV_ABS.ABS_Z]
            >>> print(ai)
            None

        The returned object is a dict-like object that only accepts event
        codes of type `EV_ABS` as keys. No other operation than key-based
        access is supported.

        When used as a setter, the provided :class:`InputAbsInfo` becomes
        the new absinfo of this axis::

            >>> ai = d.absinfo[libevdev.EV_ABS.ABS_X]
            >>> print(f'Resolution is {ai.resolution}')
            Resolution is 33
            >>> ai.resolution = 45
            >>> d.absinfo[libevdev.EV_ABS.ABS_X] = ai
            >>> ai = d.absinfo[libevdev.EV_ABS.ABS_X]
            >>> print(f'Resolution is now {ai.resolution}')
            Resolution is now 45

        When used as a setter, any attribute of :class:`InputAbsInfo` that
        is ``None`` is ignored::

            >>> ai = InputAbsInfo(resolution=72)
            >>> d.absinfo[libevdev.EV_ABS.ABS_X] = ai
            >>> ai = d.absinfo[libevdev.EV_ABS.ABS_X]
            >>> print(f'Resolution is now {ai.resolution}')
            Resolution is now 72

        .. warning::

            Setting the absinfo for a non-existing EV_ABS code is invalid.
            Use :func:`enable()` instead.

        :returns: an class:`InputAbsInfo` struct or None if the device does
                  not have the event code
        :raises: :class:`InvalidArgumentException` when trying to set an
                 axis that is not enabled.
        )rgr s rrNzDevice.absinfo�s��b�~�~�rc���|j|}|j|j|j|j|j
d�}|jj|j|d��y)a�
        Synchronizes our view of an absinfo axis to the kernel, thus
        updating the the device for every other client. This function should
        be used with care. Not only does it change the kernel device and
        thus may affect the behavior of other processes but it is racy: any
        client that has this device node open already may never see the
        updates.

        To use this function, update the absinfo for the desired axis
        first::

            >>> fd = open('/dev/input/event0', 'rb')
            >>> d = libevdev.Device(fd)
            >>> ai = InputAbsInfo(resolution=72)
            >>> d.absinfo[libevdev.EV_ABS.ABS_X] = ai
            >>> d.sync_absinfo_to_kernel(libevdev.EV_ABS.ABS_X)
        �r)r*r+r,r-T)�
new_values�kernelN)rNr)r*r+r,r-rDr.)rrG�arRs    r�sync_absinfo_to_kernelzDevice.sync_absinfo_to_kernel�s[��$
�L�L�����9�9��9�9��������l�l�	,��
	
�����t�z�z�d�4��Hrc#�:K�|jj�gStj|jjj	��rt
}nt}|jj|�}|��tj|j|j�}t||j|j|j���|tj j"k(r
t%��|jj|�}|���yy�w)a�
        Returns an iterable with currently pending events.

        Event processing should look like this::

            fd = open("/dev/input/event0", "rb")
            ctx = libevdev.Device(fd)

            while True:
                for e in ctx.events():
                    print(e):

        This function detects if the file descriptor is in blocking or
        non-blocking mode and adjusts its behavior accordingly. If the file
        descriptor is in nonblocking mode and no events are available, this
        function returns immediately. If the file descriptor is blocking,
        this function blocks if there are no events available.

        :returns: an iterable with the currently pending events
        N)rDrl�os�get_blocking�filenor	r�
next_eventr@�evbitr?rGr
r.�sec�usec�EV_SYN�SYN_DROPPEDr%)r�flags�evrGs    r�eventsz
Device.events�s�����*�>�>���$��I�
�?�?�4�>�>�,�,�3�3�5�6�&�E�$�E�
�^�^�
&�
&�u�
-���n��>�>�"�'�'�2�7�7�3�D��T�2�8�8�R�V�V�R�W�W�=�=��x���2�2�2�,�.�.����*�*�5�1�B��n�s�DD�Dc#�K�|jj�gS|rt}nt}|jj	|�}|�wtj|j|j�}t||j|j|j���|jj	|�}|��vyy�w)ai
        Returns an iterator with events pending to re-sync the caller's
        view of the device with the one from libevdev.

        :param force: if set, the device forces an internal sync. This is
            required after changing the fd of the device when the device state
            may have changed while libevdev was not processing events.
        N)
rDrlrrr�r@r�r?rGr
r.r�r�)r�forcer�r�rGs     r�synczDevice.syncs������>�>���$��I��(�E�"�E�
�^�^�
&�
&�u�
-���n��>�>�"�'�'�2�7�7�3�D��T�2�8�8�R�V�V�R�W�W�=�=����*�*�5�1�B��n�s�B:B?�=B?c��|jS)a�
        Returns the current value for a given event code or None where the
        event code does not exist on the device::

            >>> d = libevdev.Device(fd)
            >>> print(d.value[libevdev.EV_ABS.ABS_X])
            1024
            >>> print(d.value[libevdev.EV_ABS.ABS_Y])
            512
            >>> print(d.value[libevdev.EV_ABS.ABS_Z])
            None

        The returned object is a dict-like object that only accepts event
        codes as keys. No other operation than key-based access is
        supported.

        The default value for all codes is 0. State-less axes like the
        ``EV_REL`` range always return 0 for all supported event codes.
        )rfr s rr.zDevice.value+s��*�|�|�rc����j�td��t�fd�t�j�D��S)a�
        Returns a tuple with the available slots, each of which contains a
        wrapper object to access a slot value::

           >>> d = libevdev.Device(fd)
           >>> print(d.slots[0][libevdev.EV_ABS.ABS_MT_POSITION_X])
           1000
           >>> print(d.slots[0][libevdev.EV_ABS.ABS_MT_POSITION_Y])
           500
           >>> print(d.slots[1][libevdev.EV_ABS.ABS_MT_POSITION_X])
           200
           >>> print(d.slots[1][libevdev.EV_ABS.ABS_MT_POSITION_Y])
           300

        Alternatively, the tuple can be iterated on::

           xcode = libevdev.EV_ABS.ABS_MT_POSITION_X
           ycode = libevdev.EV_ABS.ABS_MT_POSITION_Y

           for s in d.slots:
                position = (s[xcode], s[ycode])

        The only values available for each slot are the ones in the
        ``libevdev.EV_ABS.ABS_MT_*`` range (but not
        ``libevdev.EV_ABS.ABS_MT_SLOT``).
        zDevice has no slotsc3�J�K�|]}tj�|����y�wr)r5rb)�.0r[rs  �r�	<genexpr>zDevice.slots.<locals>.<genexpr>bs�����U�t�V�&�&�t�T�2�U�s� #)rCr�tuple�ranger s`r�slotszDevice.slotsBs5���:�>�>�!�*�+@�A�A��U�u�T�^�^�?T�U�U�Urc��t|t�r&|jj|j�y	|j
tjk(rl|�t|t�std��|jxsd|jxsd|jxsd|jxsd|jxsdd�}n*|j
tjk(r
|�td��|jj!|j
j|j|�y#t"$r(|jj!|j�YywxYw)a0
        Enable an event type or event code on this device, even if not
        supported by this device.
        If event_code is an :class:`EventType`, that type is enabled and data
        is ignored.

        If event_code is one of ``libevdev.EV_ABS.ABS_*``, then data must be
        a :class:`InputAbsInfo`. Any unset fields of the
        :class:`InputAbsInfo` are replaced with
        0, i.e. the following example is valid and results in a
        fuzz/flat/resolution of zero::

                ctx = libevdev.Device()
                abs = InputAbsInfo(minimum=0, maximum=100)
                ctx.enable(libevdev.EV_ABS.ABS_X, data)

        If event_code is one of ``libevdev.EV_REP.REP_``, then data must be
        an integer.

        If event_code is one of ``libevdev.INPUT_PROP_``, then the given
        input property is enabled.

        :param event_code: the event code
        :type event_code: EventCode or EventType
        :param data: if event_code is not ``None``, data points to the
                     code-specific information.

        Nz.enabling EV_ABS codes requires an InputAbsInforr�z)enabling EV_REP codes requires an integer)�
isinstancerrD�enable_propertyr.r?r@rAr'rr)r*r+r,r-�EV_REP�enablerk)r�
event_coderRs   rr�z
Device.enableds	��:�j�-�0��N�N�*�*�:�+;�+;�<��	4����(�/�/�1��<�z�$��'E�2�3c�d�d�#'�<�<�#4�1�#'�<�<�#4�1� $�	�	��Q� $�	�	��Q�&*�o�o�&:��	<��
���H�O�O�3��<�2�3^�_�_��N�N�!�!�*�/�/�"7�"7��9I�9I�4�P���	4��N�N�!�!�*�"2�"2�3�	4�s�C.D'�'.E�Ec��t|t�r
t��	|jj	|j
j|j�y#t$r(|jj	|j�YywxYw)a{
        Disable the given event type or event code on this device. If the
        device does not support this type or code, this function does
        nothing. Otherwise, all future events from this device that match
        this type or code will be discarded::

            >>> d.disable(libevdev.EV_ABS)
            # All EV_ABS events are filtered now
            >>> d.disable(libevdev.EV_KEY.BTN_LEFT)
            # All BTN_LEFt events are filtered now

        To re-enable an event type or code, use :func:`enable()`

        :param event_code: the event type or code
        :type event_code: EventType or EventCode
        N)r�r�NotImplementedErrorrD�disabler?r.rk)rr�s  rr�zDevice.disable�sg��"�j�-�0�%�'�'�	5��N�N�"�"�:�?�?�#8�#8�*�:J�:J�K���	5��N�N�"�"�:�#3�#3�4�	5�s�:A�.B�Bc�H�|jsy|jjS)z�
        Returns the device node for this device. The device node is None if
        this device has not been created as uinput device.
        N)rd�devnoder s rr�zDevice.devnode�����|�|���|�|�#�#�#rc�H�|jsy|jjS)z�
        Returns the syspath for this device. The syspath is None if this
        device has not been created as uinput device.
        N)rd�syspathr s rr�zDevice.syspath�r�rc���tj�}|j|_|j|_|jj�D]f\}}|D]\}|tjk(r|j|}n%|tjk(r|j|}nd}|j||��^�h|jD]}|j|��t|j|�|_|S)a�
        Creates and returns a new :class:`Device` based on this libevdev
        device. The new device is equivalent to one created with
        ``libevdev.Device()``, i.e. it is one that does not have a file
        descriptor associated.

        To create a uinput device from an existing device::

            fd = open('/dev/input/event0', 'rb')
            d = libevdev.Device(fd)
            d.name = 'duplicated device'
            d.create_uinput_device()
            # d is now a duplicate of the event0 device with a custom name
            fd.close()

        Or to create a new device from scratch::

            d = libevdev.Device()
            d.name = 'test device'
            d.enable(libevdev.EV_KEY.BTN_LEFT)
            d.create_uinput_device()
            # d is now a device with a single button

        :param uinput_fd: A file descriptor to the /dev/input/uinput device. If None, the device is opened and closed automatically.
        :raises: OSError
        N)r@r5rorr��itemsrArNr�r.r�r�rrDrd)r�	uinput_fd�dr��csr�rRr�s        r�create_uinput_devicezDevice.create_uinput_device�s���6
�O�O���������w�w����[�[�&�&�(�	"�E�A�r��
"������'��<�<��?�D��(�/�/�)��:�:�a�=�D��D�����D�!�
"�	"����	�A��K�K��N�	�!�����;��	��rc��|js
t��d|D�cgc]}|j��c}vrtd��d|D�cgc]}|j��c}vrtd��|D]Q}|jj|jj|jj|j��Sycc}wcc}w)a<
        Send the list of :class:`InputEvent` events through this device. All
        events must have a valid :class:`EventCode` and value, the timestamp
        in the event is ignored and the kernel fills in its own timestamp.

        This function may only be called on a uinput device, not on a normal
        device.

        .. warning::

            an event list must always be terminated with a
            ``libevdev.EV_SYN.SYN_REPORT`` event or the kernel may delay
            processing.

        :param events: a list of :class:`InputEvent` events
        Nz"All events must have an event codezAll events must have a value)rdr
rGrr.�write_eventr?)rr��es   r�send_eventszDevice.send_events�s���$�|�|�"�$�$��F�+�q�A�F�F�+�+�*�+O�P�P��V�,��A�G�G�,�,�*�+I�J�J��	J�A��L�L�$�$�Q�V�V�\�\�1�6�6�<�<����I�	J��
,��-s�B<�Cc�v�	|jj�d|_y#t$rt��wxYw)a�
        Exclusively grabs the device, preventing events from being seen by
        anyone else. This includes in-kernel consumers of the events (e.g.
        for rfkill) and should be used with care.

        A grab is valid until the file descriptor is closed or until
        :func:`ungrab` is called, whichever happens earlier. libevdev
        re-issues the grab on the device after changing the fd. If the
        original file descriptor is still open when changing the fd on the
        device, re-issuing the grab will fail silently::

            fd1 = open("/dev/input/event0", "rb")
            d = libevdev.Device(fd1)
            d.grab()
            # device is now exclusively grabbed

            fd.close()
            fd2 = open("/dev/input/event0", "rb")
            d.fd = fd2
            # device is now exclusively grabbed

            fd3 = open("/dev/input/event0", "rb")
            d.fd = fd3
            # ERROR: fd2 is still open and the grab fails

        TN)rDr��OSErrorr#rer s rr�zDevice.grabs;��6	$��N�N���!� �����	$�!�#�#�	$�s�$�8c�H�|jjd�d|_y)zM
        Removes an exclusive grabs on the device, see :func:`grab`.
        FN)rDr�rer s r�ungrabz
Device.ungrab3s��	
�����E�"� ��rr)F)$rrrrrIrUrbr�propertyro�setterruryr|rrlr�r�r�rQrCr�rNr�r�r�r.r�r�r�r�r�r�r�r�r�rrrr5r5�s���4
S�
S�#=�#=�JW�W�2/��#��#�
�[�[�#��#��#��#�
�[�[�#��#��#��#�
�[�[�#��#��-��-��!��!��Y�Y�!��!��!��!�8�Y�Y�	��	�����0�C��C�7�	:��(��(��+��+��0��0�dI�4#2�J2�.����,�V��V�B14�f5�2�$��$��$��$�-�^J�<  �D!rr5)rir�r@�_clibrrrrrr	�eventr
�constr�	Exceptionr
rr#r%�objectr'r5rrr�<module>r�sj��.�	��)�]�]�� �	�y�	�
�y�
� �i��	�Y�	�:&)�6�&)�Rr
!�V�r
!r

Zerion Mini Shell 1.0