From owner-freebsd-questions@freebsd.org Sun Jan 26 08:40:47 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 74A32235196 for ; Sun, 26 Jan 2020 08:40:47 +0000 (UTC) (envelope-from karlo@klarinet.osamsb.hr) Received: from out3-smtp.messagingengine.com (out3-smtp.messagingengine.com [66.111.4.27]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4855tk0Kvvz3F33 for ; Sun, 26 Jan 2020 08:40:45 +0000 (UTC) (envelope-from karlo@klarinet.osamsb.hr) Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.nyi.internal (Postfix) with ESMTP id 2A26F21E5B; Sun, 26 Jan 2020 03:40:45 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute5.internal (MEProxy); Sun, 26 Jan 2020 03:40:45 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= klarinet.osamsb.hr; h=from:to:subject:mime-version:content-type :date:message-id; s=fm3; bh=KtAZWUbQC6jihoJ9ygkpmVXeTOElsNjpUn4T GEnbPY0=; b=PjhIiVxBdlYX6h3xDh0dhdsh/hkrjmEqkus91gJlcWUAT2lYeoNq MQtxHS3HZvwTIf9VNG8DIO8fZ61AxMyMHgRc57Vv+1Lz1bhuZ0uYywmV7f0TtXFG GM25K4G85MbR3v7nB3VwqUyT7+gz2eyHgFOln7hBHDWrBrTEcSgDOk+8klEuskXi nERebkna7eceEX/ZAeujdsG82Q+GEWwXKDc7oc2YUV/npZnsYRLyOiBtG1E1iA6i fPfXxEQoXCfST0CwMrNjBsPKkVEwYj8eJp5O8PG9qssOwGKKGj/zh0n0DV/BpcS5 j9GyTKT8sMhhrPThMruEY1exFWgCTZpBdA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-type:date:from:message-id :mime-version:subject:to:x-me-proxy:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm1; bh=KtAZWUbQC6jihoJ9ygkpmVXeTOEls NjpUn4TGEnbPY0=; b=lKCaNbMlz/UCvtlOxFmXz+JnVtBCdos8dI0EyiXKSMPW9 qOoqFp1zL7xPBcY9u2SGugX5fr191w+BKSZzRmDqSJXIsXExuxeTPFK0JBB5hvKJ 1OF9uY+lr8jacQdSW5rxPToejxVETMOlZSqafu6T6Uzw/oiDAD7pdSPnwWSqTdqn YWNI1Lr2rG87GmnbcQbbBFg6Y4MEQmEMCZlyML0nxTJgUDmyE2RtVh1JRQcmrVJ2 9MmP6Fs1rshsKJR7Roh8OvaX4oZ+nu17EvVAHCFuXlTjBj6hlDJoBEZwaBfe8W2H KlBMqcVyABdvPa/tv4u48rEKkusj4aKA7F1HF9hyA== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedugedrvdelgddvkecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecunecujfgurhephffvufggtgffkfesthdtfedttddtvd enucfhrhhomhepmfhrrghljhcumfgrrhhlohcuoehkrghrlhhosehklhgrrhhinhgvthdr ohhsrghmshgsrdhhrheqnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrg hilhhfrhhomhepkhgrrhhloheskhhlrghrihhnvghtrdhoshgrmhhssgdrhhhr X-ME-Proxy: From: Kralj Karlo To: freebsd-questions@FreeBSD.ORG Subject: Read usage codes from a specific USB keyboard MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Date: Sun, 26 Jan 2020 08:40:41 +0000 Message-Id: <20200126084044.252483067415@mailuser.nyi.internal> X-Rspamd-Queue-Id: 4855tk0Kvvz3F33 X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org; dkim=pass header.d=klarinet.osamsb.hr header.s=fm3 header.b=PjhIiVxB; dkim=pass header.d=messagingengine.com header.s=fm1 header.b=lKCaNbMl; dmarc=none; spf=pass (mx1.freebsd.org: domain of karlo@klarinet.osamsb.hr designates 66.111.4.27 as permitted sender) smtp.mailfrom=karlo@klarinet.osamsb.hr X-Spamd-Result: default: False [-6.09 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; R_DKIM_ALLOW(-0.20)[klarinet.osamsb.hr:s=fm3,messagingengine.com:s=fm1]; FROM_HAS_DN(0.00)[]; R_SPF_ALLOW(-0.20)[+ip4:66.111.4.27]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; TO_DN_NONE(0.00)[]; DMARC_NA(0.00)[osamsb.hr]; RCPT_COUNT_ONE(0.00)[1]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; RCVD_COUNT_THREE(0.00)[3]; IP_SCORE(-3.49)[ip: (-9.83), ipnet: 66.111.4.0/24(-4.90), asn: 11403(-2.68), country: US(-0.05)]; DKIM_TRACE(0.00)[klarinet.osamsb.hr:+,messagingengine.com:+]; RCVD_IN_DNSWL_LOW(-0.10)[27.4.111.66.list.dnswl.org : 127.0.5.1]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:11403, ipnet:66.111.4.0/24, country:US]; RCVD_TLS_LAST(0.00)[] X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 26 Jan 2020 08:40:47 -0000 How can I do this? 1. Prevent X from using a specific USB keyboard. (I can identify the keyboard by name or by device.) 2. In a different program, read usage codes coming from that specific keyboard. In case that is not clear, here is some context. I have a keyboard next to my bed. When I press a button on the keyboard, my computer plays the time, out of the speakers. This way, I can determine what time it is without turning on the lights and without maintaining a separate clock. This is the only purpose of the keyboard. The present implementation is with xbindkeys. The xbindkeysrc looks like this. "speak-date" KP_0 "speak-date" KP_1 "speak-date" KP_2 "speak-date" KP_3 "speak-date" KP_4 "speak-date" KP_5 "speak-date" KP_6 "speak-date" KP_7 "speak-date" KP_8 "speak-date" KP_9 "speak-date" KP_Delete "speak-date" KP_Add "speak-date" KP_Subtract "speak-date" KP_Multiply "speak-date" KP_Divide "speak-date" KP_Enter The attached keyboard is a number pad, and I don't use a number pad otherwise, so it is fine for me to assign all of these keys in xbindkeys. But there is still a problem with this approach: If I lock my screen with slock, then the keypresses are not sent to xbindkeys, so I can't check the time. I would like to configure my computer so that presses of this keyboard are ignored by X and so that I can read the presses in a separate program that just watches for keypresses and runs speak-date when it receives them.