Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp456031pxa; Tue, 4 Aug 2020 09:26:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwGZ4q6iFfh28kxf0LpCImnWBKAZs6u3WkN68bXuK8Z9T5+gEe68KTDxBqhjJ9QrGavpq/C X-Received: by 2002:a17:906:4157:: with SMTP id l23mr21938398ejk.491.1596558395136; Tue, 04 Aug 2020 09:26:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1596558395; cv=none; d=google.com; s=arc-20160816; b=EYmBUFF2y4YarkDQoPatw3GJH0aR4FNV5nRr1mxGmKEZ/c2FlqgNVSc6A440SgLsMX ocu41B+9MOnpuJNnKd8i8MHWuoKEpwaNVrVIcBfyMiUWozWfJt1BMOfGF0Swj++fhBlF mpBPVszadAeDs/RFfd2y9e9x+aYOwSZ+HKiegKPe2kvRiJPdF8K6Q56ApbZ2Kj4ssyNl JTo327ySnBkPZ4lTIAVMF741olViO8VqYgHzQw/XbFVHo5TmEqCPN+sT032qhiydqYzs W/pa9b5nthBhmO+tkzzGPPKpqWReJqjnDkIODWSMPvSeohbtw5JW6+ZVNf+NdbLSeXzb BNbQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from; bh=cA+HDtnNjd71mZ1gLC8Htmgru6u42EAMAIyi97v+LjQ=; b=D1Nmt+3DzIT9WfzNJy/vFGAU3ygKsdWrnvwYoLcw6jwIjpMUdn0oESjEf/mLfnlAn8 62gtT1clBzmihJAJ/+lTkgz62y2aL/Td7tRwwZYmSa5M8YbGzmDTZT+QzOY3/TsNYbZV VbhR5BwWqrlVvgPn2zH2IAKAACLa34bESdhAruy0a0e1jCPCLNkZ4UVWyjcjsmy0aF8f +Rg6e0Oa8aprxT1lNczBs3YtinOBVL4O90ITO2tV9AhkFXzUaAS6HrfdGKCfva8axzK2 q9DF/ODa7zJxLzidtH8yoqQDtP2wzL1bWb2/lVC0z7urN9GpocQam/z1Lr/ThIP7uxS6 DOpw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id de5si10080759edb.586.2020.08.04.09.26.04; Tue, 04 Aug 2020 09:26:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729961AbgHDQZP (ORCPT + 99 others); Tue, 4 Aug 2020 12:25:15 -0400 Received: from bhuna.collabora.co.uk ([46.235.227.227]:34168 "EHLO bhuna.collabora.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729877AbgHDQYK (ORCPT ); Tue, 4 Aug 2020 12:24:10 -0400 Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: andrzej.p) with ESMTPSA id 971BB2950F5 From: Andrzej Pietrasiewicz To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , Jiri Slaby , Dmitry Torokhov , Andrzej Pietrasiewicz , linux-input@vger.kernel.org, kernel@collabora.com Subject: [PATCH 0/2] Add configurable handler to execute a compound action Date: Tue, 4 Aug 2020 18:24:00 +0200 Message-Id: <20200804162402.2087-1-andrzej.p@collabora.com> X-Mailer: git-send-email 2.17.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Patch 2/2 adds a configurable handler to execute a compound action. Userland might want to execute e.g. 'w' (show blocked tasks), followed by 's' (sync), followed by 1000 ms delay and then followed by 'c' (crash) upon a single magic SysRq. Or one might want to execute the famous "Raising Elephants Is So Utterly Boring" action. This patch adds a configurable handler, triggered with 'C', for this exact purpose. The user specifies the composition of the compound action using syntax similar to getopt, where each letter corresponds to an individual action and a colon followed by a number corresponds to a delay of that many milliseconds, e.g.: ws:1000c or r:100eis:1000ub An example of userspace that wants to perform a compound action is Chrome OS, where SysRq-X (pressed for the second time within a certain time period from the first time) causes showing the locked tasks, syncing, waiting a 1000 ms delay and crashing the system. Since all the slots in the sysrq_key_table[] are already taken or reserved, patch 1/2 extends it to cover also capital letter versions. Andrzej Pietrasiewicz (2): tty/sysrq: Extend the sysrq_key_table to cover capital letters tty/sysrq: Add configurable handler to execute a compound action Documentation/admin-guide/sysrq.rst | 11 +++ drivers/tty/sysrq.c | 128 +++++++++++++++++++++++++++- include/linux/sysrq.h | 1 + 3 files changed, 138 insertions(+), 2 deletions(-) base-commit: bcf876870b95592b52519ed4aafcf9d95999bc9c -- 2.17.1