€•i‹Œsphinx.addnodes”Œdocument”“”)”}”(Œ rawsource”Œ”Œchildren”]”(Œ translations”Œ LanguagesNode”“”)”}”(hhh]”(hŒ pending_xref”“”)”}”(hhh]”Œdocutils.nodes”ŒText”“”ŒChinese (Simplified)”…””}”Œparent”hsbaŒ attributes”}”(Œids”]”Œclasses”]”Œnames”]”Œdupnames”]”Œbackrefs”]”Œ refdomain”Œstd”Œreftype”Œdoc”Œ reftarget”Œ/translations/zh_CN/hid/uhid”Œmodname”NŒ classname”NŒ refexplicit”ˆuŒtagname”hhh ubh)”}”(hhh]”hŒChinese (Traditional)”…””}”hh2sbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ/translations/zh_TW/hid/uhid”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)”}”(hhh]”hŒItalian”…””}”hhFsbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ/translations/it_IT/hid/uhid”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)”}”(hhh]”hŒJapanese”…””}”hhZsbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ/translations/ja_JP/hid/uhid”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)”}”(hhh]”hŒKorean”…””}”hhnsbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ/translations/ko_KR/hid/uhid”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)”}”(hhh]”hŒPortuguese (Brazilian)”…””}”hh‚sbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ/translations/pt_BR/hid/uhid”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)”}”(hhh]”hŒSpanish”…””}”hh–sbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ/translations/sp_SP/hid/uhid”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubeh}”(h]”h ]”h"]”h$]”h&]”Œcurrent_language”ŒEnglish”uh1h hhŒ _document”hŒsource”NŒline”NubhŒsection”“”)”}”(hhh]”(hŒtitle”“”)”}”(hŒ6UHID - User-space I/O driver support for HID subsystem”h]”hŒ6UHID - User-space I/O driver support for HID subsystem”…””}”(hh¼h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hºhh·h²hh³Œ6/var/lib/git/docbuild/linux/Documentation/hid/uhid.rst”h´KubhŒ paragraph”“”)”}”(hŒÇUHID allows user-space to implement HID transport drivers. Please see hid-transport.rst for an introduction into HID transport drivers. This document relies heavily on the definitions declared there.”h]”hŒÇUHID allows user-space to implement HID transport drivers. Please see hid-transport.rst for an introduction into HID transport drivers. This document relies heavily on the definitions declared there.”…””}”(hhÍh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´Khh·h²hubhÌ)”}”(hŒÝWith UHID, a user-space transport driver can create kernel hid-devices for each device connected to the user-space controlled bus. The UHID API defines the I/O events provided from the kernel to user-space and vice versa.”h]”hŒÝWith UHID, a user-space transport driver can create kernel hid-devices for each device connected to the user-space controlled bus. The UHID API defines the I/O events provided from the kernel to user-space and vice versa.”…””}”(hhÛh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´K hh·h²hubhÌ)”}”(hŒKThere is an example user-space application in ./samples/uhid/uhid-example.c”h]”hŒKThere is an example user-space application in ./samples/uhid/uhid-example.c”…””}”(hhéh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´K hh·h²hubh¶)”}”(hhh]”(h»)”}”(hŒ The UHID API”h]”hŒ The UHID API”…””}”(hhúh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hºhh÷h²hh³hÊh´KubhÌ)”}”(hŒ½UHID is accessed through a character misc-device. The minor number is allocated dynamically so you need to rely on udev (or similar) to create the device node. This is /dev/uhid by default.”h]”hŒ½UHID is accessed through a character misc-device. The minor number is allocated dynamically so you need to rely on udev (or similar) to create the device node. This is /dev/uhid by default.”…””}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´Khh÷h²hubhÌ)”}”(hXTIf a new device is detected by your HID I/O Driver and you want to register this device with the HID subsystem, then you need to open /dev/uhid once for each device you want to register. All further communication is done by read()'ing or write()'ing "struct uhid_event" objects. Non-blocking operations are supported by setting O_NONBLOCK::”h]”hX[If a new device is detected by your HID I/O Driver and you want to register this device with the HID subsystem, then you need to open /dev/uhid once for each device you want to register. All further communication is done by read()’ing or write()’ing “struct uhid_event†objects. Non-blocking operations are supported by setting O_NONBLOCK:”…””}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´Khh÷h²hubhŒ literal_block”“”)”}”(hŒÜstruct uhid_event { __u32 type; union { struct uhid_create2_req create2; struct uhid_output_req output; struct uhid_input2_req input2; ... } u; };”h]”hŒÜstruct uhid_event { __u32 type; union { struct uhid_create2_req create2; struct uhid_output_req output; struct uhid_input2_req input2; ... } u; };”…””}”hj&sbah}”(h]”h ]”h"]”h$]”h&]”Œ xml:space”Œpreserve”uh1j$h³hÊh´Khh÷h²hubhÌ)”}”(hXdThe "type" field contains the ID of the event. Depending on the ID different payloads are sent. You must not split a single event across multiple read()'s or multiple write()'s. A single event must always be sent as a whole. Furthermore, only a single event can be sent per read() or write(). Pending data is ignored. If you want to handle multiple events in a single syscall, then use vectored I/O with readv()/writev(). The "type" field defines the payload. For each type, there is a payload-structure available in the union "u" (except for empty payloads). This payload contains management and/or device data.”h]”hXtThe “type†field contains the ID of the event. Depending on the ID different payloads are sent. You must not split a single event across multiple read()’s or multiple write()’s. A single event must always be sent as a whole. Furthermore, only a single event can be sent per read() or write(). Pending data is ignored. If you want to handle multiple events in a single syscall, then use vectored I/O with readv()/writev(). The “type†field defines the payload. For each type, there is a payload-structure available in the union “u†(except for empty payloads). This payload contains management and/or device data.”…””}”(hj6h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´K&hh÷h²hubhÌ)”}”(hX|The first thing you should do is send a UHID_CREATE2 event. This will register the device. UHID will respond with a UHID_START event. You can now start sending data to and reading data from UHID. However, unless UHID sends the UHID_OPEN event, the internally attached HID Device Driver has no user attached. That is, you might put your device asleep unless you receive the UHID_OPEN event. If you receive the UHID_OPEN event, you should start I/O. If the last user closes the HID device, you will receive a UHID_CLOSE event. This may be followed by a UHID_OPEN event again and so on. There is no need to perform reference-counting in user-space. That is, you will never receive multiple UHID_OPEN events without a UHID_CLOSE event. The HID subsystem performs ref-counting for you. You may decide to ignore UHID_OPEN/UHID_CLOSE, though. I/O is allowed even though the device may have no users.”h]”hX|The first thing you should do is send a UHID_CREATE2 event. This will register the device. UHID will respond with a UHID_START event. You can now start sending data to and reading data from UHID. However, unless UHID sends the UHID_OPEN event, the internally attached HID Device Driver has no user attached. That is, you might put your device asleep unless you receive the UHID_OPEN event. If you receive the UHID_OPEN event, you should start I/O. If the last user closes the HID device, you will receive a UHID_CLOSE event. This may be followed by a UHID_OPEN event again and so on. There is no need to perform reference-counting in user-space. That is, you will never receive multiple UHID_OPEN events without a UHID_CLOSE event. The HID subsystem performs ref-counting for you. You may decide to ignore UHID_OPEN/UHID_CLOSE, though. I/O is allowed even though the device may have no users.”…””}”(hjDh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´K0hh÷h²hubhÌ)”}”(hX"If you want to send data on the interrupt channel to the HID subsystem, you send a HID_INPUT2 event with your raw data payload. If the kernel wants to send data on the interrupt channel to the device, you will read a UHID_OUTPUT event. Data requests on the control channel are currently limited to GET_REPORT and SET_REPORT (no other data reports on the control channel are defined so far). Those requests are always synchronous. That means, the kernel sends UHID_GET_REPORT and UHID_SET_REPORT events and requires you to forward them to the device on the control channel. Once the device responds, you must forward the response via UHID_GET_REPORT_REPLY and UHID_SET_REPORT_REPLY to the kernel. The kernel blocks internal driver-execution during such round-trips (times out after a hard-coded period).”h]”hX"If you want to send data on the interrupt channel to the HID subsystem, you send a HID_INPUT2 event with your raw data payload. If the kernel wants to send data on the interrupt channel to the device, you will read a UHID_OUTPUT event. Data requests on the control channel are currently limited to GET_REPORT and SET_REPORT (no other data reports on the control channel are defined so far). Those requests are always synchronous. That means, the kernel sends UHID_GET_REPORT and UHID_SET_REPORT events and requires you to forward them to the device on the control channel. Once the device responds, you must forward the response via UHID_GET_REPORT_REPLY and UHID_SET_REPORT_REPLY to the kernel. The kernel blocks internal driver-execution during such round-trips (times out after a hard-coded period).”…””}”(hjRh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´K>hh÷h²hubhÌ)”}”(hŒúIf your device disconnects, you should send a UHID_DESTROY event. This will unregister the device. You can now send UHID_CREATE2 again to register a new device. If you close() the fd, the device is automatically unregistered and destroyed internally.”h]”hŒúIf your device disconnects, you should send a UHID_DESTROY event. This will unregister the device. You can now send UHID_CREATE2 again to register a new device. If you close() the fd, the device is automatically unregistered and destroyed internally.”…””}”(hj`h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´KJhh÷h²hubeh}”(h]”Œ the-uhid-api”ah ]”h"]”Œ the uhid api”ah$]”h&]”uh1hµhh·h²hh³hÊh´Kubh¶)”}”(hhh]”(h»)”}”(hŒwrite()”h]”hŒwrite()”…””}”(hjyh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hºhjvh²hh³hÊh´KQubhÌ)”}”(hXûwrite() allows you to modify the state of the device and feed input data into the kernel. The kernel will parse the event immediately and if the event ID is not supported, it will return -EOPNOTSUPP. If the payload is invalid, then -EINVAL is returned, otherwise, the amount of data that was read is returned and the request was handled successfully. O_NONBLOCK does not affect write() as writes are always handled immediately in a non-blocking fashion. Future requests might make use of O_NONBLOCK, though.”h]”hXûwrite() allows you to modify the state of the device and feed input data into the kernel. The kernel will parse the event immediately and if the event ID is not supported, it will return -EOPNOTSUPP. If the payload is invalid, then -EINVAL is returned, otherwise, the amount of data that was read is returned and the request was handled successfully. O_NONBLOCK does not affect write() as writes are always handled immediately in a non-blocking fashion. Future requests might make use of O_NONBLOCK, though.”…””}”(hj‡h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´KRhjvh²hubhŒdefinition_list”“”)”}”(hhh]”(hŒdefinition_list_item”“”)”}”(hŒâUHID_CREATE2: This creates the internal HID device. No I/O is possible until you send this event to the kernel. The payload is of type struct uhid_create2_req and contains information about your device. You can start I/O now. ”h]”(hŒterm”“”)”}”(hŒ UHID_CREATE2:”h]”hŒ UHID_CREATE2:”…””}”(hj¢h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j h³hÊh´K]hjœubhŒ definition”“”)”}”(hhh]”hÌ)”}”(hŒÓThis creates the internal HID device. No I/O is possible until you send this event to the kernel. The payload is of type struct uhid_create2_req and contains information about your device. You can start I/O now.”h]”hŒÓThis creates the internal HID device. No I/O is possible until you send this event to the kernel. The payload is of type struct uhid_create2_req and contains information about your device. You can start I/O now.”…””}”(hjµh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´K[hj²ubah}”(h]”h ]”h"]”h$]”h&]”uh1j°hjœubeh}”(h]”h ]”h"]”h$]”h&]”uh1jšh³hÊh´K]hj—ubj›)”}”(hXCUHID_DESTROY: This destroys the internal HID device. No further I/O will be accepted. There may still be pending messages that you can receive with read() but no further UHID_INPUT events can be sent to the kernel. You can create a new device by sending UHID_CREATE2 again. There is no need to reopen the character device. ”h]”(j¡)”}”(hŒ UHID_DESTROY:”h]”hŒ UHID_DESTROY:”…””}”(hjÓh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j h³hÊh´KdhjÏubj±)”}”(hhh]”hÌ)”}”(hX4This destroys the internal HID device. No further I/O will be accepted. There may still be pending messages that you can receive with read() but no further UHID_INPUT events can be sent to the kernel. You can create a new device by sending UHID_CREATE2 again. There is no need to reopen the character device.”h]”hX4This destroys the internal HID device. No further I/O will be accepted. There may still be pending messages that you can receive with read() but no further UHID_INPUT events can be sent to the kernel. You can create a new device by sending UHID_CREATE2 again. There is no need to reopen the character device.”…””}”(hjäh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´K`hjáubah}”(h]”h ]”h"]”h$]”h&]”uh1j°hjÏubeh}”(h]”h ]”h"]”h$]”h&]”uh1jšh³hÊh´Kdhj—h²hubj›)”}”(hŒåUHID_INPUT2: You must send UHID_CREATE2 before sending input to the kernel! This event contains a data-payload. This is the raw data that you read from your device on the interrupt channel. The kernel will parse the HID reports. ”h]”(j¡)”}”(hŒ UHID_INPUT2:”h]”hŒ UHID_INPUT2:”…””}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j h³hÊh´Kihjþubj±)”}”(hhh]”hÌ)”}”(hŒ×You must send UHID_CREATE2 before sending input to the kernel! This event contains a data-payload. This is the raw data that you read from your device on the interrupt channel. The kernel will parse the HID reports.”h]”hŒ×You must send UHID_CREATE2 before sending input to the kernel! This event contains a data-payload. This is the raw data that you read from your device on the interrupt channel. The kernel will parse the HID reports.”…””}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´Kghjubah}”(h]”h ]”h"]”h$]”h&]”uh1j°hjþubeh}”(h]”h ]”h"]”h$]”h&]”uh1jšh³hÊh´Kihj—h²hubj›)”}”(hX|UHID_GET_REPORT_REPLY: If you receive a UHID_GET_REPORT request you must answer with this request. You must copy the "id" field from the request into the answer. Set the "err" field to 0 if no error occurred or to EIO if an I/O error occurred. If "err" is 0 then you should fill the buffer of the answer with the results of the GET_REPORT request and set "size" correspondingly. ”h]”(j¡)”}”(hŒUHID_GET_REPORT_REPLY:”h]”hŒUHID_GET_REPORT_REPLY:”…””}”(hj1h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j h³hÊh´Kphj-ubj±)”}”(hhh]”hÌ)”}”(hXdIf you receive a UHID_GET_REPORT request you must answer with this request. You must copy the "id" field from the request into the answer. Set the "err" field to 0 if no error occurred or to EIO if an I/O error occurred. If "err" is 0 then you should fill the buffer of the answer with the results of the GET_REPORT request and set "size" correspondingly.”h]”hXtIf you receive a UHID_GET_REPORT request you must answer with this request. You must copy the “id†field from the request into the answer. Set the “err†field to 0 if no error occurred or to EIO if an I/O error occurred. If “err†is 0 then you should fill the buffer of the answer with the results of the GET_REPORT request and set “size†correspondingly.”…””}”(hjBh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´Klhj?ubah}”(h]”h ]”h"]”h$]”h&]”uh1j°hj-ubeh}”(h]”h ]”h"]”h$]”h&]”uh1jšh³hÊh´Kphj—h²hubj›)”}”(hŒÕUHID_SET_REPORT_REPLY: This is the SET_REPORT equivalent of UHID_GET_REPORT_REPLY. Unlike GET_REPORT, SET_REPORT never returns a data buffer, therefore, it's sufficient to set the "id" and "err" fields correctly. ”h]”(j¡)”}”(hŒUHID_SET_REPORT_REPLY:”h]”hŒUHID_SET_REPORT_REPLY:”…””}”(hj`h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j h³hÊh´Kuhj\ubj±)”}”(hhh]”hÌ)”}”(hŒ½This is the SET_REPORT equivalent of UHID_GET_REPORT_REPLY. Unlike GET_REPORT, SET_REPORT never returns a data buffer, therefore, it's sufficient to set the "id" and "err" fields correctly.”h]”hŒÇThis is the SET_REPORT equivalent of UHID_GET_REPORT_REPLY. Unlike GET_REPORT, SET_REPORT never returns a data buffer, therefore, it’s sufficient to set the “id†and “err†fields correctly.”…””}”(hjqh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´Kshjnubah}”(h]”h ]”h"]”h$]”h&]”uh1j°hj\ubeh}”(h]”h ]”h"]”h$]”h&]”uh1jšh³hÊh´Kuhj—h²hubeh}”(h]”h ]”h"]”h$]”h&]”uh1j•hjvh²hh³hÊh´Nubeh}”(h]”Œwrite”ah ]”h"]”Œwrite()”ah$]”h&]”uh1hµhh·h²hh³hÊh´KQubh¶)”}”(hhh]”(h»)”}”(hŒread()”h]”hŒread()”…””}”(hjœh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hºhj™h²hh³hÊh´KxubhÌ)”}”(hŒ…read() will return a queued output report. No reaction is required to any of them but you should handle them according to your needs.”h]”hŒ…read() will return a queued output report. No reaction is required to any of them but you should handle them according to your needs.”…””}”(hjªh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´Kyhj™h²hubj–)”}”(hhh]”(j›)”}”(hX©UHID_START: This is sent when the HID device is started. Consider this as an answer to UHID_CREATE2. This is always the first event that is sent. Note that this event might not be available immediately after write(UHID_CREATE2) returns. Device drivers might require delayed setups. This event contains a payload of type uhid_start_req. The "dev_flags" field describes special behaviors of a device. The following flags are defined: - UHID_DEV_NUMBERED_FEATURE_REPORTS - UHID_DEV_NUMBERED_OUTPUT_REPORTS - UHID_DEV_NUMBERED_INPUT_REPORTS Each of these flags defines whether a given report-type uses numbered reports. If numbered reports are used for a type, all messages from the kernel already have the report-number as prefix. Otherwise, no prefix is added by the kernel. For messages sent by user-space to the kernel, you must adjust the prefixes according to these flags. ”h]”(j¡)”}”(hŒ UHID_START:”h]”hŒ UHID_START:”…””}”(hj¿h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j h³hÊh´Khj»ubj±)”}”(hhh]”(hÌ)”}”(hX£This is sent when the HID device is started. Consider this as an answer to UHID_CREATE2. This is always the first event that is sent. Note that this event might not be available immediately after write(UHID_CREATE2) returns. Device drivers might require delayed setups. This event contains a payload of type uhid_start_req. The "dev_flags" field describes special behaviors of a device. The following flags are defined:”h]”hX§This is sent when the HID device is started. Consider this as an answer to UHID_CREATE2. This is always the first event that is sent. Note that this event might not be available immediately after write(UHID_CREATE2) returns. Device drivers might require delayed setups. This event contains a payload of type uhid_start_req. The “dev_flags†field describes special behaviors of a device. The following flags are defined:”…””}”(hjÐh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´K}hjÍubhŒ block_quote”“”)”}”(hXÔ- UHID_DEV_NUMBERED_FEATURE_REPORTS - UHID_DEV_NUMBERED_OUTPUT_REPORTS - UHID_DEV_NUMBERED_INPUT_REPORTS Each of these flags defines whether a given report-type uses numbered reports. If numbered reports are used for a type, all messages from the kernel already have the report-number as prefix. Otherwise, no prefix is added by the kernel. For messages sent by user-space to the kernel, you must adjust the prefixes according to these flags. ”h]”hŒ bullet_list”“”)”}”(hhh]”(hŒ list_item”“”)”}”(hŒ!UHID_DEV_NUMBERED_FEATURE_REPORTS”h]”hÌ)”}”(hjíh]”hŒ!UHID_DEV_NUMBERED_FEATURE_REPORTS”…””}”(hjïh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´K„hjëubah}”(h]”h ]”h"]”h$]”h&]”uh1jéhjæubjê)”}”(hŒ UHID_DEV_NUMBERED_OUTPUT_REPORTS”h]”hÌ)”}”(hjh]”hŒ UHID_DEV_NUMBERED_OUTPUT_REPORTS”…””}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´K…hjubah}”(h]”h ]”h"]”h$]”h&]”uh1jéhjæubjê)”}”(hXUHID_DEV_NUMBERED_INPUT_REPORTS Each of these flags defines whether a given report-type uses numbered reports. If numbered reports are used for a type, all messages from the kernel already have the report-number as prefix. Otherwise, no prefix is added by the kernel. For messages sent by user-space to the kernel, you must adjust the prefixes according to these flags. ”h]”(hÌ)”}”(hŒUHID_DEV_NUMBERED_INPUT_REPORTS”h]”hŒUHID_DEV_NUMBERED_INPUT_REPORTS”…””}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´K†hjubjß)”}”(hXREach of these flags defines whether a given report-type uses numbered reports. If numbered reports are used for a type, all messages from the kernel already have the report-number as prefix. Otherwise, no prefix is added by the kernel. For messages sent by user-space to the kernel, you must adjust the prefixes according to these flags. ”h]”hÌ)”}”(hXQEach of these flags defines whether a given report-type uses numbered reports. If numbered reports are used for a type, all messages from the kernel already have the report-number as prefix. Otherwise, no prefix is added by the kernel. For messages sent by user-space to the kernel, you must adjust the prefixes according to these flags.”h]”hXQEach of these flags defines whether a given report-type uses numbered reports. If numbered reports are used for a type, all messages from the kernel already have the report-number as prefix. Otherwise, no prefix is added by the kernel. For messages sent by user-space to the kernel, you must adjust the prefixes according to these flags.”…””}”(hj/h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´Kˆhj+ubah}”(h]”h ]”h"]”h$]”h&]”uh1jÞh³hÊh´Kˆhjubeh}”(h]”h ]”h"]”h$]”h&]”uh1jéhjæubeh}”(h]”h ]”h"]”h$]”h&]”Œbullet”Œ-”uh1jäh³hÊh´K„hjàubah}”(h]”h ]”h"]”h$]”h&]”uh1jÞh³hÊh´K„hjÍubeh}”(h]”h ]”h"]”h$]”h&]”uh1j°hj»ubeh}”(h]”h ]”h"]”h$]”h&]”uh1jšh³hÊh´Khj¸ubj›)”}”(hX›UHID_STOP: This is sent when the HID device is stopped. Consider this as an answer to UHID_DESTROY. If you didn't destroy your device via UHID_DESTROY, but the kernel sends an UHID_STOP event, this should usually be ignored. It means that the kernel reloaded/changed the device driver loaded on your HID device (or some other maintenance actions happened). You can usually ignore any UHID_STOP events safely. ”h]”(j¡)”}”(hŒ UHID_STOP:”h]”hŒ UHID_STOP:”…””}”(hjgh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j h³hÊh´K˜hjcubj±)”}”(hhh]”(hÌ)”}”(hŒXThis is sent when the HID device is stopped. Consider this as an answer to UHID_DESTROY.”h]”hŒXThis is sent when the HID device is stopped. Consider this as an answer to UHID_DESTROY.”…””}”(hjxh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´KhjuubhÌ)”}”(hXIf you didn't destroy your device via UHID_DESTROY, but the kernel sends an UHID_STOP event, this should usually be ignored. It means that the kernel reloaded/changed the device driver loaded on your HID device (or some other maintenance actions happened).”h]”hXIf you didn’t destroy your device via UHID_DESTROY, but the kernel sends an UHID_STOP event, this should usually be ignored. It means that the kernel reloaded/changed the device driver loaded on your HID device (or some other maintenance actions happened).”…””}”(hj†h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´K“hjuubhÌ)”}”(hŒ3You can usually ignore any UHID_STOP events safely.”h]”hŒ3You can usually ignore any UHID_STOP events safely.”…””}”(hj”h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´K˜hjuubeh}”(h]”h ]”h"]”h$]”h&]”uh1j°hjcubeh}”(h]”h ]”h"]”h$]”h&]”uh1jšh³hÊh´K˜hj¸h²hubj›)”}”(hXgUHID_OPEN: This is sent when the HID device is opened. That is, the data that the HID device provides is read by some other process. You may ignore this event but it is useful for power-management. As long as you haven't received this event there is actually no other process that reads your data so there is no need to send UHID_INPUT2 events to the kernel. ”h]”(j¡)”}”(hŒ UHID_OPEN:”h]”hŒ UHID_OPEN:”…””}”(hj²h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j h³hÊh´KŸhj®ubj±)”}”(hhh]”hÌ)”}”(hX[This is sent when the HID device is opened. That is, the data that the HID device provides is read by some other process. You may ignore this event but it is useful for power-management. As long as you haven't received this event there is actually no other process that reads your data so there is no need to send UHID_INPUT2 events to the kernel.”h]”hX]This is sent when the HID device is opened. That is, the data that the HID device provides is read by some other process. You may ignore this event but it is useful for power-management. As long as you haven’t received this event there is actually no other process that reads your data so there is no need to send UHID_INPUT2 events to the kernel.”…””}”(hjÃh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´K›hjÀubah}”(h]”h ]”h"]”h$]”h&]”uh1j°hj®ubeh}”(h]”h ]”h"]”h$]”h&]”uh1jšh³hÊh´KŸhj¸h²hubj›)”}”(hŒUHID_CLOSE: This is sent when there are no more processes which read the HID data. It is the counterpart of UHID_OPEN and you may as well ignore this event. ”h]”(j¡)”}”(hŒ UHID_CLOSE:”h]”hŒ UHID_CLOSE:”…””}”(hjáh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j h³hÊh´K£hjÝubj±)”}”(hhh]”hÌ)”}”(hŒThis is sent when there are no more processes which read the HID data. It is the counterpart of UHID_OPEN and you may as well ignore this event.”h]”hŒThis is sent when there are no more processes which read the HID data. It is the counterpart of UHID_OPEN and you may as well ignore this event.”…””}”(hjòh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´K¢hjïubah}”(h]”h ]”h"]”h$]”h&]”uh1j°hjÝubeh}”(h]”h ]”h"]”h$]”h&]”uh1jšh³hÊh´K£hj¸h²hubj›)”}”(hX&UHID_OUTPUT: This is sent if the HID device driver wants to send raw data to the I/O device on the interrupt channel. You should read the payload and forward it to the device. The payload is of type "struct uhid_output_req". This may be received even though you haven't received UHID_OPEN yet. ”h]”(j¡)”}”(hŒ UHID_OUTPUT:”h]”hŒ UHID_OUTPUT:”…””}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j h³hÊh´K©hj ubj±)”}”(hhh]”hÌ)”}”(hXThis is sent if the HID device driver wants to send raw data to the I/O device on the interrupt channel. You should read the payload and forward it to the device. The payload is of type "struct uhid_output_req". This may be received even though you haven't received UHID_OPEN yet.”h]”hXThis is sent if the HID device driver wants to send raw data to the I/O device on the interrupt channel. You should read the payload and forward it to the device. The payload is of type “struct uhid_output_reqâ€. This may be received even though you haven’t received UHID_OPEN yet.”…””}”(hj!h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´K¦hjubah}”(h]”h ]”h"]”h$]”h&]”uh1j°hj ubeh}”(h]”h ]”h"]”h$]”h&]”uh1jšh³hÊh´K©hj¸h²hubj›)”}”(hX0UHID_GET_REPORT: This event is sent if the kernel driver wants to perform a GET_REPORT request on the control channel as described in the HID specs. The report-type and report-number are available in the payload. The kernel serializes GET_REPORT requests so there will never be two in parallel. However, if you fail to respond with a UHID_GET_REPORT_REPLY, the request might silently time out. Once you read a GET_REPORT request, you shall forward it to the HID device and remember the "id" field in the payload. Once your HID device responds to the GET_REPORT (or if it fails), you must send a UHID_GET_REPORT_REPLY to the kernel with the exact same "id" as in the request. If the request already timed out, the kernel will ignore the response silently. The "id" field is never re-used, so conflicts cannot happen. ”h]”(j¡)”}”(hŒUHID_GET_REPORT:”h]”hŒUHID_GET_REPORT:”…””}”(hj?h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j h³hÊh´K·hj;ubj±)”}”(hhh]”hÌ)”}”(hXThis event is sent if the kernel driver wants to perform a GET_REPORT request on the control channel as described in the HID specs. The report-type and report-number are available in the payload. The kernel serializes GET_REPORT requests so there will never be two in parallel. However, if you fail to respond with a UHID_GET_REPORT_REPLY, the request might silently time out. Once you read a GET_REPORT request, you shall forward it to the HID device and remember the "id" field in the payload. Once your HID device responds to the GET_REPORT (or if it fails), you must send a UHID_GET_REPORT_REPLY to the kernel with the exact same "id" as in the request. If the request already timed out, the kernel will ignore the response silently. The "id" field is never re-used, so conflicts cannot happen.”h]”hX*This event is sent if the kernel driver wants to perform a GET_REPORT request on the control channel as described in the HID specs. The report-type and report-number are available in the payload. The kernel serializes GET_REPORT requests so there will never be two in parallel. However, if you fail to respond with a UHID_GET_REPORT_REPLY, the request might silently time out. Once you read a GET_REPORT request, you shall forward it to the HID device and remember the “id†field in the payload. Once your HID device responds to the GET_REPORT (or if it fails), you must send a UHID_GET_REPORT_REPLY to the kernel with the exact same “id†as in the request. If the request already timed out, the kernel will ignore the response silently. The “id†field is never re-used, so conflicts cannot happen.”…””}”(hjPh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´K¬hjMubah}”(h]”h ]”h"]”h$]”h&]”uh1j°hj;ubeh}”(h]”h ]”h"]”h$]”h&]”uh1jšh³hÊh´K·hj¸h²hubj›)”}”(hX UHID_SET_REPORT: This is the SET_REPORT equivalent of UHID_GET_REPORT. On receipt, you shall send a SET_REPORT request to your HID device. Once it replies, you must tell the kernel about it via UHID_SET_REPORT_REPLY. The same restrictions as for UHID_GET_REPORT apply. ”h]”(j¡)”}”(hŒUHID_SET_REPORT:”h]”hŒUHID_SET_REPORT:”…””}”(hjnh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j h³hÊh´K½hjjubj±)”}”(hhh]”hÌ)”}”(hŒûThis is the SET_REPORT equivalent of UHID_GET_REPORT. On receipt, you shall send a SET_REPORT request to your HID device. Once it replies, you must tell the kernel about it via UHID_SET_REPORT_REPLY. The same restrictions as for UHID_GET_REPORT apply.”h]”hŒûThis is the SET_REPORT equivalent of UHID_GET_REPORT. On receipt, you shall send a SET_REPORT request to your HID device. Once it replies, you must tell the kernel about it via UHID_SET_REPORT_REPLY. The same restrictions as for UHID_GET_REPORT apply.”…””}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´Kºhj|ubah}”(h]”h ]”h"]”h$]”h&]”uh1j°hjjubeh}”(h]”h ]”h"]”h$]”h&]”uh1jšh³hÊh´K½hj¸h²hubeh}”(h]”h ]”h"]”h$]”h&]”uh1j•hj™h²hh³hÊh´NubhŒ transition”“”)”}”(hŒ4----------------------------------------------------”h]”h}”(h]”h ]”h"]”h$]”h&]”uh1jŸh³hÊh´K¿hj™h²hubhÌ)”}”(hŒ4Written 2012, David Herrmann ”h]”(hŒWritten 2012, David Herrmann <”…””}”(hj«h²hh³Nh´NubhŒ reference”“”)”}”(hŒdh.herrmann@gmail.com”h]”hŒdh.herrmann@gmail.com”…””}”(hjµh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”Œrefuri”Œmailto:dh.herrmann@gmail.com”uh1j³hj«ubhŒ>”…””}”(hj«h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´KÁhj™h²hubeh}”(h]”Œread”ah ]”h"]”Œread()”ah$]”h&]”uh1hµhh·h²hh³hÊh´Kxubeh}”(h]”Œ4uhid-user-space-i-o-driver-support-for-hid-subsystem”ah ]”h"]”Œ6uhid - user-space i/o driver support for hid subsystem”ah$]”h&]”uh1hµhhh²hh³hÊh´Kubeh}”(h]”h ]”h"]”h$]”h&]”Œsource”hÊuh1hŒcurrent_source”NŒ current_line”NŒsettings”Œdocutils.frontend”ŒValues”“”)”}”(hºNŒ generator”NŒ datestamp”NŒ source_link”NŒ source_url”NŒ toc_backlinks”Œentry”Œfootnote_backlinks”KŒ sectnum_xform”KŒstrip_comments”NŒstrip_elements_with_classes”NŒ strip_classes”NŒ report_level”KŒ halt_level”KŒexit_status_level”KŒdebug”NŒwarning_stream”NŒ traceback”ˆŒinput_encoding”Œ utf-8-sig”Œinput_encoding_error_handler”Œstrict”Œoutput_encoding”Œutf-8”Œoutput_encoding_error_handler”jŒerror_encoding”Œutf-8”Œerror_encoding_error_handler”Œbackslashreplace”Œ language_code”Œen”Œrecord_dependencies”NŒconfig”NŒ id_prefix”hŒauto_id_prefix”Œid”Œ dump_settings”NŒdump_internals”NŒdump_transforms”NŒdump_pseudo_xml”NŒexpose_internals”NŒstrict_visitor”NŒ_disable_config”NŒ_source”hÊŒ _destination”NŒ _config_files”]”Œ7/var/lib/git/docbuild/linux/Documentation/docutils.conf”aŒfile_insertion_enabled”ˆŒ raw_enabled”KŒline_length_limit”M'Œpep_references”NŒ pep_base_url”Œhttps://peps.python.org/”Œpep_file_url_template”Œpep-%04d”Œrfc_references”NŒ rfc_base_url”Œ&https://datatracker.ietf.org/doc/html/”Œ tab_width”KŒtrim_footnote_reference_space”‰Œsyntax_highlight”Œlong”Œ smart_quotes”ˆŒsmartquotes_locales”]”Œcharacter_level_inline_markup”‰Œdoctitle_xform”‰Œ docinfo_xform”KŒsectsubtitle_xform”‰Œ image_loading”Œlink”Œembed_stylesheet”‰Œcloak_email_addresses”ˆŒsection_self_link”‰Œenv”NubŒreporter”NŒindirect_targets”]”Œsubstitution_defs”}”Œsubstitution_names”}”Œrefnames”}”Œrefids”}”Œnameids”}”(jÜjÙjsjpj–j“jÔjÑuŒ nametypes”}”(j܉js‰j–‰jÔ‰uh}”(jÙh·jph÷j“jvjÑj™uŒ footnote_refs”}”Œ citation_refs”}”Œ autofootnotes”]”Œautofootnote_refs”]”Œsymbol_footnotes”]”Œsymbol_footnote_refs”]”Œ footnotes”]”Œ citations”]”Œautofootnote_start”KŒsymbol_footnote_start”KŒ id_counter”Œ collections”ŒCounter”“”}”…”R”Œparse_messages”]”Œtransform_messages”]”Œ transformer”NŒ include_log”]”Œ decoration”Nh²hub.