From owner-freebsd-questions@freebsd.org Sat Aug 1 04:54:11 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 9064C36D76E for ; Sat, 1 Aug 2020 04:54:11 +0000 (UTC) (envelope-from gobble.wa@gmail.com) Received: from mail-ej1-x634.google.com (mail-ej1-x634.google.com [IPv6:2a00:1450:4864:20::634]) (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 4BJWyV5q0Yz4LKp for ; Sat, 1 Aug 2020 04:54:10 +0000 (UTC) (envelope-from gobble.wa@gmail.com) Received: by mail-ej1-x634.google.com with SMTP id o23so5949441ejr.1 for ; Fri, 31 Jul 2020 21:54:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=muIyq09ZqZjc6n5DCrygyKfzSDkKaLqd8hrVS5olUpY=; b=MDE72JKQuYrKgZZIX1V0ffsmQdTcj6xbT1oJKwlqR0xWF0SmV7c3o/ZKdYhb6woK0J aj+918KqYKLkbYNAqYW4cjImjVb0rH61CPssbMCBY93VpDdfox6SCSMBkR2Gchs7th32 2UCBUlqgT+dNFM2SMsBs26K+B8BdnzFm7pq7UDlnoKPRIVJeWlGxh4/4G7BsfZR0xg0C PQLOb0xM9Khp3Zi30Q5bk8mGNt/D4kbpcW+UOAt4XqSOLAdASfEdKD9iieo7nkzwqPYQ TSCxvVQFY/cVEiD8g3Eav+CN5jF2JsazesHPdtO4IxrktmtkELEi+L4Do9IKWLwy2O2m 9o0A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=muIyq09ZqZjc6n5DCrygyKfzSDkKaLqd8hrVS5olUpY=; b=clEF+v/fkYMOxAm8nkJW9gSbPpFD0YhFoUWpFPYcUsNuFjW7pnZPKMnYUmvzfC6crv zb7S12vKYMUCRlP8t20yBka2fU33y0BE7dL9GnQKwEMBu+2ajp/1L+utRAE3e3y0BOkr s1oOPF7TI9qujhZ97KopkU8gEK5qcsOA0se3eFppMfAhGnxaPrH0jLfkSe2THS4h1ud8 C8KBwW6VmDZLV2k4MkoCzjIs3sO3nayuLwtmZC2x4lqRTrVaWlXBzOie2kFmZXZ9m/2R AVCsotifyb5oFDcmJoAFTK0EXw8eQeK4ZjyCQzqSN8loJtcqWAwKoxZ4KGJAfMEppXsR hLrQ== X-Gm-Message-State: AOAM532ZX52c7j1c9db03hCkECQ7Pq8d30nqG1Nt2zKzlALMR+Cmiq1O RgudeiQ5C+ku9nH3mDkWxAU+8a3d1mOm4aPzSM19tVgRxCE= X-Google-Smtp-Source: ABdhPJxNiafYXiqPupGLy4twlPZwSgvIua1aIQEK8pCWzr4g7VnhhwJBw8RBdf67L6pqtYiPda1dcM64G0KfQseMZjo= X-Received: by 2002:a17:906:bce9:: with SMTP id op9mr7391475ejb.462.1596257649000; Fri, 31 Jul 2020 21:54:09 -0700 (PDT) MIME-Version: 1.0 From: Waitman Gobble Date: Sat, 1 Aug 2020 00:53:58 -0400 Message-ID: Subject: Question about evdev and joystick. devfs rules To: FreeBSD Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 4BJWyV5q0Yz4LKp X-Spamd-Bar: --- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmail.com header.s=20161025 header.b=MDE72JKQ; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (mx1.freebsd.org: domain of gobblewa@gmail.com designates 2a00:1450:4864:20::634 as permitted sender) smtp.mailfrom=gobblewa@gmail.com X-Spamd-Result: default: False [-3.35 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-0.99)[-0.994]; 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)[-1.003]; 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::634:from]; NEURAL_HAM_SHORT(-0.35)[-0.354]; 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 04:54:11 -0000 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 -- Waitman Gobble