EmulTouchEvent vbuf[MAX_BUF_COUNT];
EmulTouchEvent *event = NULL;
int err = 0;
- int len = 0; /* not used */
- int index = 0;
- int recv_index = 0;
- int id = 0; /* finger id */
+ unsigned int len = 0; /* not used */
+ unsigned int index = 0;
+ unsigned int recv_index = 0;
+ unsigned int id = 0; /* finger id */
struct input_dev *input_dev = NULL;
for (index = 0; index < MAX_BUF_COUNT; index++) {
sg_set_buf(&sg[index], &vbuf[index], sizeof(EmulTouchEvent));
+
err = virtqueue_add_buf(vt->vq, sg, 0, index + 1, (void *)index + 1, GFP_ATOMIC);
if (err < 0) {
printk(KERN_ERR "failed to add buf\n");
}
+ virtqueue_kick(vt->vq);
}
index = 0;
- while (!kthread_should_stop()) {
- //virtqueue_kick(vt->vq);
-
- while (!(recv_index = virtqueue_get_buf(vt->vq, &len))) {
+ while (!kthread_should_stop())
+ {
+ while ((recv_index = (unsigned int)virtqueue_get_buf(vt->vq, &len)) == 0) {
cpu_relax();
}
input_sync(input_dev);
+ /* expose buffer to other end */
err = virtqueue_add_buf(vt->vq, sg, 0, recv_index, (void *)recv_index, GFP_ATOMIC);
if (err < 0) {
printk(KERN_ERR "failed to add buf\n");
}
+ virtqueue_kick(vt->vq);
}
printk(KERN_INFO "virtio touchscreen thread is stopped\n");
}
struct file_operations virtio_touchscreen_fops = {
- .owner = THIS_MODULE,
- .open = virtio_touchscreen_open,
- .release = virtio_touchscreen_release,
+ .owner = THIS_MODULE,
+ .open = virtio_touchscreen_open,
+ .release = virtio_touchscreen_release,
};
static int virtio_touchscreen_probe(struct virtio_device *vdev)
vt->vdev = vdev;
vt->vq = virtio_find_single_vq(vt->vdev,
- vq_touchscreen_callback, "virtio-touchscreen-vq");
+ NULL /* vq_touchscreen_callback */, "virtio-touchscreen-vq");
if (IS_ERR(vt->vq)) {
ret = PTR_ERR(vt->vq);
goto fail1;
MODULE_DEVICE_TABLE(virtio, id_table);
static struct virtio_driver virtio_touchscreen_driver = {
- //.feature_table = features,
- //.feature_table_size = ARRAY_SIZE(features),
.driver.name = KBUILD_MODNAME,
.driver.owner = THIS_MODULE,
.id_table = id_table,
.probe = virtio_touchscreen_probe,
.remove = __devexit_p(virtio_touchscreen_remove),
#if 0
+ .feature_table = features,
+ .feature_table_size = ARRAY_SIZE(features),
.config_changed =
#ifdef CONFIG_PM
.freeze =