Hi group,
I am trying to figure out how the input layer of
the kernel 2.6.7 works. Right now I am trying to read the file mousedev.c. Can
anybody tell me what this function below does? (it is located in mousedev.c). I
am hoping someone can tell me that?
Thanks in advance,
Paul Akkermans
static void mousedev_packet(struct mousedev_list
*list, unsigned char off)
{ list->ps2[off] = 0x08 | ((list->dx < 0) << 4) | ((list->dy < 0) << 5) | (list->buttons & 0x07); list->ps2[off + 1] = (list->dx > 127 ? 127 : (list->dx < -127 ? -127 : list->dx)); list->ps2[off + 2] = (list->dy > 127 ? 127 : (list->dy < -127 ? -127 : list->dy)); list->dx -= list->ps2[off + 1]; list->dy -= list->ps2[off + 2]; list->bufsiz = off + 3; if (list->mode == 2)
{
list->ps2[off + 3] = (list->dz > 7 ? 7 : (list->dz < -7 ? -7 : list->dz)); list->dz -= list->ps2[off + 3]; list->ps2[off + 3] = (list->ps2[off + 3] & 0x0f) | ((list->buttons & 0x18) << 1); list->bufsiz++; } else { list->ps2[off] |= ((list->buttons & 0x10) >> 3) | ((list->buttons & 0x08) >> 1); } if (list->mode == 1)
{
list->ps2[off + 3] = (list->dz > 127 ? 127 : (list->dz < -127 ? -127 : list->dz)); list->dz -= list->ps2[off + 3]; list->bufsiz++; } if (!list->dx && !list->dy
&& (!list->mode || !list->dz)) list->ready =
0;
list->buffer = list->bufsiz; } |