From nobody Wed May 8 13:04:09 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1487591117096177.76548821368112; Mon, 20 Feb 2017 03:45:17 -0800 (PST) Received: from localhost ([::1]:37649 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cfmP4-0001hK-Vj for importer@patchew.org; Mon, 20 Feb 2017 06:45:15 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36594) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cfmNr-0000pH-Hp for qemu-devel@nongnu.org; Mon, 20 Feb 2017 06:44:00 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cfmNo-0006Pk-P8 for qemu-devel@nongnu.org; Mon, 20 Feb 2017 06:43:59 -0500 Received: from mx1.redhat.com ([209.132.183.28]:58941) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cfmNo-0006PK-Iu for qemu-devel@nongnu.org; Mon, 20 Feb 2017 06:43:56 -0500 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 8D7F0C04BD3D; Mon, 20 Feb 2017 11:43:56 +0000 (UTC) Received: from nilsson.home.kraxel.org (ovpn-116-71.ams2.redhat.com [10.36.116.71]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v1KBhtg3019069; Mon, 20 Feb 2017 06:43:56 -0500 Received: by nilsson.home.kraxel.org (Postfix, from userid 500) id 1799680E57; Mon, 20 Feb 2017 12:43:54 +0100 (CET) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Mon, 20 Feb 2017 12:43:50 +0100 Message-Id: <1487591031-28991-2-git-send-email-kraxel@redhat.com> In-Reply-To: <1487591031-28991-1-git-send-email-kraxel@redhat.com> References: <1487591031-28991-1-git-send-email-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.27 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Mon, 20 Feb 2017 11:43:56 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 1/2] ps2: fix mouse mappings for right/middle button X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Gerd Hoffmann , Fabian Lesniak Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Fabian Lesniak Commit 8b0caab0 ("ps2: add support for mice with extra/side buttons") accidentally swapped right and middle mouse buttons. This commit corrects the mapping as expected by the ps2 controller. Signed-off-by: Fabian Lesniak Message-id: 20170204150319.8907-1-fabian@lesniak-it.de Signed-off-by: Gerd Hoffmann --- include/hw/input/ps2.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/hw/input/ps2.h b/include/hw/input/ps2.h index 0fec91c..7f0a80a 100644 --- a/include/hw/input/ps2.h +++ b/include/hw/input/ps2.h @@ -26,8 +26,8 @@ #define HW_PS2_H =20 #define PS2_MOUSE_BUTTON_LEFT 0x01 -#define PS2_MOUSE_BUTTON_MIDDLE 0x02 -#define PS2_MOUSE_BUTTON_RIGHT 0x04 +#define PS2_MOUSE_BUTTON_RIGHT 0x02 +#define PS2_MOUSE_BUTTON_MIDDLE 0x04 #define PS2_MOUSE_BUTTON_SIDE 0x08 #define PS2_MOUSE_BUTTON_EXTRA 0x10 =20 --=20 1.8.3.1 From nobody Wed May 8 13:04:09 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1487591265782963.0248822259816; Mon, 20 Feb 2017 03:47:45 -0800 (PST) Received: from localhost ([::1]:37661 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cfmRU-0003SJ-DX for importer@patchew.org; Mon, 20 Feb 2017 06:47:44 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36616) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cfmNs-0000pI-2B for qemu-devel@nongnu.org; Mon, 20 Feb 2017 06:44:03 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cfmNp-0006QK-Vb for qemu-devel@nongnu.org; Mon, 20 Feb 2017 06:44:00 -0500 Received: from mx1.redhat.com ([209.132.183.28]:44116) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cfmNp-0006Pt-Lm for qemu-devel@nongnu.org; Mon, 20 Feb 2017 06:43:57 -0500 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id BD3624E4D4; Mon, 20 Feb 2017 11:43:57 +0000 (UTC) Received: from nilsson.home.kraxel.org (ovpn-116-71.ams2.redhat.com [10.36.116.71]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v1KBhuMl028860; Mon, 20 Feb 2017 06:43:56 -0500 Received: by nilsson.home.kraxel.org (Postfix, from userid 500) id E3AEF80CA0; Mon, 20 Feb 2017 12:43:54 +0100 (CET) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Mon, 20 Feb 2017 12:43:51 +0100 Message-Id: <1487591031-28991-3-git-send-email-kraxel@redhat.com> In-Reply-To: <1487591031-28991-1-git-send-email-kraxel@redhat.com> References: <1487591031-28991-1-git-send-email-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Mon, 20 Feb 2017 11:43:57 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 2/2] Add wctablet device X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Markus Armbruster , Anatoli Huseu1 , Gerd Hoffmann , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Paolo Bonzini Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Anatoli Huseu1 Add QEMU Wacom Penpartner serial tablet emulation. GSoC 2016 project. Signed-off-by: Anatoli Huseu1 Various cleanups. Add line speed tracking. Implement ST and SP commands. Adapted to chardev QOMification. Signed-off-by: Gerd Hoffmann Message-id: 1486391007-10116-1-git-send-email-kraxel@redhat.com --- Makefile.objs | 1 + backends/Makefile.objs | 2 +- backends/trace-events | 10 ++ backends/wctablet.c | 369 +++++++++++++++++++++++++++++++++++++++++++= ++++ chardev/char.c | 1 + docs/qdev-device-use.txt | 2 +- qapi-schema.json | 3 +- 7 files changed, 385 insertions(+), 3 deletions(-) create mode 100644 backends/trace-events create mode 100644 backends/wctablet.c diff --git a/Makefile.objs b/Makefile.objs index 431fc59..e4bfc16 100644 --- a/Makefile.objs +++ b/Makefile.objs @@ -125,6 +125,7 @@ trace-events-subdirs +=3D crypto trace-events-subdirs +=3D io trace-events-subdirs +=3D migration trace-events-subdirs +=3D block +trace-events-subdirs +=3D backends trace-events-subdirs +=3D hw/block trace-events-subdirs +=3D hw/block/dataplane trace-events-subdirs +=3D hw/char diff --git a/backends/Makefile.objs b/backends/Makefile.objs index 1846998..0e0f156 100644 --- a/backends/Makefile.objs +++ b/backends/Makefile.objs @@ -1,7 +1,7 @@ common-obj-y +=3D rng.o rng-egd.o common-obj-$(CONFIG_POSIX) +=3D rng-random.o =20 -common-obj-y +=3D msmouse.o testdev.o +common-obj-y +=3D msmouse.o wctablet.o testdev.o common-obj-$(CONFIG_BRLAPI) +=3D baum.o baum.o-cflags :=3D $(SDL_CFLAGS) =20 diff --git a/backends/trace-events b/backends/trace-events new file mode 100644 index 0000000..8c3289a --- /dev/null +++ b/backends/trace-events @@ -0,0 +1,10 @@ +# See docs/tracing.txt for syntax documentation. + +# backends/wctablet.c +wct_init(void) "" +wct_cmd_re(void) "" +wct_cmd_st(void) "" +wct_cmd_sp(void) "" +wct_cmd_ts(int input) "0x%02x" +wct_cmd_other(const char *cmd) "%s" +wct_speed(int speed) "%d" diff --git a/backends/wctablet.c b/backends/wctablet.c new file mode 100644 index 0000000..a4d3ae0 --- /dev/null +++ b/backends/wctablet.c @@ -0,0 +1,369 @@ +/* + * QEMU Wacom Penpartner serial tablet emulation + * + * some protocol details: + * http://linuxwacom.sourceforge.net/wiki/index.php/Serial_Protocol_IV + * + * Copyright (c) 2016 Anatoli Huseu1 + * Copyright (c) 2016,17 Gerd Hoffmann + * + * Permission is hereby granted, free of charge, to any person obtaining a= copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included= in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS= OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OT= HER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING= FROM + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS = IN + * THE SOFTWARE. + */ +#include +#include +#include +#include + +#include "qemu/osdep.h" +#include "qemu-common.h" +#include "sysemu/char.h" +#include "ui/console.h" +#include "ui/input.h" +#include "trace.h" + + +#define WC_OUTPUT_BUF_MAX_LEN 512 +#define WC_COMMAND_MAX_LEN 60 + +#define WC_L7(n) ((n) & 127) +#define WC_M7(n) (((n) >> 7) & 127) +#define WC_H2(n) ((n) >> 14) + +#define WC_L4(n) ((n) & 15) +#define WC_H4(n) (((n) >> 4) & 15) + +/* Model string and config string */ +#define WC_MODEL_STRING_LENGTH 18 +uint8_t WC_MODEL_STRING[WC_MODEL_STRING_LENGTH + 1] =3D "~#CT-0045R,V1.3-5= ,"; + +#define WC_CONFIG_STRING_LENGTH 8 +uint8_t WC_CONFIG_STRING[WC_CONFIG_STRING_LENGTH + 1] =3D "96,N,8,0"; + +#define WC_FULL_CONFIG_STRING_LENGTH 61 +uint8_t WC_FULL_CONFIG_STRING[WC_FULL_CONFIG_STRING_LENGTH + 1] =3D { + 0x5c, 0x39, 0x36, 0x2c, 0x4e, 0x2c, 0x38, 0x2c, + 0x31, 0x28, 0x01, 0x24, 0x57, 0x41, 0x43, 0x30, + 0x30, 0x34, 0x35, 0x5c, 0x5c, 0x50, 0x45, 0x4e, 0x5c, + 0x57, 0x41, 0x43, 0x30, 0x30, 0x30, 0x30, 0x5c, + 0x54, 0x61, 0x62, 0x6c, 0x65, 0x74, 0x0d, 0x0a, + 0x43, 0x54, 0x2d, 0x30, 0x30, 0x34, 0x35, 0x52, + 0x2c, 0x56, 0x31, 0x2e, 0x33, 0x2d, 0x35, 0x0d, + 0x0a, 0x45, 0x37, 0x29 +}; + +/* This structure is used to save private info for Wacom Tablet. */ +typedef struct { + Chardev parent; + QemuInputHandlerState *hs; + + /* Query string from serial */ + uint8_t query[100]; + int query_index; + + /* Command to be sent to serial port */ + uint8_t outbuf[WC_OUTPUT_BUF_MAX_LEN]; + int outlen; + + int line_speed; + bool send_events; + int axis[INPUT_AXIS__MAX]; + bool btns[INPUT_BUTTON__MAX]; + +} TabletChardev; + +#define TYPE_CHARDEV_WCTABLET "chardev-wctablet" +#define WCTABLET_CHARDEV(obj) \ + OBJECT_CHECK(TabletChardev, (obj), TYPE_CHARDEV_WCTABLET) + + +static void wctablet_chr_accept_input(Chardev *chr); + +static void wctablet_shift_input(TabletChardev *tablet, int count) +{ + tablet->query_index -=3D count; + memmove(tablet->query, tablet->query + count, tablet->query_index); + tablet->query[tablet->query_index] =3D 0; +} + +static void wctablet_queue_output(TabletChardev *tablet, uint8_t *buf, int= count) +{ + if (tablet->outlen + count > sizeof(tablet->outbuf)) { + return; + } + + memcpy(tablet->outbuf + tablet->outlen, buf, count); + tablet->outlen +=3D count; + wctablet_chr_accept_input(CHARDEV(tablet)); +} + +static void wctablet_reset(TabletChardev *tablet) +{ + /* clear buffers */ + tablet->query_index =3D 0; + tablet->outlen =3D 0; + /* reset state */ + tablet->send_events =3D false; +} + +static void wctablet_queue_event(TabletChardev *tablet) +{ + uint8_t codes[8] =3D { 0xe0, 0, 0, 0, 0, 0, 0 }; + + if (tablet->line_speed !=3D 9600) { + return; + } + + int newX =3D tablet->axis[INPUT_AXIS_X] * 0.1537; + int nexY =3D tablet->axis[INPUT_AXIS_Y] * 0.1152; + + codes[0] =3D codes[0] | WC_H2(newX); + codes[1] =3D codes[1] | WC_M7(newX); + codes[2] =3D codes[2] | WC_L7(newX); + + codes[3] =3D codes[3] | WC_H2(nexY); + codes[4] =3D codes[4] | WC_M7(nexY); + codes[5] =3D codes[5] | WC_L7(nexY); + + if (tablet->btns[INPUT_BUTTON_LEFT]) { + codes[0] =3D 0xa0; + } + + wctablet_queue_output(tablet, codes, 7); +} + +static void wctablet_input_event(DeviceState *dev, QemuConsole *src, + InputEvent *evt) +{ + TabletChardev *tablet =3D (TabletChardev *)dev; + InputMoveEvent *move; + InputBtnEvent *btn; + + switch (evt->type) { + case INPUT_EVENT_KIND_ABS: + move =3D evt->u.abs.data; + tablet->axis[move->axis] =3D move->value; + break; + + case INPUT_EVENT_KIND_BTN: + btn =3D evt->u.btn.data; + tablet->btns[btn->button] =3D btn->down; + break; + + default: + /* keep gcc happy */ + break; + } +} + +static void wctablet_input_sync(DeviceState *dev) +{ + TabletChardev *tablet =3D (TabletChardev *)dev; + + if (tablet->send_events) { + wctablet_queue_event(tablet); + } +} + +static QemuInputHandler wctablet_handler =3D { + .name =3D "QEMU Wacome Pen Tablet", + .mask =3D INPUT_EVENT_MASK_BTN | INPUT_EVENT_MASK_ABS, + .event =3D wctablet_input_event, + .sync =3D wctablet_input_sync, +}; + +static void wctablet_chr_accept_input(Chardev *chr) +{ + TabletChardev *tablet =3D WCTABLET_CHARDEV(chr); + int len, canWrite; + + canWrite =3D qemu_chr_be_can_write(chr); + len =3D canWrite; + if (len > tablet->outlen) { + len =3D tablet->outlen; + } + + if (len) { + qemu_chr_be_write(chr, tablet->outbuf, len); + tablet->outlen -=3D len; + if (tablet->outlen) { + memmove(tablet->outbuf, tablet->outbuf + len, tablet->outlen); + } + } +} + +static int wctablet_chr_write(struct Chardev *chr, + const uint8_t *buf, int len) +{ + TabletChardev *tablet =3D WCTABLET_CHARDEV(chr); + unsigned int i, clen; + char *pos; + + if (tablet->line_speed !=3D 9600) { + return len; + } + for (i =3D 0; i < len && tablet->query_index < sizeof(tablet->query) -= 1; i++) { + tablet->query[tablet->query_index++] =3D buf[i]; + } + tablet->query[tablet->query_index] =3D 0; + + while (tablet->query_index > 0 && (tablet->query[0] =3D=3D '@' || + tablet->query[0] =3D=3D '\r' || + tablet->query[0] =3D=3D '\n')) { + wctablet_shift_input(tablet, 1); + } + if (!tablet->query_index) { + return len; + } + + if (strncmp((char *)tablet->query, "~#", 2) =3D=3D 0) { + /* init / detect sequence */ + trace_wct_init(); + wctablet_shift_input(tablet, 2); + wctablet_queue_output(tablet, WC_MODEL_STRING, + WC_MODEL_STRING_LENGTH); + return len; + } + + /* detect line */ + pos =3D strchr((char *)tablet->query, '\r'); + if (!pos) { + pos =3D strchr((char *)tablet->query, '\n'); + } + if (!pos) { + return len; + } + clen =3D pos - (char *)tablet->query; + + /* process commands */ + if (strncmp((char *)tablet->query, "RE", 2) =3D=3D 0 && + clen =3D=3D 2) { + trace_wct_cmd_re(); + wctablet_shift_input(tablet, 3); + wctablet_queue_output(tablet, WC_CONFIG_STRING, + WC_CONFIG_STRING_LENGTH); + + } else if (strncmp((char *)tablet->query, "ST", 2) =3D=3D 0 && + clen =3D=3D 2) { + trace_wct_cmd_st(); + wctablet_shift_input(tablet, 3); + tablet->send_events =3D true; + wctablet_queue_event(tablet); + + } else if (strncmp((char *)tablet->query, "SP", 2) =3D=3D 0 && + clen =3D=3D 2) { + trace_wct_cmd_sp(); + wctablet_shift_input(tablet, 3); + tablet->send_events =3D false; + + } else if (strncmp((char *)tablet->query, "TS", 2) =3D=3D 0 && + clen =3D=3D 3) { + unsigned int input =3D tablet->query[2]; + uint8_t codes[7] =3D { + 0xa3, + ((input & 0x80) =3D=3D 0) ? 0x7e : 0x7f, + (((WC_H4(input) & 0x7) ^ 0x5) << 4) | (WC_L4(input) ^ 0x7), + 0x03, + 0x7f, + 0x7f, + 0x00, + }; + trace_wct_cmd_ts(input); + wctablet_shift_input(tablet, 4); + wctablet_queue_output(tablet, codes, 7); + + } else { + tablet->query[clen] =3D 0; /* terminate line for printing */ + trace_wct_cmd_other((char *)tablet->query); + wctablet_shift_input(tablet, clen + 1); + + } + + return len; +} + +static int wctablet_chr_ioctl(Chardev *chr, int cmd, void *arg) +{ + TabletChardev *tablet =3D WCTABLET_CHARDEV(chr); + QEMUSerialSetParams *ssp; + + switch (cmd) { + case CHR_IOCTL_SERIAL_SET_PARAMS: + ssp =3D arg; + if (tablet->line_speed !=3D ssp->speed) { + trace_wct_speed(ssp->speed); + wctablet_reset(tablet); + tablet->line_speed =3D ssp->speed; + } + break; + default: + return -ENOTSUP; + } + return 0; +} + +static void wctablet_chr_finalize(Object *obj) +{ + TabletChardev *tablet =3D WCTABLET_CHARDEV(obj); + + qemu_input_handler_unregister(tablet->hs); + g_free(tablet); +} + +static void wctablet_chr_open(Chardev *chr, + ChardevBackend *backend, + bool *be_opened, + Error **errp) +{ + TabletChardev *tablet =3D WCTABLET_CHARDEV(chr); + + *be_opened =3D true; + + /* init state machine */ + memcpy(tablet->outbuf, WC_FULL_CONFIG_STRING, WC_FULL_CONFIG_STRING_LE= NGTH); + tablet->outlen =3D WC_FULL_CONFIG_STRING_LENGTH; + tablet->query_index =3D 0; + + tablet->hs =3D qemu_input_handler_register((DeviceState *)tablet, + &wctablet_handler); +} + +static void wctablet_chr_class_init(ObjectClass *oc, void *data) +{ + ChardevClass *cc =3D CHARDEV_CLASS(oc); + + cc->open =3D wctablet_chr_open; + cc->chr_write =3D wctablet_chr_write; + cc->chr_ioctl =3D wctablet_chr_ioctl; + cc->chr_accept_input =3D wctablet_chr_accept_input; +} + +static const TypeInfo wctablet_type_info =3D { + .name =3D TYPE_CHARDEV_WCTABLET, + .parent =3D TYPE_CHARDEV, + .instance_size =3D sizeof(TabletChardev), + .instance_finalize =3D wctablet_chr_finalize, + .class_init =3D wctablet_chr_class_init, +}; + +static void register_types(void) +{ + type_register_static(&wctablet_type_info); +} + +type_init(register_types); diff --git a/chardev/char.c b/chardev/char.c index abd525f..54cd5f4 100644 --- a/chardev/char.c +++ b/chardev/char.c @@ -652,6 +652,7 @@ QemuOpts *qemu_chr_parse_compat(const char *label, cons= t char *filename) if (strcmp(filename, "null") =3D=3D 0 || strcmp(filename, "pty") =3D=3D 0 || strcmp(filename, "msmouse") =3D=3D 0 || + strcmp(filename, "wctablet") =3D=3D 0 || strcmp(filename, "braille") =3D=3D 0 || strcmp(filename, "testdev") =3D=3D 0 || strcmp(filename, "stdio") =3D=3D 0) { diff --git a/docs/qdev-device-use.txt b/docs/qdev-device-use.txt index 136d271..b059405 100644 --- a/docs/qdev-device-use.txt +++ b/docs/qdev-device-use.txt @@ -200,7 +200,7 @@ LEGACY-CHARDEV translates to -chardev HOST-OPTS... as f= ollows: =20 * null becomes -chardev null =20 -* pty, msmouse, braille, stdio likewise +* pty, msmouse, wctablet, braille, stdio likewise =20 * vc:WIDTHxHEIGHT becomes -chardev vc,width=3DWIDTH,height=3DHEIGHT =20 diff --git a/qapi-schema.json b/qapi-schema.json index baa0d26..e9a6364 100644 --- a/qapi-schema.json +++ b/qapi-schema.json @@ -4890,7 +4890,7 @@ # # Configuration info for the new chardev backend. # -# Since: 1.4 (testdev since 2.2) +# Since: 1.4 (testdev since 2.2, wctablet since 2.9) ## { 'union': 'ChardevBackend', 'data': { 'file' : 'ChardevFile', 'serial' : 'ChardevHostdev', @@ -4902,6 +4902,7 @@ 'null' : 'ChardevCommon', 'mux' : 'ChardevMux', 'msmouse': 'ChardevCommon', + 'wctablet' : 'ChardevCommon', 'braille': 'ChardevCommon', 'testdev': 'ChardevCommon', 'stdio' : 'ChardevStdio', --=20 1.8.3.1