+
     hq  c                   s    ^ RI t ^ RIt^ RIt^RIHtHt ^RIHtHtHtH	t	 ^RI
Ht ^RIHt  ! R R]4      t ! R R	]4      t ! R
 R]4      t ! R R]4      t ! R R]4      t ! R R]4      tR# )i    N)LibevdevUinputDevice)READ_FLAG_SYNCREAD_FLAG_NORMALREAD_FLAG_FORCE_SYNCREAD_FLAG_BLOCKING)
InputEvent)InputPropertyc                   s    ] tR t^!tRtRtR# )InvalidFileErrorzl
A file provided is not a valid file descriptor for libevdev or this
device must not have a file descriptor
 N__name__
__module____qualname____firstlineno____doc____static_attributes__r	       4/usr/lib/python3.14/site-packages/libevdev/device.pyr   r   !   s     	r   r   c                   s4   a  ] tR t^)t o RtRR ltR tRtV tR# )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                    Wn         R # NZmessage)selfZmsg   &&r   __init__Z!InvalidArgumentException.__init__2   s    r   c                    V P                   # r   r   r      &r   __repr__Z!InvalidArgumentException.__repr__5   s    ||r   r   r   )	r   r   r   r   r   r   r   r   __classdictcell__Z__classdict__   @r   r   r   )   s      r   r   c                   s    ] tR t^9tRtRtR# )DeviceGrabErrorzw
A device grab failed to be issued. A caller must not assume that it has
exclusive access to the events on the device.
r	   Nr
   r	   r   r   r!   r!   9   s    r   r!   c                   s    ] tR t^@tRtRtR# )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)
r	   Nr
   r	   r   r   r"   r"   @   s    2 	r   r"   c                   s:   a  ] tR t^]t o RtRR ltR tR tRtV t	R# )InputAbsInfoa  
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.

: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                sN    Wn         W n        W0n        W@n        WPn        W`n        R # r   )minimummaximumfuzzflat
resolutionvalue)r   r$   r%   r&   r'   r(   r)   s   &&&&&&&r   r   ZInputAbsInfo.__init__k   s     		$
r   c                s    R P                  V P                  V P                  V P                  V P                  V P
                  V P                  4      # )z4min:{} max:{} fuzz:{} flat:{} resolution:{} value:{})Zformatr$   r%   r&   r'   r(   r)   r   r   r   r   ZInputAbsInfo.__repr__t   s;    ELL||T\\499dii

, 	,r   c                s~   V P                   VP                   8H  ;'       d    V P                  VP                  8H  ;'       d}    V P                  VP                  8H  ;'       d\    V P                  VP                  8H  ;'       d;    V P                  VP                  8H  ;'       d    V P
                  VP
                  8H  # r   )r$   r%   r)   r(   r&   r'   )r   Zotherr   r   __eq__ZInputAbsInfo.__eq__y   s    - ( (-( (

ekk)( ( 5#3#33( ( 		UZZ'	( (
 		UZZ'	)r   )r'   r&   r%   r$   r(   r)   )NNNNNN)
r   r   r   r   r   r   r   r*   r   r   r   r    r   r#   r#   ]   s     ,
) )r   r#   c                   sb  a  ] tR t^t o Rt ! R R4      t ! R R4      t ! R R4      tR+R	 lt]	R
 4       t
]
P                  R 4       t
]	R 4       t]P                  R 4       t]	R 4       t]P                  R 4       t]	R 4       t]	R 4       t]P                  R 4       t]	R 4       t]P                  R 4       t]	R 4       t]	R 4       tR tR t]	R 4       t]	R 4       t]	R 4       tR tR tR,R lt]	R 4       t]	R  4       tR+R! ltR" t]	R# 4       t]	R$ 4       t R+R% lt!R& t"R' t#R( t$R) t%R*t&V t'R# )-DeviceaR  
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                   s,   a  ] tR t^t o R tR tRtV tR# )Device._EventValueSetc                r   r   _devicer   Zparent_devicer   r   r   ZDevice._EventValueSet.__init__       (Lr   c                sL   VP                   \        P                  8X  dC   V\        P                  P                  8  d$   V P                  P
                  e   \        R4      hV P                  P                  P                  VP                   P                  VP                  4      # )NzCannot fetch value for MT axes)
typelibevdevEV_ABSABS_MT_SLOTr.   	num_slotsr   	_libevdevZevent_valuer)   r   coder   r   __getitem__Z!Device._EventValueSet.__getitem__   si    		X__,x222||%%1./OPP<<))55diiootzzRRr   r-   N)r   r   r   r   r   r9   r   r   r   r    r   _EventValueSetr,      s     	)	S 	Sr   r:   c                   s2   a  ] tR t^t o R tR tR tRtV tR# )Device._InputAbsInfoSetc                r   r   r-   r/   r   r   r   Z Device._InputAbsInfoSet.__init__   r0   r   c           	     s"   VP                   \        P                  8X  g   Q hV P                  P                  P                  VP                  4      pVf   V# \        VR,          VR,          VR,          VR,          VR,          VR,          4      # )Nr$   r%   r&   r'   r(   r)   )r1   r2   r3   r.   r6   absinfor)   r#   )r   r8   Zr   && r   r9   Z#Device._InputAbsInfoSet.__getitem__   ss    99///&&..tzz:Ay)a	l !&	1V9 !,7= =r   c                s`   VP                   \        P                  8X  g   Q hV P                  P	                  V4      '       g   \        R 4      h/ pVP                  e   VP                  VR&   VP                  e   VP                  VR&   VP                  e   VP                  VR&   VP                  e   VP                  VR&   VP                  e   VP                  VR&   VP                  e   VP                  VR&   V P                  P                  P                  VP                  V4       R# )zDevice does not have event codeNr$   r%   r&   r'   r(   r)   )r1   r2   r3   r.   hasr   r$   r%   r&   r'   r(   r)   r6   r<   )r   r8   r<   datas   &&& r   __setitem__Z#Device._InputAbsInfoSet.__setitem__   s    99///<<##D))./PQQD*")//Y*")//Y||'&||V||'&||V!!-%,%7%7\"}}( 'WLL""**4::t<r   r-   N	r   r   r   r   r   r9   r@   r   r   r   r    r   _InputAbsInfoSetr;      s     	)		=	= 	=r   rB   c                   s2   a  ] tR t^t o R tR tR tRtV tR# )Device._SlotValuec                s    Wn         W n        R # r   r.   _slot)r   Zdeviceslot   &&&r   r   ZDevice._SlotValue.__init__   s    !LJr   c                sL   VP                   \        P                  Jg    V\        P                  P                  8:  d   \	        R 4      hV P
                  P                  V4      '       g   R# V P
                  P                  P                  V P                  VP                  4      # ))Event code must be one of EV_ABS.ABS_MT_*Nr1   r2   r3   r4   r   r.   r>   r6   Z
slot_valuerE   r)   r7   r   r   r9   ZDevice._SlotValue.__getitem__   sm    		0x222./Z[[<<##D))<<))44TZZLLr   c                sf   VP                   \        P                  Jg    V\        P                  P                  8:  d   \	        R 4      hV P
                  P                  V4      '       g   \	        R4      hV P
                  P                  P                  V P                  VP                  VR7       R# )rH   zEvent code does not exist)Z	new_valueNrI   )r   r8   r)   rG   r   r@   ZDevice._SlotValue.__setitem__   sy    		0x222./Z[[<<##D))./JKKLL""--djj$**PU-Vr   rD   NrA   r   r    r   
_SlotValuerC      s     		M	W 	Wr   rJ   Nc                sd   \        V4      V n        R V n        RV n        \        P                  V 4      V n        \        P                  V 4      V n        Ve-    V P                  P                  \        P                  4       R # R #   \         d     T P                  P                  ^4        R # i ; i)NF)r    r6   _uinput_is_grabbedr+   r:   _valuesrB   	_absinfosset_clock_idtimeCLOCK_MONOTONICAttributeError)r   fdr   r   r   ZDevice.__init__   s    !" ,,T2006>/++D,@,@A  " /++A./s   )B &B/.B/c                .    V P                   P                  # )z
:returns: the device name
r6   namer   r   r   rV   Device.name       
 ~~"""r   c                &    WP                   n        R # r   rU   )r   rV   r   r   rV   rW          "r   c                rT   )z-
:returns: the device's kernel phys or None.
r6   physr   r   r   r\   Device.phys   rX   r   c                rY   r   r[   )r   r\   r   r   r\   r]     rZ   r   c                rT   )z,
:returns: the device's uniq string or None
r6   uniqr   r   r   r_   Device.uniq
  rX   r   c                rY   r   r^   )r   r_   r   r   r_   r`     rZ   r   c                rT   )z'
:returns: the device's driver version
)r6   driver_versionr   r   r   ra   ZDevice.driver_version  s    
 ~~,,,r   c                rT   )a|  
: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()
        ids = {'product' : 1234}
        ctx.id = ids

You must assign a new dictionary to ``id``. Technical limitations
prohibit accessing the ``id`` dictionary itself for write access.
See this example: ::

        $ ctx = Device()
        $ ctx.id['vendor'] = 1234
        $ print(ctx.id['vendor'])
        0
        $ ctx.id = {'vendor': 1234}
        $ print(ctx.id['vendor'])
        1234

r6   idr   r   r   rc   	Device.id  s    4 ~~   r   c                rY   r   rb   )r   Zvalsr   r   rc   rd   8  s     r   c                rT   )ag  
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

)r6   rS   r   r   r   rS   	Device.fd<  s    6 ~~   r   c                s^   V P                   P                  f   \        4       hWP                   n         V P                   P                  \        P
                  4       V P                  '       d   V P                  4        R # R #   \         d    T P                   P                  ^4        LNi ; ir   )	r6   rS   r   rO   rP   rQ   rR   rL   grab)r   Zfileobjr   r   rS   re   Y  s    >>$"$$#	+NN''(<(<= IIK   	+NN''*	+s   )B &B,+B,c                s    / p\         P                   F_  pV P                  V4      '       g   K  . pVP                   F-  pV P                  V4      '       g   K  VP	                  V4       K/  	  W1V&   Ka  	  V# )z
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, ...],
    }
)r2   typesr>   codesZappend)r   rg   trh   cs   &    r   evbitsZDevice.evbitse  se     A88A;;EWWxx{{Q  !H   r   c                s|    \         P                   Uu. uF  qP                  V4      '       g   K  VNK  	  up# u upi )z2
Returns a list of all supported input properties
)r2   Zpropshas_property)r   ps   & r   
propertiesZDevice.properties~  s-    
 $>>B>a->->q-A>BBBs   99c                sL    V P                   P                  VP                  4      # )zX
:param prop: a property
:returns: True if the device has the property, False otherwise
)r6   rl   r)   )r   Zpropr   r   rl   ZDevice.has_property  s    
 ~~**4::66r   c                s     V P                   P                  VP                  P                  VP                  4      #   \         d)    T P                   P                  TP                  4      u # i ; i)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
)r6   Z	has_eventr1   r)   rR   )r   Zevcoder   r   r>   Z
Device.has  sT    	:>>++FKK,=,=v||LL 	:>>++FLL99	:s   9< 0A/.A/c                rT   )z{
:returns: the number of slots on this device or ``None`` if this device
         does not support slots

:note: Read-only
)r6   r5   r   r   r   r5   ZDevice.num_slots  s     ~~'''r   c                rT   )zx
:returns: the current slot on this device or ``None`` if this device
         does not support slots

:note: Read-only
)r6   current_slotr   r   r   ro   ZDevice.current_slot  s     ~~***r   c                r   )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.
)rN   r   r   r   r<   ZDevice.absinfo  s    b ~~r   c           
     s    V P                   V,          pRVP                  RVP                  RVP                  RVP                  RVP
                  /pV P                  P                  VP                  VRR7       R# )	au  
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)Z
new_valuesZkernelN)r<   r$   r%   r&   r'   r(   r6   r)   )r   r8   Zar?   s   &&  r   sync_absinfo_to_kernelZDevice.sync_absinfo_to_kernel  se    $ LL199199all	,
 	tzzd4Hr   c              #  sR  "   V P                   P                  f   . # \        P                  ! V P                   P                  P	                  4       4      '       d   \
        pM\        pV P                   P                  V4      pVe   \        P                  ! VP                  VP                  4      p\        W2P                  VP                  VP                  4      x  V\        P                   P"                  8X  d   \%        4       hV P                   P                  V4      pK  R# 5i)a  
Returns an iterable with currently pending events.

Event processing should look like this::

    fd = open("/dev/input/event0", "rb")
    fcntl.fcntl(fd, fcntl.F_SETFL, os.O_NONBLOCK)  # optional
    ctx = libevdev.Device(fd)

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

        ... other mainloop code ...

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)r6   rS   osZget_blockingZfilenor   r   
next_eventr2   evbitr1   r8   r   r)   secusecZEV_SYNZSYN_DROPPEDr"   )r   flagsevr8   s   &   r   eventsZDevice.events  s     0 >>$I??4>>,,33566&E$E^^&&u-n>>"''2773DT88RVVRWW==x222,..**51B s   AD'CD'c              #  s  "   V P                   P                  f   . # V'       d   \        pM\        pV P                   P	                  V4      pVev   \
        P                  ! VP                  VP                  4      p\        WCP                  VP                  VP                  4      x  V P                   P	                  V4      pKy  R# 5i)a9  
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)r6   rS   r   r   rr   r2   rs   r1   r8   r   r)   rt   ru   )r   Zforcerv   rw   r8   s   &&   r   syncZDevice.sync   s      >>$I(E"E^^&&u-n>>"''2773DT88RVVRWW==**51B s   "CB#Cc                r   )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.
)rM   r   r   r   r)   ZDevice.value7  s    * ||r   c                s   a  S P                   f   \        R4      h\        ;QJ d*    . V 3R l\        S P                   4       4       F  NK  	  5# ! V 3R l\        S P                   4       4       4      # )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``).
zDevice has no slotsc              3   sP   <"   T F  p\         P                  SV4      x  K  	  R # 5ir   )r+   rJ   )Z.0rF   r   s   & r   Z	<genexpr>ZDevice.slots.<locals>.<genexpr>n  s#     U?TtV&&tT22?Ts   #&)r5   r   ZtupleZranger   s   fr   slotsZDevice.slotsN  sO    : >>!*+@AAuUuT^^?TUuUuUuT^^?TUUUr   c                s,   \        V\        4      '       d(   V P                  P                  VP                  4       R#  VP
                  \        P                  8X  d   Ve   \        V\        4      '       g   \        R4      hRVP                  ;'       g    ^ RVP                  ;'       g    ^ RVP                  ;'       g    ^ RVP                  ;'       g    ^ RVP                  ;'       g    ^ /pM.VP
                  \        P                  8X  d   Vf   \        R4      hV P                  P!                  VP
                  P                  VP                  V4       R#   \"         d*    T P                  P!                  TP                  4        R# i ; i)	a  
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 InputAbsInfor$   r%   r&   r'   r(   z)enabling EV_REP codes requires an integer)
isinstancer   r6   Zenable_propertyr)   r1   r2   r3   r#   r   r$   r%   r&   r'   r(   EV_REPenablerR   )r   
event_coder?   rG   r   r}   ZDevice.enablep  s&   : j-00NN**:+;+;<	4(//1<z$'E'E23cdd!4<<#4#41!4<<#4#41		Q		Q$doo&:&:	<
 HOO3<23^__NN!!*//"7"79I9I4P 	4NN!!*"2"23	4s1   AE E -E E E /A.E 0FFc                s*   \        V\        4      '       d   \        4       h V P                  P	                  VP
                  P                  VP                  4       R#   \         d*    T P                  P	                  TP                  4        R# i ; i)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   ZNotImplementedErrorr6   disabler1   r)   rR   )r   r~   r   r   r   ZDevice.disable  sj    " j-00%''	5NN"":??#8#8*:J:JK 	5NN"":#3#34	5s   :A 0BBc                V    V P                   '       g   R# V P                   P                  # )zx
Returns the device node for this device. The device node is None if
this device has not been created as uinput device.
N)rK   devnoder   r   r   r   ZDevice.devnode        |||||###r   c                r   )zp
Returns the syspath for this device. The syspath is None if this
device has not been created as uinput device.
N)rK   syspathr   r   r   r   ZDevice.syspath  r   r   c                s   \         P                  ! 4       pV P                  Vn        V P                  Vn        V P                  P                  4        Fs  w  r4V Fh  pV\         P                  8X  d   V P                  V,          pM+V\         P                  8X  d   V P                  V,          pMRpVP                  WV4       Kj  	  Ku  	  V P                   F  pV P                  V4       K  	  \        V P                  V4      Vn        V# )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)r2   r+   rV   rc   rk   Zitemsr3   r<   r|   r)   r}   rn   r   r6   rK   )r   Z	uinput_fdZdri   Zcsrj   r?   rm   s   &&      r   create_uinput_deviceZDevice.create_uinput_device  s    6 OOww[[&&(EA'<<?D(//)::a=DD!  ) AKKN ! !;	r   c                s   V P                   '       g   \        4       hRV Uu. uF  q"P                  NK  	  up9   d   \        R4      hRV Uu. uF  q"P                  NK  	  up9   d   \        R4      hV FR  pV P                   P                  VP                  P                  VP                  P                  VP                  4       KT  	  R# u upi u upi )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 codezAll events must have a value)rK   r   r8   r   r)   Zwrite_eventr1   )r   rx   Zer=   r   send_eventsZDevice.send_events  s    $ |||"$$F+FqFFF++*+OPPV,VGGV,,*+IJJALL$$QVV\\166<<I  , -s   CCc                s|     V P                   P                  4        RT n        R#   \         d    \        4       hi ; i)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

    fd1.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)r6   rf   ZOSErrorr!   rL   r   r   r   rf   ZDevice.grab  s;    6	$NN!    	$!##	$s   % ;c                sJ    V P                   P                  R4       RV n        R# )z=
Removes an exclusive grabs on the device, see :func:`grab`.
FN)r6   rf   rL   r   r   r   ungrabZDevice.ungrab?  s     	E" r   c                s    V F3  pV^ ,          P                   \        P                  Jg   K*  \        R4      h	  V F7  pV P                  P                  V^ ,          P                  V^,          4       K9  	  R# )a  
Write the LEDs to the device::

     >>> fd = open(path, 'r+b', buffering=0)
     >>> d = libevdev.Device(fd)
     >>> d.set_leds([(libevdev.EV_LED.LED_NUML, 0),
                     (libevdev.EV_LED.LED_SCROLLL, 1)])

Updating LED states require the fd to be in write-mode.
z"Event code must be one of EV_LED.*N)r1   r2   ZEV_LEDr   r6   Zset_ledr)   )r   ZledsZledr=   r   set_ledsZDevice.set_ledsF  sZ     C1v{{(//1./STT  CNN""3q6<<Q8 r   )rN   rL   r6   rK   rM   r   )F)(r   r   r   r   r   r:   rB   rJ   r   ZpropertyrV   Zsetterr\   r_   ra   rc   rS   rk   rn   rl   r>   r5   ro   r<   rp   rx   ry   r)   rz   r}   r   r   r   r   r   rf   r   r   r   r   r   r    r   r+   r+      s#    4
S 
S#= #=JW W2/ # # 
[[# # # # 
[[# # # # 
[[# # - - ! !6 YY! ! ! !8 YY	 	  0 C C7	: ( ( + + 0 0dI4&2P2.  , V VB14f52 $ $ $ $-^J<  D!9 9r   r+   )rP   rq   r2   Z_clibr    r   r   r   r   r   Zeventr   Zconstr   Z	Exceptionr   r   r!   r"   Zobjectr#   r+   r	   r   r   <module>r      sj   .  	  ) ] ]   	y 	y  i 	Y 	:")6 ")JT9V T9r   