1070 } |
1070 } |
1071 |
1071 |
1072 return 0; |
1072 return 0; |
1073 } |
1073 } |
1074 |
1074 |
|
1075 static PyObject *qemu_py_chardev_handle_connect(qemu_py_chardev *self, |
|
1076 PyObject *args) |
|
1077 { |
|
1078 if (!self->chr) |
|
1079 Py_RETURN_NONE; |
|
1080 |
|
1081 qemu_chr_connect(self->chr); |
|
1082 |
|
1083 Py_RETURN_NONE; |
|
1084 } |
|
1085 |
1075 static PyObject *qemu_py_chardev_set_handlers(qemu_py_chardev *self, |
1086 static PyObject *qemu_py_chardev_set_handlers(qemu_py_chardev *self, |
1076 PyObject *args, PyObject *kwds) |
1087 PyObject *args, PyObject *kwds) |
1077 { |
1088 { |
1078 static char *kwlist[] = {"can_receive", "receive", "event", NULL}; |
1089 static char *kwlist[] = {"can_receive", "receive", "event", NULL}; |
1079 PyObject *obcan_receive; |
1090 PyObject *obcan_receive; |
1145 static PyMemberDef qemu_py_chardev_members[] = { |
1156 static PyMemberDef qemu_py_chardev_members[] = { |
1146 {NULL} /* Sentinel */ |
1157 {NULL} /* Sentinel */ |
1147 }; |
1158 }; |
1148 |
1159 |
1149 static PyMethodDef qemu_py_chardev_methods[] = { |
1160 static PyMethodDef qemu_py_chardev_methods[] = { |
|
1161 {"handle_connect", (PyCFunction)qemu_py_chardev_handle_connect, |
|
1162 METH_NOARGS, |
|
1163 "Handle character device connect if required"}, |
1150 {"set_handlers", (PyCFunction)qemu_py_chardev_set_handlers, |
1164 {"set_handlers", (PyCFunction)qemu_py_chardev_set_handlers, |
1151 METH_VARARGS|METH_KEYWORDS, |
1165 METH_VARARGS|METH_KEYWORDS, |
1152 "Set event handlers"}, |
1166 "Set event handlers"}, |
1153 {"write", (PyCFunction)qemu_py_chardev_write, METH_VARARGS|METH_KEYWORDS, |
1167 {"write", (PyCFunction)qemu_py_chardev_write, METH_VARARGS|METH_KEYWORDS, |
1154 "Write a byte or string"}, |
1168 "Write a byte or string"}, |