From owner-freebsd-questions@freebsd.org Sat Aug 1 05:02:42 2020 Return-Path: Delivered-To: freebsd-questions@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 30E1E3688E0 for ; Sat, 1 Aug 2020 05:02:42 +0000 (UTC) (envelope-from gobble.wa@gmail.com) Received: from mail-ej1-x62d.google.com (mail-ej1-x62d.google.com [IPv6:2a00:1450:4864:20::62d]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BJX8K19nJz4NCh for ; Sat, 1 Aug 2020 05:02:41 +0000 (UTC) (envelope-from gobble.wa@gmail.com) Received: by mail-ej1-x62d.google.com with SMTP id w9so33398573ejc.8 for ; Fri, 31 Jul 2020 22:02:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=WBlAys75wcHmerThf5kDQ3rSn3asORcrPv9MiN0odTc=; b=C/1GvIxFXJgys38ZXf1wivseaD/dF1scJOkkKQidvaHdB5+WLsD0Y0GpRnMHg8vQKW POLRI7tnRlOX1iZi/dnAS1fWKyAkTXEiOP4eLyhAZWrMePQp7i6abHpNeksDqeE8q8Rc OZQXeY2tk2MnYPulAav/SRs17Ws8Hy/bkHHeyA9wv4rRtYDky05LSaP8zQTCORWNfJqQ IiAh/dgLEuJcQYq03ANpa0RMDrCRvSpcGSwfDDybSgDaMQRJ2Sm+bj2qQwW7QoO4lc5k mCLhKV1+yILbZAqmCbE2V4Z2LYkJP9GCcEe7nzZnnNUUK0uOtqchR88TiNqFXZKfZKEm syrQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=WBlAys75wcHmerThf5kDQ3rSn3asORcrPv9MiN0odTc=; b=jko32JkaO80FaN6H5mdyzf8PZcSgjJAyR3s3E5D3fKZwIVQQrYc/P26z9jvCOp7AkK JfmG7MRP/Dh0AttMQI+HhdQnrcywM1hkoitVrUKxb7JKUBVlPpk0GVibbfHHBO1JFh7Y q//yUpKgOIfFDyOD6AAvh5pt9rZ1IigSOBdMHFCoakFf8TGqRVpvS1F10G2U5x1DPvNM 9ukhSt+wXWDXRjg9OBHZ/QxJRDoQQs/Q9JXtQh9jmHm8p/C1OMvuG6astdLrFvUvucdB cAcgeIL/o6E/SaMft/W08sbnlGM17kn4BI8xxSIHoDnb0anFPFkCgm3e9Cy05LSIL8oT 4k/g== X-Gm-Message-State: AOAM532/VeAR4Wxg5uAF9lvou318szPwrQLU3QRGiHSEcfVvOtcFyBqR OnA+cFM5H7rzYPtCrKw3rZJ+PJWbi6myiZUCElKgNf3Lsb4= X-Google-Smtp-Source: ABdhPJzUHTLLSVcIKGZBDeDNQBRkJqU6tqUkrpdhb2MUQeN3ZW+YvHCXZs1gBWJFdI475HzWaQVLw6xBIdNDG006EHY= X-Received: by 2002:a17:906:4094:: with SMTP id u20mr6946650ejj.553.1596258159122; Fri, 31 Jul 2020 22:02:39 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Waitman Gobble Date: Sat, 1 Aug 2020 01:02:28 -0400 Message-ID: Subject: Re: Question about evdev and joystick. devfs rules To: FreeBSD Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 4BJX8K19nJz4NCh X-Spamd-Bar: --- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmail.com header.s=20161025 header.b=C/1GvIxF; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (mx1.freebsd.org: domain of gobblewa@gmail.com designates 2a00:1450:4864:20::62d as permitted sender) smtp.mailfrom=gobblewa@gmail.com X-Spamd-Result: default: False [-3.31 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.003]; R_DKIM_ALLOW(-0.20)[gmail.com:s=20161025]; FROM_HAS_DN(0.00)[]; DWL_DNSWL_NONE(0.00)[gmail.com:dkim]; R_SPF_ALLOW(-0.20)[+ip6:2a00:1450:4000::/36:c]; FREEMAIL_FROM(0.00)[gmail.com]; MIME_GOOD(-0.10)[text/plain]; PREVIOUSLY_DELIVERED(0.00)[freebsd-questions@freebsd.org]; NEURAL_HAM_LONG(-1.00)[-0.998]; RCPT_COUNT_ONE(0.00)[1]; TO_DN_ALL(0.00)[]; DKIM_TRACE(0.00)[gmail.com:+]; DMARC_POLICY_ALLOW(-0.50)[gmail.com,none]; RCVD_IN_DNSWL_NONE(0.00)[2a00:1450:4864:20::62d:from]; NEURAL_HAM_SHORT(-0.31)[-0.308]; TO_MATCH_ENVRCPT_ALL(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:2a00:1450::/32, country:US]; TAGGED_FROM(0.00)[]; RCVD_TLS_ALL(0.00)[]; RCVD_COUNT_TWO(0.00)[2] X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 01 Aug 2020 05:02:42 -0000 On Sat, Aug 1, 2020 at 12:53 AM Waitman Gobble wrote: > > When I plug in a USB game pad / joystick and open fd, use > libevev_new_from_fd I get access denied if I'm not root. I think we > used to have to set devfs rules but not sure if we are supposed to set > up access in /etc/devfs.rules for /dev/input/event* devices? Maybe I > just give myself permission to all /dev/input/event* > ? > > however, It seems that the keyboard and mouse are connected to > /dev/input/event* and I obviously already have permission to access > those devices, so that part is a bit confusing to me. > > > This device connected to /dev/input/event7 today. > > If I query as 'regular' user > > fd = open("/dev/input/event7", O_RDONLY | O_NONBLOCK); > rc = libevdev_new_from_fd(fd, &dev); > > Error: Failed to init libevdev (Bad file descriptor) > > > But as root, i can query device. > > > Input device name: "Microsoft X-Box 360 pad" > Input device ID: bus 0x3 vendor 0x45e product 0x28e > Input device GUID 030000005e0400008e02000070010000 > > > 0 - Joystick has button: 0x130 - BTN_SOUTH > 1 - Joystick has button: 0x131 - BTN_EAST > 2 - Joystick has button: 0x133 - BTN_NORTH > 3 - Joystick has button: 0x134 - BTN_WEST > 4 - Joystick has button: 0x136 - BTN_TL > 5 - Joystick has button: 0x137 - BTN_TR > 6 - Joystick has button: 0x13a - BTN_SELECT > 7 - Joystick has button: 0x13b - BTN_START > 8 - Joystick has button: 0x13c - BTN_MODE > 9 - Joystick has button: 0x13d - BTN_THUMBL > 10 - Joystick has button: 0x13e - BTN_THUMBR > > > Joystick has absolute axis: 0x00 - ABS_X > Values = { 0, -32768, 32767, 16, 128 } > Joystick has absolute axis: 0x01 - ABS_Y > Values = { 0, -32768, 32767, 16, 128 } > Joystick has absolute axis: 0x02 - ABS_Z > Values = { 0, 0, 255, 0, 0 } > Joystick has absolute axis: 0x03 - ABS_RX > Values = { 0, -32768, 32767, 16, 128 } > Joystick has absolute axis: 0x04 - ABS_RY > Values = { 0, -32768, 32767, 16, 128 } > Joystick has absolute axis: 0x05 - ABS_RZ > Values = { 0, 0, 255, 0, 0 } > > > Joystick has hat 0 > Values = { 0, -1, 1, 0, 0 } > > Hat 0 Axis 1 Value -1 > Hat 0 Axis 1 Value 0 > Hat 0 Axis 1 Value 1 > Hat 0 Axis 1 Value 0 > Hat 0 Axis 0 Value 1 > Hat 0 Axis 0 Value 0 > Hat 0 Axis 0 Value -1 > Hat 0 Axis 0 Value 0 > Button 0 > Button 0 > Button 1 > Button 1 > Button 3 > Button 3 > Button 2 > Button 2 > > OOPs, I checked. I suppose webcamd is taking it. # ls -lh /dev/input/event7 crw-rw---- 1 webcamd webcamd 0xad Aug 1 00:13 /dev/input/event7 -- Waitman Gobble