€•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/input/joydev/joystick-api”Œ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/input/joydev/joystick-api”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)�”}”(hhh]”hŒItalian”…”�”}”hhFsbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ-/translations/it_IT/input/joydev/joystick-api”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)�”}”(hhh]”hŒJapanese”…”�”}”hhZsbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ-/translations/ja_JP/input/joydev/joystick-api”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)�”}”(hhh]”hŒKorean”…”�”}”hhnsbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ-/translations/ko_KR/input/joydev/joystick-api”Œ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/input/joydev/joystick-api”Œ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/input/joydev/joystick-api”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubeh}”(h]”h ]”h"]”h$]”h&]”Œcurrent_language”ŒEnglish”uh1h hhŒ _document”hŒsource”NŒline”NubhŒtarget”“”)�”}”(hŒ.. _joystick-api:”h]”h}”(h]”h ]”h"]”h$]”h&]”Œrefid”Œ joystick-api”uh1hµh´Khhh²hh³ŒG/var/lib/git/docbuild/linux/Documentation/input/joydev/joystick-api.rst”ubhŒsection”“”)�”}”(hhh]”(hŒtitle”“”)�”}”(hŒProgramming Interface”h]”hŒProgramming Interface”…”�”}”(hhËh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÉhhÆh²hh³hÃh´KubhŒ field_list”“”)�”}”(hhh]”hŒfield”“”)�”}”(hhh]”(hŒ field_name”“”)�”}”(hŒAuthor”h]”hŒAuthor”…”�”}”(hhåh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hãhhàh³hÃh´KubhŒ field_body”“”)�”}”(hŒ9Ragnar Hojland Espinosa - 7 Aug 1998 ”h]”hŒ paragraph”“”)�”}”(hŒ8Ragnar Hojland Espinosa - 7 Aug 1998”h]”(hŒRagnar Hojland Espinosa <”…”�”}”(hhûh²hh³Nh´NubhŒ reference”“”)�”}”(hŒragnar@macula.net”h]”hŒragnar@macula.net”…”�”}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”Œrefuri”Œmailto:ragnar@macula.net”uh1jhhûubhŒ> - 7 Aug 1998”…”�”}”(hhûh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hùh³hÃh´Khhõubah}”(h]”h ]”h"]”h$]”h&]”uh1hóhhàubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÞh³hÃh´KhhÛh²hubah}”(h]”h ]”h"]”h$]”h&]”uh1hÙhhÆh²hh³hÃh´KubhÅ)�”}”(hhh]”(hÊ)�”}”(hŒ Introduction”h]”hŒ Introduction”…”�”}”(hj4h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÉhj1h²hh³hÃh´K ubhŒ important”“”)�”}”(hŒƒThis document describes legacy ``js`` interface. Newer clients are encouraged to switch to the generic event (``evdev``) interface.”h]”hú)�”}”(hŒƒThis document describes legacy ``js`` interface. Newer clients are encouraged to switch to the generic event (``evdev``) interface.”h]”(hŒThis document describes legacy ”…”�”}”(hjHh²hh³Nh´NubhŒliteral”“”)�”}”(hŒ``js``”h]”hŒjs”…”�”}”(hjRh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jPhjHubhŒI interface. Newer clients are encouraged to switch to the generic event (”…”�”}”(hjHh²hh³Nh´NubjQ)�”}”(hŒ ``evdev``”h]”hŒevdev”…”�”}”(hjdh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jPhjHubhŒ ) interface.”…”�”}”(hjHh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hùh³hÃh´K hjDubah}”(h]”h ]”h"]”h$]”h&]”uh1jBhj1h²hh³hÃh´Nubhú)�”}”(hX�The 1.0 driver uses a new, event based approach to the joystick driver. Instead of the user program polling for the joystick values, the joystick driver now reports only any changes of its state. See joystick-api.txt, joystick.h and jstest.c included in the joystick package for more information. The joystick device can be used in either blocking or nonblocking mode, and supports select() calls.”h]”hX�The 1.0 driver uses a new, event based approach to the joystick driver. Instead of the user program polling for the joystick values, the joystick driver now reports only any changes of its state. See joystick-api.txt, joystick.h and jstest.c included in the joystick package for more information. The joystick device can be used in either blocking or nonblocking mode, and supports select() calls.”…”�”}”(hj‚h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hùh³hÃh´Khj1h²hubhú)�”}”(hXFFor backward compatibility the old (v0.x) interface is still included. Any call to the joystick driver using the old interface will return values that are compatible to the old interface. This interface is still limited to 2 axes, and applications using it usually decode only 2 buttons, although the driver provides up to 32.”h]”hXFFor backward compatibility the old (v0.x) interface is still included. Any call to the joystick driver using the old interface will return values that are compatible to the old interface. This interface is still limited to 2 axes, and applications using it usually decode only 2 buttons, although the driver provides up to 32.”…”�”}”(hj�h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hùh³hÃh´Khj1h²hubeh}”(h]”Œ introduction”ah ]”h"]”Œ introduction”ah$]”h&]”uh1hÄhhÆh²hh³hÃh´K ubhÅ)�”}”(hhh]”(hÊ)�”}”(hŒInitialization”h]”hŒInitialization”…”�”}”(hj©h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÉhj¦h²hh³hÃh´Kubhú)�”}”(hX%Open the joystick device following the usual semantics (that is, with open). Since the driver now reports events instead of polling for changes, immediately after the open it will issue a series of synthetic events (JS_EVENT_INIT) that you can read to obtain the initial state of the joystick.”h]”hX%Open the joystick device following the usual semantics (that is, with open). Since the driver now reports events instead of polling for changes, immediately after the open it will issue a series of synthetic events (JS_EVENT_INIT) that you can read to obtain the initial state of the joystick.”…”�”}”(hj·h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hùh³hÃh´K hj¦h²hubhú)�”}”(hŒ3By default, the device is opened in blocking mode::”h]”hŒ2By default, the device is opened in blocking mode:”…”�”}”(hjÅh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hùh³hÃh´K&hj¦h²hubhŒ literal_block”“”)�”}”(hŒ+int fd = open ("/dev/input/js0", O_RDONLY);”h]”hŒ+int fd = open ("/dev/input/js0", O_RDONLY);”…”�”}”hjÕsbah}”(h]”h ]”h"]”h$]”h&]”Œ xml:space”Œpreserve”uh1jÓh³hÃh´K(hj¦h²hubeh}”(h]”Œinitialization”ah ]”h"]”Œinitialization”ah$]”h&]”uh1hÄhhÆh²hh³hÃh´KubhÅ)�”}”(hhh]”(hÊ)�”}”(hŒ Event Reading”h]”hŒ Event Reading”…”�”}”(hjðh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÉhjíh²hh³hÃh´K,ubjÔ)�”}”(hŒ,struct js_event e; read (fd, &e, sizeof(e));”h]”hŒ,struct js_event e; read (fd, &e, sizeof(e));”…”�”}”hjþsbah}”(h]”h ]”h"]”h$]”h&]”jãjäuh1jÓh³hÃh´K0hjíh²hubhú)�”}”(hŒwhere js_event is defined as::”h]”hŒwhere js_event is defined as:”…”�”}”(hj h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hùh³hÃh´K3hjíh²hubjÔ)�”}”(hŒÐstruct js_event { __u32 time; /* event timestamp in milliseconds */ __s16 value; /* value */ __u8 type; /* event type */ __u8 number; /* axis/button number */ };”h]”hŒÐstruct js_event { __u32 time; /* event timestamp in milliseconds */ __s16 value; /* value */ __u8 type; /* event type */ __u8 number; /* axis/button number */ };”…”�”}”hjsbah}”(h]”h ]”h"]”h$]”h&]”jãjäuh1jÓh³hÃh´K5hjíh²hubhú)�”}”(hŒˆIf the read is successful, it will return sizeof(e), unless you wanted to read more than one event per read as described in section 3.1.”h]”hŒˆIf the read is successful, it will return sizeof(e), unless you wanted to read more than one event per read as described in section 3.1.”…”�”}”(hj(h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hùh³hÃh´K 0) { process_event (e); } /* EAGAIN is returned when the queue is empty */ if (errno != EAGAIN) { /* error */ } /* do something interesting with processed events */ }”h]”hX$while (1) { while (read (fd, &e, sizeof(e)) > 0) { process_event (e); } /* EAGAIN is returned when the queue is empty */ if (errno != EAGAIN) { /* error */ } /* do something interesting with processed events */ }”…”�”}”hjsbah}”(h]”h ]”h"]”h$]”h&]”jãjäuh1jÓh³hÃh´K°hjèh²hubhú)�”}”(hŒ—One reason for emptying the queue is that if it gets full you'll start missing events since the queue is finite, and older events will get overwritten.”h]”hŒ™One reason for emptying the queue is that if it gets full you’ll start missing events since the queue is finite, and older events will get overwritten.”…”�”}”(hj#h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hùh³hÃh´K»hjèh²hubhú)�”}”(hŒeThe other reason is that you want to know all that happened, and not delay the processing till later.”h]”hŒeThe other reason is that you want to know all that happened, and not delay the processing till later.”…”�”}”(hj1h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hùh³hÃh´K¿hjèh²hubhú)�”}”(hXWhy can the queue get full? Because you don't empty the queue as mentioned, or because too much time elapses from one read to another and too many events to store in the queue get generated. Note that high system load may contribute to space those reads even more.”h]”hX Why can the queue get full? Because you don’t empty the queue as mentioned, or because too much time elapses from one read to another and too many events to store in the queue get generated. Note that high system load may contribute to space those reads even more.”…”�”}”(hj?h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hùh³hÃh´KÂhjèh²hubhú)�”}”(hŒìIf time between reads is enough to fill the queue and lose an event, the driver will switch to startup mode and next time you read it, synthetic events (JS_EVENT_INIT) will be generated to inform you of the actual state of the joystick.”h]”hŒìIf time between reads is enough to fill the queue and lose an event, the driver will switch to startup mode and next time you read it, synthetic events (JS_EVENT_INIT) will be generated to inform you of the actual state of the joystick.”…”�”}”(hjMh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hùh³hÃh´KÇhjèh²hubhŒnote”“”)�”}”(hŒ¤As of version 1.2.8, the queue is circular and able to hold 64 events. You can increment this size bumping up JS_BUFF_SIZE in joystick.h and recompiling the driver.”h]”hú)�”}”(hŒ¤As of version 1.2.8, the queue is circular and able to hold 64 events. You can increment this size bumping up JS_BUFF_SIZE in joystick.h and recompiling the driver.”h]”hŒ¤As of version 1.2.8, the queue is circular and able to hold 64 events. You can increment this size bumping up JS_BUFF_SIZE in joystick.h and recompiling the driver.”…”�”}”(hjah²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hùh³hÃh´KÏhj]ubah}”(h]”h ]”h"]”h$]”h&]”uh1j[hjèh²hh³hÃh´Nubhú)�”}”(hŒ¹In the above code, you might as well want to read more than one event at a time using the typical read(2) functionality. For that, you would replace the read above with something like::”h]”hŒ¸In the above code, you might as well want to read more than one event at a time using the typical read(2) functionality. For that, you would replace the read above with something like:”…”�”}”(hjuh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hùh³hÃh´KÔhjèh²hubjÔ)�”}”(hŒNstruct js_event mybuffer[0xff]; int i = read (fd, mybuffer, sizeof(mybuffer));”h]”hŒNstruct js_event mybuffer[0xff]; int i = read (fd, mybuffer, sizeof(mybuffer));”…”�”}”hjƒsbah}”(h]”h ]”h"]”h$]”h&]”jãjäuh1jÓh³hÃh´KØhjèh²hubhú)�”}”(hX In this case, read would return -1 if the queue was empty, or some other value in which the number of events read would be i / sizeof(js_event) Again, if the buffer was full, it's a good idea to process the events and keep reading it until you empty the driver queue.”h]”hXIn this case, read would return -1 if the queue was empty, or some other value in which the number of events read would be i / sizeof(js_event) Again, if the buffer was full, it’s a good idea to process the events and keep reading it until you empty the driver queue.”…”�”}”(hj‘h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hùh³hÃh´KÛhjèh²hubeh}”(h]”Œ o-nonblock”ah ]”h"]”Œ o_nonblock”ah$]”h&]”uh1hÄhj}h²hh³hÃh´K¥ubeh}”(h]”Œreading”ah ]”h"]”Œreading”ah$]”h&]”uh1hÄhhÆh²hh³hÃh´K–ubhÅ)�”}”(hhh]”(hÊ)�”}”(hŒIOCTLs”h]”hŒIOCTLs”…”�”}”(hj²h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÉhj¯h²hh³hÃh´Kâubhú)�”}”(hŒ?The joystick driver defines the following ioctl(2) operations::”h]”hŒ>The joystick driver defines the following ioctl(2) operations:”…”�”}”(hjÀh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hùh³hÃh´Kähj¯h²hubjÔ)�”}”(hXÛ /* function 3rd arg */ #define JSIOCGAXES /* get number of axes char */ #define JSIOCGBUTTONS /* get number of buttons char */ #define JSIOCGVERSION /* get driver version int */ #define JSIOCGNAME(len) /* get identifier string char */ #define JSIOCSCORR /* set correction values &js_corr */ #define JSIOCGCORR /* get correction values &js_corr */”h]”hXÛ /* function 3rd arg */ #define JSIOCGAXES /* get number of axes char */ #define JSIOCGBUTTONS /* get number of buttons char */ #define JSIOCGVERSION /* get driver version int */ #define JSIOCGNAME(len) /* get identifier string char */ #define JSIOCSCORR /* set correction values &js_corr */ #define JSIOCGCORR /* get correction values &js_corr */”…”�”}”hjÎsbah}”(h]”h ]”h"]”h$]”h&]”jãjäuh1jÓh³hÃh´Kæhj¯h²hubhú)�”}”(hŒ)For example, to read the number of axes::”h]”hŒ(For example, to read the number of axes:”…”�”}”(hjÜh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hùh³hÃh´Kîhj¯h²hubjÔ)�”}”(hŒ=char number_of_axes; ioctl (fd, JSIOCGAXES, &number_of_axes);”h]”hŒ=char number_of_axes; ioctl (fd, JSIOCGAXES, &number_of_axes);”…”�”}”hjêsbah}”(h]”h ]”h"]”h$]”h&]”jãjäuh1jÓh³hÃh´Kðhj¯h²hubhÅ)�”}”(hhh]”(hÊ)�”}”(hŒ JSIOGCVERSION”h]”hŒ JSIOGCVERSION”…”�”}”(hjûh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÉhjøh²hh³hÃh´Kõubhú)�”}”(hŒÚJSIOGCVERSION is a good way to check in run-time whether the running driver is 1.0+ and supports the event interface. If it is not, the IOCTL will fail. For a compile-time decision, you can test the JS_VERSION symbol::”h]”hŒÙJSIOGCVERSION is a good way to check in run-time whether the running driver is 1.0+ and supports the event interface. If it is not, the IOCTL will fail. For a compile-time decision, you can test the JS_VERSION symbol:”…”�”}”(hj h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hùh³hÃh´K÷hjøh²hubjÔ)�”}”(hŒ.#ifdef JS_VERSION #if JS_VERSION > 0xsomething”h]”hŒ.#ifdef JS_VERSION #if JS_VERSION > 0xsomething”…”�”}”hjsbah}”(h]”h ]”h"]”h$]”h&]”jãjäuh1jÓh³hÃh´Kühjøh²hubeh}”(h]”Œ jsiogcversion”ah ]”h"]”Œ jsiogcversion”ah$]”h&]”uh1hÄhj¯h²hh³hÃh´KõubhÅ)�”}”(hhh]”(hÊ)�”}”(hŒ JSIOCGNAME”h]”hŒ JSIOCGNAME”…”�”}”(hj0h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÉhj-h²hh³hÃh´Mubhú)�”}”(hXJSIOCGNAME(len) allows you to get the name string of the joystick - the same as is being printed at boot time. The 'len' argument is the length of the buffer provided by the application asking for the name. It is used to avoid possible overrun should the name be too long::”h]”hXJSIOCGNAME(len) allows you to get the name string of the joystick - the same as is being printed at boot time. The ‘len’ argument is the length of the buffer provided by the application asking for the name. It is used to avoid possible overrun should the name be too long:”…”�”}”(hj>h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hùh³hÃh´Mhj-h²hubjÔ)�”}”(hŒŽchar name[128]; if (ioctl(fd, JSIOCGNAME(sizeof(name)), name) < 0) strscpy(name, "Unknown", sizeof(name)); printf("Name: %s\n", name);”h]”hŒŽchar name[128]; if (ioctl(fd, JSIOCGNAME(sizeof(name)), name) < 0) strscpy(name, "Unknown", sizeof(name)); printf("Name: %s\n", name);”…”�”}”hjLsbah}”(h]”h ]”h"]”h$]”h&]”jãjäuh1jÓh³hÃh´Mhj-h²hubeh}”(h]”Œ jsiocgname”ah ]”h"]”Œ jsiocgname”ah$]”h&]”uh1hÄhj¯h²hh³hÃh´MubhÅ)�”}”(hhh]”(hÊ)�”}”(hŒ JSIOC[SG]CORR”h]”hŒ JSIOC[SG]CORR”…”�”}”(hjeh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÉhjbh²hh³hÃh´Mubhú)�”}”(hXGFor usage on JSIOC[SG]CORR I suggest you to look into jscal.c They are not needed in a normal program, only in joystick calibration software such as jscal or kcmjoy. These IOCTLs and data types aren't considered to be in the stable part of the API, and therefore may change without warning in following releases of the driver.”h]”hXIFor usage on JSIOC[SG]CORR I suggest you to look into jscal.c They are not needed in a normal program, only in joystick calibration software such as jscal or kcmjoy. These IOCTLs and data types aren’t considered to be in the stable part of the API, and therefore may change without warning in following releases of the driver.”…”�”}”(hjsh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hùh³hÃh´Mhjbh²hubhú)�”}”(hŒƒBoth JSIOCSCORR and JSIOCGCORR expect &js_corr to be able to hold information for all axes. That is, struct js_corr corr[MAX_AXIS];”h]”hŒƒBoth JSIOCSCORR and JSIOCGCORR expect &js_corr to be able to hold information for all axes. That is, struct js_corr corr[MAX_AXIS];”…”�”}”(hj�h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hùh³hÃh´Mhjbh²hubhú)�”}”(hŒstruct js_corr is defined as::”h]”hŒstruct js_corr is defined as:”…”�”}”(hj�h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hùh³hÃh´Mhjbh²hubjÔ)�”}”(hŒRstruct js_corr { __s32 coef[8]; __u16 prec; __u16 type; };”h]”hŒRstruct js_corr { __s32 coef[8]; __u16 prec; __u16 type; };”…”�”}”hj�sbah}”(h]”h ]”h"]”h$]”h&]”jãjäuh1jÓh³hÃh´Mhjbh²hubhú)�”}”(hŒand ``type``::”h]”(hŒand ”…”�”}”(hj«h²hh³Nh´NubjQ)�”}”(hŒ``type``”h]”hŒtype”…”�”}”(hj³h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jPhj«ubhŒ:”…”�”}”(hj«h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hùh³hÃh´M"hjbh²hubjÔ)�”}”(hŒz#define JS_CORR_NONE 0x00 /* returns raw values */ #define JS_CORR_BROKEN 0x01 /* broken line */”h]”hŒz#define JS_CORR_NONE 0x00 /* returns raw values */ #define JS_CORR_BROKEN 0x01 /* broken line */”…”�”}”hjËsbah}”(h]”h ]”h"]”h$]”h&]”jãjäuh1jÓh³hÃh´M$hjbh²hubeh}”(h]”Œ jsioc-sg-corr”ah ]”h"]”Œ jsioc[sg]corr”ah$]”h&]”uh1hÄhj¯h²hh³hÃh´Mubeh}”(h]”Œioctls”ah ]”h"]”Œioctls”ah$]”h&]”uh1hÄhhÆh²hh³hÃh´KâubhÅ)�”}”(hhh]”(hÊ)�”}”(hŒBackward compatibility”h]”hŒBackward compatibility”…”�”}”(hjìh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÉhjéh²hh³hÃh´M)ubhú)�”}”(hŒ”The 0.x joystick driver API is quite limited and its usage is deprecated. The driver offers backward compatibility, though. Here's a quick summary::”h]”hŒ•The 0.x joystick driver API is quite limited and its usage is deprecated. The driver offers backward compatibility, though. Here’s a quick summary:”…”�”}”(hjúh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hùh³hÃh´M+hjéh²hubjÔ)�”}”(hŒ˜struct JS_DATA_TYPE js; while (1) { if (read (fd, &js, JS_RETURN) != JS_RETURN) { /* error */ } usleep (1000); }”h]”hŒ˜struct JS_DATA_TYPE js; while (1) { if (read (fd, &js, JS_RETURN) != JS_RETURN) { /* error */ } usleep (1000); }”…”�”}”hjsbah}”(h]”h ]”h"]”h$]”h&]”jãjäuh1jÓh³hÃh´M.hjéh²hubhú)�”}”(hŒmAs you can figure out from the example, the read returns immediately, with the actual state of the joystick::”h]”hŒlAs you can figure out from the example, the read returns immediately, with the actual state of the joystick:”…”�”}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hùh³hÃh´M6hjéh²hubjÔ)�”}”(hŒ·struct JS_DATA_TYPE { int buttons; /* immediate button state */ int x; /* immediate x axis value */ int y; /* immediate y axis value */ };”h]”hŒ·struct JS_DATA_TYPE { int buttons; /* immediate button state */ int x; /* immediate x axis value */ int y; /* immediate y axis value */ };”…”�”}”hj$sbah}”(h]”h ]”h"]”h$]”h&]”jãjäuh1jÓh³hÃh´M9hjéh²hubhú)�”}”(hŒand JS_RETURN is defined as::”h]”hŒand JS_RETURN is defined as:”…”�”}”(hj2h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hùh³hÃh´M?hjéh²hubjÔ)�”}”(hŒ3#define JS_RETURN sizeof(struct JS_DATA_TYPE)”h]”hŒ3#define JS_RETURN sizeof(struct JS_DATA_TYPE)”…”�”}”hj@sbah}”(h]”h ]”h"]”h$]”h&]”jãjäuh1jÓh³hÃh´MAhjéh²hubhú)�”}”(hŒ!To test the state of the buttons,”h]”hŒ!To test the state of the buttons,”…”�”}”(hjNh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hùh³hÃh´MChjéh²hubjÔ)�”}”(hŒKfirst_button_state = js.buttons & 1; second_button_state = js.buttons & 2;”h]”hŒKfirst_button_state = js.buttons & 1; second_button_state = js.buttons & 2;”…”�”}”hj\sbah}”(h]”h ]”h"]”h$]”h&]”jãjäuh1jÓh³hÃh´MGhjéh²hubhú)�”}”(hŒëThe axis values do not have a defined range in the original 0.x driver, except that the values are non-negative. The 1.2.8+ drivers use a fixed range for reporting the values, 1 being the minimum, 128 the center, and 255 maximum value.”h]”hŒëThe axis values do not have a defined range in the original 0.x driver, except that the values are non-negative. The 1.2.8+ drivers use a fixed range for reporting the values, 1 being the minimum, 128 the center, and 255 maximum value.”…”�”}”(hjjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hùh³hÃh´MJhjéh²hubhú)�”}”(hŒÄThe v0.8.0.2 driver also had an interface for 'digital joysticks', (now called Multisystem joysticks in this driver), under /dev/djsX. This driver doesn't try to be compatible with that interface.”h]”hŒÊThe v0.8.0.2 driver also had an interface for ‘digital joysticks’, (now called Multisystem joysticks in this driver), under /dev/djsX. This driver doesn’t try to be compatible with that interface.”…”�”}”(hjxh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hùh³hÃh´MOhjéh²hubeh}”(h]”Œbackward-compatibility”ah ]”h"]”Œbackward compatibility”ah$]”h&]”uh1hÄhhÆh²hh³hÃh´M)ubhÅ)�”}”(hhh]”(hÊ)�”}”(hŒ Final Notes”h]”hŒ Final Notes”…”�”}”(hj‘h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÉhjŽh²hh³hÃh´MUubjÔ)�”}”(hX-____/| Comments, additions, and specially corrections are welcome. \ o.O| Documentation valid for at least version 1.2.8 of the joystick =(_)= driver and as usual, the ultimate source for documentation is U to "Use The Source Luke" or, at your convenience, Vojtech ;)”h]”hX-____/| Comments, additions, and specially corrections are welcome. \ o.O| Documentation valid for at least version 1.2.8 of the joystick =(_)= driver and as usual, the ultimate source for documentation is U to "Use The Source Luke" or, at your convenience, Vojtech ;)”…”�”}”hjŸsbah}”(h]”h ]”h"]”h$]”h&]”jãjäuh1jÓh³hÃh´MYhjŽh²hubeh}”(h]”Œ final-notes”ah ]”h"]”Œ final notes”ah$]”h&]”uh1hÄhhÆh²hh³hÃh´MUubeh}”(h]”(Œprogramming-interface”hÂeh ]”h"]”(Œprogramming interface”Œ joystick-api”eh$]”h&]”uh1hÄhhh²hh³hÃh´KŒexpect_referenced_by_name”}”j»h·sŒexpect_referenced_by_id”}”hÂh·subeh}”(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”jŒ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”}”hÂ]”h·asŒnameids”}”(j»hÂjºj·j£j jêjçjzjwj²j¯jˆj…j9j6jrjoj¬j©j¤j¡jæjãj*j'j_j\jÞjÛj‹jˆj²j¯uŒ nametypes”}”(j»ˆjº‰j£‰jê‰jz‰j²‰jˆ‰j9‰jr‰j¬‰j¤‰jæ‰j*‰j_‰jÞ‰j‹‰j²‰uh}”(hÂhÆj·hÆj j1jçj¦jwjíj¯j6j…jµj6j‹joj<j©j}j¡jèjãj¯j'jøj\j-jÛjbjˆjéj¯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”]”hŒsystem_message”“”)�”}”(hhh]”hú)�”}”(hhh]”hŒ2Hyperlink target "joystick-api" is not referenced.”…”�”}”hjN sbah}”(h]”h ]”h"]”h$]”h&]”uh1hùhjK ubah}”(h]”h ]”h"]”h$]”h&]”Œlevel”KŒtype”ŒINFO”Œsource”hÃŒline”Kuh1jI ubaŒ transformer”NŒ include_log”]”Œ decoration”Nh²hub.