chardev: add braille support to qapi

This patch adds 'braille' support to qapi and also switches over
the braille chardev initialization to the new qapi code path.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
This commit is contained in:
Gerd Hoffmann 2013-02-21 12:56:10 +01:00
parent f5a51cab2a
commit 2d57286da6
4 changed files with 12 additions and 3 deletions

View File

@ -561,7 +561,7 @@ static void baum_close(struct CharDriverState *chr)
g_free(baum); g_free(baum);
} }
static CharDriverState *chr_baum_init(QemuOpts *opts) CharDriverState *chr_baum_init(void)
{ {
BaumDriverState *baum; BaumDriverState *baum;
CharDriverState *chr; CharDriverState *chr;
@ -627,7 +627,7 @@ fail_handle:
static void register_types(void) static void register_types(void)
{ {
register_char_driver("braille", chr_baum_init); register_char_driver_qapi("braille", CHARDEV_BACKEND_KIND_BRAILLE, NULL);
} }
type_init(register_types); type_init(register_types);

View File

@ -264,4 +264,7 @@ CharDriverState *qemu_char_get_next_serial(void);
/* msmouse */ /* msmouse */
CharDriverState *qemu_chr_open_msmouse(void); CharDriverState *qemu_chr_open_msmouse(void);
/* baum.c */
CharDriverState *chr_baum_init(void);
#endif #endif

View File

@ -3211,7 +3211,8 @@
'pty' : 'ChardevDummy', 'pty' : 'ChardevDummy',
'null' : 'ChardevDummy', 'null' : 'ChardevDummy',
'mux' : 'ChardevMux', 'mux' : 'ChardevMux',
'msmouse': 'ChardevDummy' } } 'msmouse': 'ChardevDummy',
'braille': 'ChardevDummy' } }
## ##
# @ChardevReturn: # @ChardevReturn:

View File

@ -3722,6 +3722,11 @@ ChardevReturn *qmp_chardev_add(const char *id, ChardevBackend *backend,
case CHARDEV_BACKEND_KIND_MSMOUSE: case CHARDEV_BACKEND_KIND_MSMOUSE:
chr = qemu_chr_open_msmouse(); chr = qemu_chr_open_msmouse();
break; break;
#ifdef CONFIG_BRLAPI
case CHARDEV_BACKEND_KIND_BRAILLE:
chr = chr_baum_init();
break;
#endif
default: default:
error_setg(errp, "unknown chardev backend (%d)", backend->kind); error_setg(errp, "unknown chardev backend (%d)", backend->kind);
break; break;