From nobody Tue Feb 10 11:17:03 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1592945902; cv=none; d=zohomail.com; s=zohoarc; b=a+uVEZVqNOHJtwsEt37D5ip+MZqfY3GFwZqcVeAlVSAljSP6Z2JD3+ULoE1X2IcfhakOVBq2IBzL36Hlo5kDm4kxLcikeMcRoyWPh1hQ1VG34At0nOpMOSjGLmmiUFP0nVfAzZuoTFzXd+e+u08U1+Isnl3kflqh0BR+Cbvdyco= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1592945902; h=Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=z1kd224d8H2wZOV2L6bHE6YNgEwxD0YEIj3+8EoCivY=; b=ftxVZ43iqquqHOt2Yd5lMlPT/PsMqvDCL8RS6jBk1XPEEYJhiF75xCJkMpFjrVNneyNWS7YsmSc6StbJNw6C0/SRuC9I07PkVPyhsuVaRnUzjKlcz4UM0NJWwdaLpz9zXMmXvUusU+sMlT8iHYILX3mzIqa5p/Yiu3ig6H74tds= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 159294590234473.70706812867468; Tue, 23 Jun 2020 13:58:22 -0700 (PDT) Received: from localhost ([::1]:36308 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jnpzo-0000uF-Ve for importer@patchew.org; Tue, 23 Jun 2020 16:58:20 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45398) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jnpsW-0004jS-Ie; Tue, 23 Jun 2020 16:50:49 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]:56418 helo=mail.default.ilande.uk0.bigv.io) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jnpsU-0001pj-0a; Tue, 23 Jun 2020 16:50:48 -0400 Received: from host86-158-109-79.range86-158.btcentralplus.com ([86.158.109.79] helo=kentang.home) by mail.default.ilande.uk0.bigv.io with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jnpsO-0007T1-6J; Tue, 23 Jun 2020 21:50:47 +0100 From: Mark Cave-Ayland To: qemu-devel@nongnu.org, qemu-ppc@nongnu.org, laurent@vivier.eu, fthain@telegraphics.com.au Date: Tue, 23 Jun 2020 21:49:25 +0100 Message-Id: <20200623204936.24064-12-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200623204936.24064-1-mark.cave-ayland@ilande.co.uk> References: <20200623204936.24064-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-SA-Exim-Connect-IP: 86.158.109.79 X-SA-Exim-Mail-From: mark.cave-ayland@ilande.co.uk Subject: [PATCH v2 11/22] adb: introduce new ADBDeviceHasData method to ADBDeviceClass X-SA-Exim-Version: 4.2.1 (built Wed, 08 May 2019 21:11:16 +0000) X-SA-Exim-Scanned: Yes (on mail.default.ilande.uk0.bigv.io) Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2001:41c9:1:41f::167; envelope-from=mark.cave-ayland@ilande.co.uk; helo=mail.default.ilande.uk0.bigv.io X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" This is required later to allow devices to assert a service request (SRQ) signal to indicate that it has data to send, without having to consume it. Signed-off-by: Mark Cave-Ayland Tested-by: Finn Thain --- hw/input/adb-kbd.c | 8 ++++++++ hw/input/adb-mouse.c | 9 +++++++++ include/hw/input/adb.h | 3 +++ 3 files changed, 20 insertions(+) diff --git a/hw/input/adb-kbd.c b/hw/input/adb-kbd.c index 027dd3e531..23760ecf7b 100644 --- a/hw/input/adb-kbd.c +++ b/hw/input/adb-kbd.c @@ -300,6 +300,13 @@ static int adb_kbd_request(ADBDevice *d, uint8_t *obuf, return olen; } =20 +static bool adb_kbd_has_data(ADBDevice *d) +{ + KBDState *s =3D ADB_KEYBOARD(d); + + return s->count > 0; +} + /* This is where keyboard events enter this file */ static void adb_keyboard_event(DeviceState *dev, QemuConsole *src, InputEvent *evt) @@ -382,6 +389,7 @@ static void adb_kbd_class_init(ObjectClass *oc, void *d= ata) set_bit(DEVICE_CATEGORY_INPUT, dc->categories); =20 adc->devreq =3D adb_kbd_request; + adc->devhasdata =3D adb_kbd_has_data; dc->reset =3D adb_kbd_reset; dc->vmsd =3D &vmstate_adb_kbd; } diff --git a/hw/input/adb-mouse.c b/hw/input/adb-mouse.c index 78b6f5030c..e2359fd74d 100644 --- a/hw/input/adb-mouse.c +++ b/hw/input/adb-mouse.c @@ -197,6 +197,14 @@ static int adb_mouse_request(ADBDevice *d, uint8_t *ob= uf, return olen; } =20 +static bool adb_mouse_has_data(ADBDevice *d) +{ + MouseState *s =3D ADB_MOUSE(d); + + return !(s->last_buttons_state =3D=3D s->buttons_state && + s->dx =3D=3D 0 && s->dy =3D=3D 0); +} + static void adb_mouse_reset(DeviceState *dev) { ADBDevice *d =3D ADB_DEVICE(dev); @@ -252,6 +260,7 @@ static void adb_mouse_class_init(ObjectClass *oc, void = *data) set_bit(DEVICE_CATEGORY_INPUT, dc->categories); =20 adc->devreq =3D adb_mouse_request; + adc->devhasdata =3D adb_mouse_has_data; dc->reset =3D adb_mouse_reset; dc->vmsd =3D &vmstate_adb_mouse; } diff --git a/include/hw/input/adb.h b/include/hw/input/adb.h index 15b1874a3d..9b80204e43 100644 --- a/include/hw/input/adb.h +++ b/include/hw/input/adb.h @@ -39,6 +39,8 @@ typedef struct ADBDevice ADBDevice; typedef int ADBDeviceRequest(ADBDevice *d, uint8_t *buf_out, const uint8_t *buf, int len); =20 +typedef bool ADBDeviceHasData(ADBDevice *d); + #define TYPE_ADB_DEVICE "adb-device" #define ADB_DEVICE(obj) OBJECT_CHECK(ADBDevice, (obj), TYPE_ADB_DEVICE) =20 @@ -62,6 +64,7 @@ typedef struct ADBDeviceClass { /*< public >*/ =20 ADBDeviceRequest *devreq; + ADBDeviceHasData *devhasdata; } ADBDeviceClass; =20 #define TYPE_ADB_BUS "apple-desktop-bus" --=20 2.20.1