├── .gitattributes ├── Android.mk ├── MODULE_LICENSE_BSD ├── NOTICE ├── README.md ├── build.sh ├── keycheck.c └── keycheck.h /.gitattributes: -------------------------------------------------------------------------------- 1 | # Declare files that will always have LF line endings on checkout. 2 | * eol=lf -------------------------------------------------------------------------------- /Android.mk: -------------------------------------------------------------------------------- 1 | LOCAL_PATH := $(call my-dir) 2 | 3 | include $(CLEAR_VARS) 4 | 5 | LOCAL_SRC_FILES := keycheck.c 6 | LOCAL_MODULE := keycheck 7 | LOCAL_MODULE_CLASS := RECOVERY_EXECUTABLES 8 | LOCAL_MODULE_PATH := $(PRODUCT_OUT)/utilities 9 | LOCAL_STATIC_LIBRARIES := libc 10 | LOCAL_FORCE_STATIC_EXECUTABLE := true 11 | LOCAL_PACK_MODULE_RELOCATIONS := false 12 | APP_ALLOW_MISSING_DEPS := true 13 | LOCAL_LDFLAGS += -static 14 | 15 | include $(BUILD_EXECUTABLE) 16 | -------------------------------------------------------------------------------- /MODULE_LICENSE_BSD: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Zackptg5/Keycheck/079a4113eeced713d1587fb275f4453e9b2ba498/MODULE_LICENSE_BSD -------------------------------------------------------------------------------- /NOTICE: -------------------------------------------------------------------------------- 1 | Copyright (C) 2010 The Android Open Source Project 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | 15 | ------------------------------------------------------------------- 16 | 17 | Copyright (C) 2014, The Android Open Source Project 18 | All rights reserved. 19 | 20 | Redistribution and use in source and binary forms, with or without 21 | modification, are permitted provided that the following conditions 22 | are met: 23 | * Redistributions of source code must retain the above copyright 24 | notice, this list of conditions and the following disclaimer. 25 | * Redistributions in binary form must reproduce the above copyright 26 | notice, this list of conditions and the following disclaimer in 27 | the documentation and/or other materials provided with the 28 | distribution. 29 | 30 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 31 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 32 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 33 | FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 34 | COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 35 | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 36 | BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS 37 | OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 38 | AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 39 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 40 | OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 41 | SUCH DAMAGE. 42 | 43 | ------------------------------------------------------------------- 44 | 45 | Copyright (c) 1987, 1993 46 | The Regents of the University of California. All rights reserved. 47 | 48 | Redistribution and use in source and binary forms, with or without 49 | modification, are permitted provided that the following conditions 50 | are met: 51 | 1. Redistributions of source code must retain the above copyright 52 | notice, this list of conditions and the following disclaimer. 53 | 2. Redistributions in binary form must reproduce the above copyright 54 | notice, this list of conditions and the following disclaimer in the 55 | documentation and/or other materials provided with the distribution. 56 | 3. Neither the name of the University nor the names of its contributors 57 | may be used to endorse or promote products derived from this software 58 | without specific prior written permission. 59 | 60 | THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 61 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 62 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 63 | ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 64 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 65 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 66 | OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 67 | HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 68 | LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 69 | OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 70 | SUCH DAMAGE. 71 | 72 | ------------------------------------------------------------------- 73 | 74 | Copyright (c) 1987, 1993, 1994 75 | The Regents of the University of California. All rights reserved. 76 | 77 | Redistribution and use in source and binary forms, with or without 78 | modification, are permitted provided that the following conditions 79 | are met: 80 | 1. Redistributions of source code must retain the above copyright 81 | notice, this list of conditions and the following disclaimer. 82 | 2. Redistributions in binary form must reproduce the above copyright 83 | notice, this list of conditions and the following disclaimer in the 84 | documentation and/or other materials provided with the distribution. 85 | 3. Neither the name of the University nor the names of its contributors 86 | may be used to endorse or promote products derived from this software 87 | without specific prior written permission. 88 | 89 | THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 90 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 91 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 92 | ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 93 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 94 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 95 | OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 96 | HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 97 | LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 98 | OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 99 | SUCH DAMAGE. 100 | 101 | ------------------------------------------------------------------- 102 | 103 | Copyright (c) 1988, 1993 104 | The Regents of the University of California. All rights reserved. 105 | 106 | This code is derived from software contributed to Berkeley by 107 | Jeffrey Mogul. 108 | 109 | Redistribution and use in source and binary forms, with or without 110 | modification, are permitted provided that the following conditions 111 | are met: 112 | 1. Redistributions of source code must retain the above copyright 113 | notice, this list of conditions and the following disclaimer. 114 | 2. Redistributions in binary form must reproduce the above copyright 115 | notice, this list of conditions and the following disclaimer in the 116 | documentation and/or other materials provided with the distribution. 117 | 3. Neither the name of the University nor the names of its contributors 118 | may be used to endorse or promote products derived from this software 119 | without specific prior written permission. 120 | 121 | THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 122 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 123 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 124 | ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 125 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 126 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 127 | OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 128 | HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 129 | LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 130 | OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 131 | SUCH DAMAGE. 132 | 133 | ------------------------------------------------------------------- 134 | 135 | Copyright (c) 1988, 1993, 1994 136 | The Regents of the University of California. All rights reserved. 137 | 138 | Redistribution and use in source and binary forms, with or without 139 | modification, are permitted provided that the following conditions 140 | are met: 141 | 1. Redistributions of source code must retain the above copyright 142 | notice, this list of conditions and the following disclaimer. 143 | 2. Redistributions in binary form must reproduce the above copyright 144 | notice, this list of conditions and the following disclaimer in the 145 | documentation and/or other materials provided with the distribution. 146 | 3. Neither the name of the University nor the names of its contributors 147 | may be used to endorse or promote products derived from this software 148 | without specific prior written permission. 149 | 150 | THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 151 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 152 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 153 | ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 154 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 155 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 156 | OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 157 | HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 158 | LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 159 | OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 160 | SUCH DAMAGE. 161 | 162 | ------------------------------------------------------------------- 163 | 164 | Copyright (c) 1988, 1993, 1994 165 | The Regents of the University of California. All rights reserved. 166 | 167 | This code is derived from software contributed to Berkeley by 168 | David Hitz of Auspex Systems Inc. 169 | 170 | Redistribution and use in source and binary forms, with or without 171 | modification, are permitted provided that the following conditions 172 | are met: 173 | 1. Redistributions of source code must retain the above copyright 174 | notice, this list of conditions and the following disclaimer. 175 | 2. Redistributions in binary form must reproduce the above copyright 176 | notice, this list of conditions and the following disclaimer in the 177 | documentation and/or other materials provided with the distribution. 178 | 3. Neither the name of the University nor the names of its contributors 179 | may be used to endorse or promote products derived from this software 180 | without specific prior written permission. 181 | 182 | THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 183 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 184 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 185 | ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 186 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 187 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 188 | OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 189 | HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 190 | LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 191 | OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 192 | SUCH DAMAGE. 193 | 194 | ------------------------------------------------------------------- 195 | 196 | Copyright (c) 1988, 1993, 1994, 2003 197 | The Regents of the University of California. All rights reserved. 198 | 199 | Redistribution and use in source and binary forms, with or without 200 | modification, are permitted provided that the following conditions 201 | are met: 202 | 1. Redistributions of source code must retain the above copyright 203 | notice, this list of conditions and the following disclaimer. 204 | 2. Redistributions in binary form must reproduce the above copyright 205 | notice, this list of conditions and the following disclaimer in the 206 | documentation and/or other materials provided with the distribution. 207 | 3. Neither the name of the University nor the names of its contributors 208 | may be used to endorse or promote products derived from this software 209 | without specific prior written permission. 210 | 211 | THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 212 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 213 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 214 | ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 215 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 216 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 217 | OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 218 | HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 219 | LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 220 | OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 221 | SUCH DAMAGE. 222 | 223 | ------------------------------------------------------------------- 224 | 225 | Copyright (c) 1989, 1993 226 | The Regents of the University of California. All rights reserved. 227 | 228 | Redistribution and use in source and binary forms, with or without 229 | modification, are permitted provided that the following conditions 230 | are met: 231 | 1. Redistributions of source code must retain the above copyright 232 | notice, this list of conditions and the following disclaimer. 233 | 2. Redistributions in binary form must reproduce the above copyright 234 | notice, this list of conditions and the following disclaimer in the 235 | documentation and/or other materials provided with the distribution. 236 | 3. Neither the name of the University nor the names of its contributors 237 | may be used to endorse or promote products derived from this software 238 | without specific prior written permission. 239 | 240 | THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 241 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 242 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 243 | ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 244 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 245 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 246 | OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 247 | HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 248 | LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 249 | OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 250 | SUCH DAMAGE. 251 | 252 | ------------------------------------------------------------------- 253 | 254 | Copyright (c) 1989, 1993 255 | The Regents of the University of California. All rights reserved. 256 | 257 | This code is derived from software contributed to Berkeley by 258 | Kevin Fall. 259 | 260 | Redistribution and use in source and binary forms, with or without 261 | modification, are permitted provided that the following conditions 262 | are met: 263 | 1. Redistributions of source code must retain the above copyright 264 | notice, this list of conditions and the following disclaimer. 265 | 2. Redistributions in binary form must reproduce the above copyright 266 | notice, this list of conditions and the following disclaimer in the 267 | documentation and/or other materials provided with the distribution. 268 | 3. Neither the name of the University nor the names of its contributors 269 | may be used to endorse or promote products derived from this software 270 | without specific prior written permission. 271 | 272 | THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 273 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 274 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 275 | ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 276 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 277 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 278 | OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 279 | HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 280 | LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 281 | OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 282 | SUCH DAMAGE. 283 | 284 | ------------------------------------------------------------------- 285 | 286 | Copyright (c) 1989, 1993, 1994 287 | The Regents of the University of California. All rights reserved. 288 | 289 | This code is derived from software contributed to Berkeley by 290 | Chris Newcomb. 291 | 292 | Redistribution and use in source and binary forms, with or without 293 | modification, are permitted provided that the following conditions 294 | are met: 295 | 1. Redistributions of source code must retain the above copyright 296 | notice, this list of conditions and the following disclaimer. 297 | 2. Redistributions in binary form must reproduce the above copyright 298 | notice, this list of conditions and the following disclaimer in the 299 | documentation and/or other materials provided with the distribution. 300 | 3. Neither the name of the University nor the names of its contributors 301 | may be used to endorse or promote products derived from this software 302 | without specific prior written permission. 303 | 304 | THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 305 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 306 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 307 | ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 308 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 309 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 310 | OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 311 | HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 312 | LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 313 | OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 314 | SUCH DAMAGE. 315 | 316 | ------------------------------------------------------------------- 317 | 318 | Copyright (c) 1989, 1993, 1994 319 | The Regents of the University of California. All rights reserved. 320 | 321 | This code is derived from software contributed to Berkeley by 322 | Ken Smith of The State University of New York at Buffalo. 323 | 324 | Redistribution and use in source and binary forms, with or without 325 | modification, are permitted provided that the following conditions 326 | are met: 327 | 1. Redistributions of source code must retain the above copyright 328 | notice, this list of conditions and the following disclaimer. 329 | 2. Redistributions in binary form must reproduce the above copyright 330 | notice, this list of conditions and the following disclaimer in the 331 | documentation and/or other materials provided with the distribution. 332 | 3. Neither the name of the University nor the names of its contributors 333 | may be used to endorse or promote products derived from this software 334 | without specific prior written permission. 335 | 336 | THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 337 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 338 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 339 | ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 340 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 341 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 342 | OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 343 | HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 344 | LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 345 | OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 346 | SUCH DAMAGE. 347 | 348 | ------------------------------------------------------------------- 349 | 350 | Copyright (c) 1990, 1993, 1994, 2003 351 | The Regents of the University of California. All rights reserved. 352 | 353 | Redistribution and use in source and binary forms, with or without 354 | modification, are permitted provided that the following conditions 355 | are met: 356 | 1. Redistributions of source code must retain the above copyright 357 | notice, this list of conditions and the following disclaimer. 358 | 2. Redistributions in binary form must reproduce the above copyright 359 | notice, this list of conditions and the following disclaimer in the 360 | documentation and/or other materials provided with the distribution. 361 | 3. Neither the name of the University nor the names of its contributors 362 | may be used to endorse or promote products derived from this software 363 | without specific prior written permission. 364 | 365 | THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 366 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 367 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 368 | ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 369 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 370 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 371 | OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 372 | HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 373 | LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 374 | OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 375 | SUCH DAMAGE. 376 | 377 | ------------------------------------------------------------------- 378 | 379 | Copyright (c) 1991, 1993 380 | The Regents of the University of California. All rights reserved. 381 | 382 | Redistribution and use in source and binary forms, with or without 383 | modification, are permitted provided that the following conditions 384 | are met: 385 | 1. Redistributions of source code must retain the above copyright 386 | notice, this list of conditions and the following disclaimer. 387 | 2. Redistributions in binary form must reproduce the above copyright 388 | notice, this list of conditions and the following disclaimer in the 389 | documentation and/or other materials provided with the distribution. 390 | 3. Neither the name of the University nor the names of its contributors 391 | may be used to endorse or promote products derived from this software 392 | without specific prior written permission. 393 | 394 | THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 395 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 396 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 397 | ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 398 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 399 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 400 | OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 401 | HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 402 | LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 403 | OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 404 | SUCH DAMAGE. 405 | 406 | ------------------------------------------------------------------- 407 | 408 | Copyright (c) 1991, 1993, 1994 409 | The Regents of the University of California. All rights reserved. 410 | 411 | Redistribution and use in source and binary forms, with or without 412 | modification, are permitted provided that the following conditions 413 | are met: 414 | 1. Redistributions of source code must retain the above copyright 415 | notice, this list of conditions and the following disclaimer. 416 | 2. Redistributions in binary form must reproduce the above copyright 417 | notice, this list of conditions and the following disclaimer in the 418 | documentation and/or other materials provided with the distribution. 419 | 3. Neither the name of the University nor the names of its contributors 420 | may be used to endorse or promote products derived from this software 421 | without specific prior written permission. 422 | 423 | THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 424 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 425 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 426 | ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 427 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 428 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 429 | OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 430 | HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 431 | LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 432 | OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 433 | SUCH DAMAGE. 434 | 435 | ------------------------------------------------------------------- 436 | 437 | Copyright (c) 1991, 1993, 1994 438 | The Regents of the University of California. All rights reserved. 439 | 440 | This code is derived from software contributed to Berkeley by 441 | Keith Muller of the University of California, San Diego and Lance 442 | Visser of Convex Computer Corporation. 443 | 444 | Redistribution and use in source and binary forms, with or without 445 | modification, are permitted provided that the following conditions 446 | are met: 447 | 1. Redistributions of source code must retain the above copyright 448 | notice, this list of conditions and the following disclaimer. 449 | 2. Redistributions in binary form must reproduce the above copyright 450 | notice, this list of conditions and the following disclaimer in the 451 | documentation and/or other materials provided with the distribution. 452 | 3. Neither the name of the University nor the names of its contributors 453 | may be used to endorse or promote products derived from this software 454 | without specific prior written permission. 455 | 456 | THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 457 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 458 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 459 | ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 460 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 461 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 462 | OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 463 | HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 464 | LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 465 | OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 466 | SUCH DAMAGE. 467 | 468 | ------------------------------------------------------------------- 469 | 470 | Copyright (c) 1992, 1993, 1994 471 | The Regents of the University of California. All rights reserved. 472 | 473 | Redistribution and use in source and binary forms, with or without 474 | modification, are permitted provided that the following conditions 475 | are met: 476 | 1. Redistributions of source code must retain the above copyright 477 | notice, this list of conditions and the following disclaimer. 478 | 2. Redistributions in binary form must reproduce the above copyright 479 | notice, this list of conditions and the following disclaimer in the 480 | documentation and/or other materials provided with the distribution. 481 | 3. Neither the name of the University nor the names of its contributors 482 | may be used to endorse or promote products derived from this software 483 | without specific prior written permission. 484 | 485 | THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 486 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 487 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 488 | ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 489 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 490 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 491 | OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 492 | HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 493 | LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 494 | OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 495 | SUCH DAMAGE. 496 | 497 | ------------------------------------------------------------------- 498 | 499 | Copyright (c) 1997, 1998, 1999, 2002 The NetBSD Foundation, Inc. 500 | All rights reserved. 501 | 502 | This code is derived from software contributed to The NetBSD Foundation 503 | by Jason R. Thorpe of the Numerical Aerospace Simulation Facility, 504 | NASA Ames Research Center, by Luke Mewburn and by Tomas Svensson. 505 | 506 | Redistribution and use in source and binary forms, with or without 507 | modification, are permitted provided that the following conditions 508 | are met: 509 | 1. Redistributions of source code must retain the above copyright 510 | notice, this list of conditions and the following disclaimer. 511 | 2. Redistributions in binary form must reproduce the above copyright 512 | notice, this list of conditions and the following disclaimer in the 513 | documentation and/or other materials provided with the distribution. 514 | 515 | THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 516 | ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 517 | TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 518 | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 519 | BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 520 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 521 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 522 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 523 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 524 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 525 | POSSIBILITY OF SUCH DAMAGE. 526 | 527 | ------------------------------------------------------------------- 528 | 529 | Copyright (c) 1998 Robert Nordier 530 | All rights reserved. 531 | 532 | Redistribution and use in source and binary forms, with or without 533 | modification, are permitted provided that the following conditions 534 | are met: 535 | 1. Redistributions of source code must retain the above copyright 536 | notice, this list of conditions and the following disclaimer. 537 | 2. Redistributions in binary form must reproduce the above copyright 538 | notice, this list of conditions and the following disclaimer in 539 | the documentation and/or other materials provided with the 540 | distribution. 541 | 542 | THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS 543 | OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 544 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 545 | ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY 546 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 547 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 548 | GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 549 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 550 | IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 551 | OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN 552 | IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 553 | 554 | ------------------------------------------------------------------- 555 | 556 | Copyright (c) 1999 James Howard and Dag-Erling Coïdan Smørgrav 557 | All rights reserved. 558 | 559 | Redistribution and use in source and binary forms, with or without 560 | modification, are permitted provided that the following conditions 561 | are met: 562 | 1. Redistributions of source code must retain the above copyright 563 | notice, this list of conditions and the following disclaimer. 564 | 2. Redistributions in binary form must reproduce the above copyright 565 | notice, this list of conditions and the following disclaimer in the 566 | documentation and/or other materials provided with the distribution. 567 | 568 | THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 569 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 570 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 571 | ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 572 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 573 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 574 | OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 575 | HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 576 | LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 577 | OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 578 | SUCH DAMAGE. 579 | 580 | ------------------------------------------------------------------- 581 | 582 | Copyright (c) 1999 James Howard and Dag-Erling Coïdan Smørgrav 583 | Copyright (C) 2008 Gabor Kovesdan 584 | All rights reserved. 585 | 586 | Redistribution and use in source and binary forms, with or without 587 | modification, are permitted provided that the following conditions 588 | are met: 589 | 1. Redistributions of source code must retain the above copyright 590 | notice, this list of conditions and the following disclaimer. 591 | 2. Redistributions in binary form must reproduce the above copyright 592 | notice, this list of conditions and the following disclaimer in the 593 | documentation and/or other materials provided with the distribution. 594 | 595 | THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 596 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 597 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 598 | ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 599 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 600 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 601 | OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 602 | HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 603 | LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 604 | OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 605 | SUCH DAMAGE. 606 | 607 | ------------------------------------------------------------------- 608 | 609 | Copyright (c) 1999 James Howard and Dag-Erling Coïdan Smørgrav 610 | Copyright (C) 2008-2009 Gabor Kovesdan 611 | All rights reserved. 612 | 613 | Redistribution and use in source and binary forms, with or without 614 | modification, are permitted provided that the following conditions 615 | are met: 616 | 1. Redistributions of source code must retain the above copyright 617 | notice, this list of conditions and the following disclaimer. 618 | 2. Redistributions in binary form must reproduce the above copyright 619 | notice, this list of conditions and the following disclaimer in the 620 | documentation and/or other materials provided with the distribution. 621 | 622 | THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 623 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 624 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 625 | ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 626 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 627 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 628 | OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 629 | HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 630 | LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 631 | OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 632 | SUCH DAMAGE. 633 | 634 | ------------------------------------------------------------------- 635 | 636 | Copyright (c) 1999 James Howard and Dag-Erling Coïdan Smørgrav 637 | Copyright (C) 2008-2010 Gabor Kovesdan 638 | All rights reserved. 639 | 640 | Redistribution and use in source and binary forms, with or without 641 | modification, are permitted provided that the following conditions 642 | are met: 643 | 1. Redistributions of source code must retain the above copyright 644 | notice, this list of conditions and the following disclaimer. 645 | 2. Redistributions in binary form must reproduce the above copyright 646 | notice, this list of conditions and the following disclaimer in the 647 | documentation and/or other materials provided with the distribution. 648 | 649 | THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 650 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 651 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 652 | ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 653 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 654 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 655 | OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 656 | HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 657 | LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 658 | OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 659 | SUCH DAMAGE. 660 | 661 | ------------------------------------------------------------------- 662 | 663 | Copyright (c) 1999 James Howard and Dag-Erling Coïdan Smørgrav 664 | Copyright (C) 2008-2010 Gabor Kovesdan 665 | Copyright (C) 2010 Dimitry Andric 666 | All rights reserved. 667 | 668 | Redistribution and use in source and binary forms, with or without 669 | modification, are permitted provided that the following conditions 670 | are met: 671 | 1. Redistributions of source code must retain the above copyright 672 | notice, this list of conditions and the following disclaimer. 673 | 2. Redistributions in binary form must reproduce the above copyright 674 | notice, this list of conditions and the following disclaimer in the 675 | documentation and/or other materials provided with the distribution. 676 | 677 | THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 678 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 679 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 680 | ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 681 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 682 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 683 | OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 684 | HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 685 | LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 686 | OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 687 | SUCH DAMAGE. 688 | 689 | ------------------------------------------------------------------- 690 | 691 | Copyright (c) 1999 James Howard and Dag-Erling Coïdan Smørgrav 692 | Copyright (c) 2008-2009 Gabor Kovesdan 693 | All rights reserved. 694 | 695 | Redistribution and use in source and binary forms, with or without 696 | modification, are permitted provided that the following conditions 697 | are met: 698 | 1. Redistributions of source code must retain the above copyright 699 | notice, this list of conditions and the following disclaimer. 700 | 2. Redistributions in binary form must reproduce the above copyright 701 | notice, this list of conditions and the following disclaimer in the 702 | documentation and/or other materials provided with the distribution. 703 | 704 | THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 705 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 706 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 707 | ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 708 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 709 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 710 | OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 711 | HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 712 | LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 713 | OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 714 | SUCH DAMAGE. 715 | 716 | ------------------------------------------------------------------- 717 | 718 | Copyright (c) 2001-2002,2004 The NetBSD Foundation, Inc. 719 | All rights reserved. 720 | 721 | This code is derived from software contributed to The NetBSD Foundation 722 | by Luke Mewburn. 723 | 724 | Redistribution and use in source and binary forms, with or without 725 | modification, are permitted provided that the following conditions 726 | are met: 727 | 1. Redistributions of source code must retain the above copyright 728 | notice, this list of conditions and the following disclaimer. 729 | 2. Redistributions in binary form must reproduce the above copyright 730 | notice, this list of conditions and the following disclaimer in the 731 | documentation and/or other materials provided with the distribution. 732 | 733 | THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 734 | ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 735 | TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 736 | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 737 | BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 738 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 739 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 740 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 741 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 742 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 743 | POSSIBILITY OF SUCH DAMAGE. 744 | 745 | ------------------------------------------------------------------- 746 | 747 | Copyright (c) 2007 The NetBSD Foundation, Inc. 748 | All rights reserved. 749 | 750 | This code is derived from software contributed to The NetBSD Foundation 751 | by Luke Mewburn. 752 | 753 | Redistribution and use in source and binary forms, with or without 754 | modification, are permitted provided that the following conditions 755 | are met: 756 | 1. Redistributions of source code must retain the above copyright 757 | notice, this list of conditions and the following disclaimer. 758 | 2. Redistributions in binary form must reproduce the above copyright 759 | notice, this list of conditions and the following disclaimer in the 760 | documentation and/or other materials provided with the distribution. 761 | 762 | THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 763 | ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 764 | TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 765 | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 766 | BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 767 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 768 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 769 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 770 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 771 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 772 | POSSIBILITY OF SUCH DAMAGE. 773 | 774 | ------------------------------------------------------------------- 775 | 776 | Copyright (c) 2008, The Android Open Source Project 777 | All rights reserved. 778 | 779 | Redistribution and use in source and binary forms, with or without 780 | modification, are permitted provided that the following conditions 781 | are met: 782 | * Redistributions of source code must retain the above copyright 783 | notice, this list of conditions and the following disclaimer. 784 | * Redistributions in binary form must reproduce the above copyright 785 | notice, this list of conditions and the following disclaimer in 786 | the documentation and/or other materials provided with the 787 | distribution. 788 | * Neither the name of Google, Inc. nor the names of its contributors 789 | may be used to endorse or promote products derived from this 790 | software without specific prior written permission. 791 | 792 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 793 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 794 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 795 | FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 796 | COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 797 | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 798 | BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS 799 | OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 800 | AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 801 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 802 | OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 803 | SUCH DAMAGE. 804 | 805 | ------------------------------------------------------------------- 806 | 807 | Copyright (c) 2009, The Android Open Source Project 808 | All rights reserved. 809 | 810 | Redistribution and use in source and binary forms, with or without 811 | modification, are permitted provided that the following conditions 812 | are met: 813 | * Redistributions of source code must retain the above copyright 814 | notice, this list of conditions and the following disclaimer. 815 | * Redistributions in binary form must reproduce the above copyright 816 | notice, this list of conditions and the following disclaimer in 817 | the documentation and/or other materials provided with the 818 | distribution. 819 | * Neither the name of Google, Inc. nor the names of its contributors 820 | may be used to endorse or promote products derived from this 821 | software without specific prior written permission. 822 | 823 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 824 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 825 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 826 | FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 827 | COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 828 | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 829 | BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS 830 | OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 831 | AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 832 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 833 | OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 834 | SUCH DAMAGE. 835 | 836 | ------------------------------------------------------------------- 837 | 838 | Copyright (c) 2010 The NetBSD Foundation, Inc. 839 | All rights reserved. 840 | 841 | Redistribution and use in source and binary forms, with or without 842 | modification, are permitted provided that the following conditions 843 | are met: 844 | 1. Redistributions of source code must retain the above copyright 845 | notice, this list of conditions and the following disclaimer. 846 | 2. Redistributions in binary form must reproduce the above copyright 847 | notice, this list of conditions and the following disclaimer in the 848 | documentation and/or other materials provided with the distribution. 849 | 850 | THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 851 | ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 852 | TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 853 | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 854 | BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 855 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 856 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 857 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 858 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 859 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 860 | POSSIBILITY OF SUCH DAMAGE. 861 | 862 | ------------------------------------------------------------------- 863 | 864 | Copyright (c) 2010, The Android Open Source Project 865 | All rights reserved. 866 | 867 | Redistribution and use in source and binary forms, with or without 868 | modification, are permitted provided that the following conditions 869 | are met: 870 | * Redistributions of source code must retain the above copyright 871 | notice, this list of conditions and the following disclaimer. 872 | * Redistributions in binary form must reproduce the above copyright 873 | notice, this list of conditions and the following disclaimer in 874 | the documentation and/or other materials provided with the 875 | distribution. 876 | * Neither the name of Google, Inc. nor the names of its contributors 877 | may be used to endorse or promote products derived from this 878 | software without specific prior written permission. 879 | 880 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 881 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 882 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 883 | FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 884 | COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 885 | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 886 | BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS 887 | OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 888 | AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 889 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 890 | OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 891 | SUCH DAMAGE. 892 | 893 | ------------------------------------------------------------------- 894 | 895 | Copyright (c) 2012, The Android Open Source Project 896 | All rights reserved. 897 | 898 | Redistribution and use in source and binary forms, with or without 899 | modification, are permitted provided that the following conditions 900 | are met: 901 | * Redistributions of source code must retain the above copyright 902 | notice, this list of conditions and the following disclaimer. 903 | * Redistributions in binary form must reproduce the above copyright 904 | notice, this list of conditions and the following disclaimer in 905 | the documentation and/or other materials provided with the 906 | distribution. 907 | * Neither the name of Google, Inc. nor the names of its contributors 908 | may be used to endorse or promote products derived from this 909 | software without specific prior written permission. 910 | 911 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 912 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 913 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 914 | FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 915 | COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 916 | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 917 | BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS 918 | OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 919 | AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 920 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 921 | OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 922 | SUCH DAMAGE. 923 | 924 | ------------------------------------------------------------------- 925 | 926 | Copyright (c) 2013, The Android Open Source Project 927 | All rights reserved. 928 | 929 | Redistribution and use in source and binary forms, with or without 930 | modification, are permitted provided that the following conditions 931 | are met: 932 | * Redistributions of source code must retain the above copyright 933 | notice, this list of conditions and the following disclaimer. 934 | * Redistributions in binary form must reproduce the above copyright 935 | notice, this list of conditions and the following disclaimer in 936 | the documentation and/or other materials provided with the 937 | distribution. 938 | * Neither the name of Google, Inc. nor the names of its contributors 939 | may be used to endorse or promote products derived from this 940 | software without specific prior written permission. 941 | 942 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 943 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 944 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 945 | FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 946 | COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 947 | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 948 | BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS 949 | OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 950 | AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 951 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 952 | OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 953 | SUCH DAMAGE. 954 | 955 | ------------------------------------------------------------------- 956 | 957 | Copyright (c) 2014, The Android Open Source Project 958 | All rights reserved. 959 | 960 | Redistribution and use in source and binary forms, with or without 961 | modification, are permitted provided that the following conditions 962 | are met: 963 | * Redistributions of source code must retain the above copyright 964 | notice, this list of conditions and the following disclaimer. 965 | * Redistributions in binary form must reproduce the above copyright 966 | notice, this list of conditions and the following disclaimer in 967 | the documentation and/or other materials provided with the 968 | distribution. 969 | * Neither the name of Google, Inc. nor the names of its contributors 970 | may be used to endorse or promote products derived from this 971 | software without specific prior written permission. 972 | 973 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 974 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 975 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 976 | FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 977 | COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 978 | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 979 | BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS 980 | OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 981 | AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 982 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 983 | OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 984 | SUCH DAMAGE. 985 | 986 | ------------------------------------------------------------------- 987 | 988 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Keycheck 2 | [Keycheck binary from here](https://github.com/sonyxperiadev/device-sony-common-init/tree/master/keycheck)
3 | Modified Android.mk for static compiling
4 | Added and modified build script by osm0sis for easy compiling
5 | Note that you can modify the APP_ABI and APP_PLATFORM for whatever you're trying to compile it for
6 | 7 | ## Usage 8 | git clone
9 | cd Keycheck
10 | chmod +x build.sh
11 | ./build.sh 12 | -------------------------------------------------------------------------------- /build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | case "$(uname -s)" in 4 | CYGWIN*|MINGW32*|MSYS*) ext=.cmd; plat=windows;; 5 | *) plat=linux;; 6 | esac; 7 | 8 | case $1 in 9 | clean) 10 | rm -rf libs obj; 11 | exit 0; 12 | ;; 13 | esac; 14 | 15 | if [ ! "$NDK_ROOT" ]; then 16 | NDK_ROOT=`pwd`/android-ndk-r15c; 17 | fi; 18 | if [ ! "$NDK_TOOLCHAIN_VERSION" ]; then 19 | NDK_TOOLCHAIN_VERSION=clang; 20 | fi; 21 | if [ ! "$APP_ABI" ]; then 22 | APP_ABI=armeabi; 23 | fi; 24 | if [ ! "$APP_PLATFORM" ]; then 25 | APP_PLATFORM=android-17; 26 | fi; 27 | 28 | # Set up Android NDK 29 | echo "Fetching Android NDK r15c" 30 | [ -f "android-ndk-r15c-linux-x86_64.zip" ] || wget https://dl.google.com/android/repository/android-ndk-r15c-$plat-x86_64.zip 31 | [ -d "android-ndk-r15c" ] || unzip -o android-ndk-r15c-$plat-x86_64.zip 32 | 33 | # Build 34 | $NDK_ROOT/ndk-build$ext NDK_PROJECT_PATH=. APP_BUILD_SCRIPT=./Android.mk NDK_TOOLCHAIN_VERSION=$NDK_TOOLCHAIN_VERSION APP_ABI=$APP_ABI APP_PLATFORM=$APP_PLATFORM APP_STL=gnustl_static; 35 | exit 0; 36 | 37 | -------------------------------------------------------------------------------- /keycheck.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2010 The Android Open Source Project 3 | * Copyright (C) 2015-2016 The CyanogenMod Project 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | #include 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | 30 | #include "keycheck.h" 31 | 32 | // Global variables 33 | static struct pollfd *ufds; 34 | static char **device_names; 35 | static int nfds; 36 | 37 | static int open_device(const char *device) 38 | { 39 | int version; 40 | int fd; 41 | int clkid = CLOCK_MONOTONIC; 42 | struct pollfd *new_ufds; 43 | char **new_device_names; 44 | char name[80]; 45 | char location[80]; 46 | char idstr[80]; 47 | struct input_id id; 48 | 49 | fd = open(device, O_RDWR); 50 | if (fd < 0) { 51 | return -1; 52 | } 53 | 54 | if (ioctl(fd, EVIOCGVERSION, &version)) { 55 | return -1; 56 | } 57 | 58 | if (ioctl(fd, EVIOCGID, &id)) { 59 | return -1; 60 | } 61 | 62 | name[sizeof(name) - 1] = '\0'; 63 | location[sizeof(location) - 1] = '\0'; 64 | idstr[sizeof(idstr) - 1] = '\0'; 65 | 66 | if (ioctl(fd, EVIOCGNAME(sizeof(name) - 1), &name) < 1) { 67 | name[0] = '\0'; 68 | } 69 | 70 | if (ioctl(fd, EVIOCGPHYS(sizeof(location) - 1), &location) < 1) { 71 | location[0] = '\0'; 72 | } 73 | 74 | if (ioctl(fd, EVIOCGUNIQ(sizeof(idstr) - 1), &idstr) < 1) { 75 | idstr[0] = '\0'; 76 | } 77 | 78 | if (ioctl(fd, EVIOCSCLOCKID, &clkid) != 0) { 79 | // a non-fatal error 80 | } 81 | 82 | new_ufds = realloc(ufds, sizeof(ufds[0]) * (nfds + 1)); 83 | if (new_ufds == NULL) { 84 | return -1; 85 | } 86 | 87 | ufds = new_ufds; 88 | new_device_names = realloc(device_names, 89 | sizeof(device_names[0]) * (nfds + 1)); 90 | if (new_device_names == NULL) { 91 | return -1; 92 | } 93 | 94 | device_names = new_device_names; 95 | 96 | ufds[nfds].fd = fd; 97 | ufds[nfds].events = POLLIN; 98 | device_names[nfds] = strdup(device); 99 | nfds++; 100 | 101 | return 0; 102 | } 103 | 104 | int close_device(const char *device) 105 | { 106 | int i; 107 | for (i = 1; i < nfds; i++) { 108 | if (strcmp(device_names[i], device) == 0) { 109 | int count = nfds - i - 1; 110 | free(device_names[i]); 111 | memmove(device_names + i, device_names + i + 1, 112 | sizeof(device_names[0]) * count); 113 | memmove(ufds + i, ufds + i + 1, sizeof(ufds[0]) * count); 114 | nfds--; 115 | return 0; 116 | } 117 | } 118 | return -1; 119 | } 120 | 121 | static int read_notify(const char *dirname, int nfd) 122 | { 123 | int res; 124 | char devname[PATH_MAX]; 125 | char *filename; 126 | char event_buf[512]; 127 | int event_size; 128 | int event_pos = 0; 129 | struct inotify_event *event; 130 | 131 | res = read(nfd, event_buf, sizeof(event_buf)); 132 | if (res < (int)sizeof(*event)) { 133 | if (errno == EINTR) { 134 | return 0; 135 | } 136 | return 1; 137 | } 138 | 139 | strcpy(devname, dirname); 140 | filename = devname + strlen(devname); 141 | *filename++ = '/'; 142 | 143 | while (res >= (int)sizeof(*event)) { 144 | event = (struct inotify_event *)(event_buf + event_pos); 145 | if (event->len) { 146 | strcpy(filename, event->name); 147 | if (event->mask & IN_CREATE) { 148 | open_device(devname); 149 | } else { 150 | close_device(devname); 151 | } 152 | } 153 | event_size = sizeof(*event) + event->len; 154 | res -= event_size; 155 | event_pos += event_size; 156 | } 157 | return 0; 158 | } 159 | 160 | static int scan_dir(const char *dirname) 161 | { 162 | char devname[PATH_MAX]; 163 | char *filename; 164 | DIR *dir; 165 | struct dirent *de; 166 | 167 | dir = opendir(dirname); 168 | if (dir == NULL) { 169 | return -1; 170 | } 171 | 172 | strcpy(devname, dirname); 173 | filename = devname + strlen(devname); 174 | *filename++ = '/'; 175 | 176 | while ((de = readdir(dir))) { 177 | if (de->d_name[0] == '.' && (de->d_name[1] == '\0' || 178 | (de->d_name[1] == '.' && de->d_name[2] == '\0'))) { 179 | continue; 180 | } 181 | 182 | strcpy(filename, de->d_name); 183 | open_device(devname); 184 | } 185 | closedir(dir); 186 | return 0; 187 | } 188 | 189 | int main(int argc, char* argv[]) 190 | { 191 | int i; 192 | int res; 193 | struct input_event event; 194 | int event_count = 0; 195 | const char *device_path = "/dev/input"; 196 | unsigned char keys; 197 | 198 | keys = KEYCHECK_CHECK_VOLUMEDOWN | KEYCHECK_CHECK_VOLUMEUP; 199 | nfds = 1; 200 | ufds = calloc(1, sizeof(ufds[0])); 201 | ufds[0].fd = inotify_init(); 202 | ufds[0].events = POLLIN; 203 | 204 | res = inotify_add_watch(ufds[0].fd, device_path, IN_DELETE | IN_CREATE); 205 | if (res < 0) { 206 | return 1; 207 | } 208 | 209 | res = scan_dir(device_path); 210 | if (res < 0) { 211 | return 1; 212 | } 213 | 214 | for (i = 1; i < argc; ++i) 215 | { 216 | if (strcmp(argv[i], "--no-down") == 0) { 217 | keys &= ~KEYCHECK_CHECK_VOLUMEDOWN; 218 | } 219 | } 220 | 221 | while (1) { 222 | poll(ufds, nfds, -1); 223 | if (ufds[0].revents & POLLIN) { 224 | read_notify(device_path, ufds[0].fd); 225 | } 226 | 227 | for (i = 1; i < nfds; i++) { 228 | if ((ufds[i].revents) && (ufds[i].revents & POLLIN)) { 229 | res = read(ufds[i].fd, &event, sizeof(event)); 230 | if (res < (int)sizeof(event)) { 231 | return 1; 232 | } 233 | 234 | if (event.code == KEY_VOLUMEDOWN && 235 | (keys & KEYCHECK_CHECK_VOLUMEDOWN) != 0) { 236 | return KEYCHECK_PRESSED_VOLUMEDOWN; 237 | } 238 | else if (event.code == KEY_VOLUMEUP && 239 | (keys & KEYCHECK_CHECK_VOLUMEUP) != 0) { 240 | return KEYCHECK_PRESSED_VOLUMEUP; 241 | } 242 | 243 | if (event_count && --event_count == 0) { 244 | return 0; 245 | } 246 | } 247 | } 248 | } 249 | } 250 | -------------------------------------------------------------------------------- /keycheck.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015-2016 The CyanogenMod Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef __KEYCHECK_H__ 18 | #define __KEYCHECK_H__ 19 | 20 | // Constants: pressed keys 21 | #define KEYCHECK_CHECK_VOLUMEDOWN 0x01 22 | #define KEYCHECK_CHECK_VOLUMEUP 0x02 23 | #define KEYCHECK_PRESSED_VOLUMEDOWN 41 24 | #define KEYCHECK_PRESSED_VOLUMEUP 42 25 | 26 | #endif // __KEYCHECK_H__ 27 | --------------------------------------------------------------------------------