Hi all,


I am doing some experiments involving very accurate timing of mouse
movement.

I have some questions regarding where different functions are to be
found in the kernel source.

I would also appreciate if more experienced kernel hackers than me would
like to comment on my ideas how it is best to do this stuff.



The goals are:

     1. that the latency from movement until the timing of the movement
        has been found is as stable as possible
        
     2. as there is not more going on in the computer than 1. and a
        rather simple graphical program, that the overall processing
        speed of the mouse signal should be fast.
        
        

As I see it these goals can be split to the following tasks:

     1. find where in the kernel data is written to e.g. /dev/psaux
        
     2. see the datastructures in the kernel that are used when data is
        written to e.g. /dev/psaux 
        
     3. see if it is possible to copy the definition of the
        datastructures in 3 and add a timestamp and serial num ber field
        
     4. find where the speed of the USB query is set as high as possible
        
     5. read the time accurately in the kernel
        
        

I have read the available documentation of the usb processing in the
kernel, that I could finde, but found it hard to find what I was looking
for.


in drivers/usb/usbmouse there is a function called usb_mouse_irq this
one calls the function input_event

which after checking the bite containing the shift of either the x or y
position of the mouse, has this code:


if (dev->grab)
188                 dev->grab->handler->event(dev->grab, type, code, value);
189         else
190                 list_for_each_entry(handle, &dev->h_list, d_node)
191                         if (handle->open)
192                                 handle->handler->event(handle, type, code, value);

I guess, that one could find out the name of the handler called here in
the registration function, but I have not found this. It would also be
of interest to find something like a âcopy_to_userâ function, which must
be used in the end.

After the event function has been awakended the usb_mouse_irq function
sends an urb that I am also a bit couries what is the purpose of.


Probably I should also remove the call to 76 add_mouse_randomness((type
<< 4) ^ code ^ (code >> 4) ^ value);

as I really care about precision.


I am using an USB 2.0 mouse (I thought that something like Logtech MX310
or even the cordless MX700 where best here ).

To set the maximum speed I should set the last argument in 


/usb/input/usbmouse  
usb_mouse_probe



  usb_fill_int_urb(mouse->irq, dev, pipe, mouse->data,
207                          (maxp > 8 ? 8 : maxp),
208                          usb_mouse_irq, mouse, endpoint->bInterval);
to  USB_SPEED_HIGH to get 1 microframe (125 micro sec) interrupt delay.

for accurate timing I planned to use e.g. rdtscll. 


Possibly is it also not bad not to set the USB_DISABLE_SPD bit in
transfer_flags.


Acutally I found the drivers in /linux/drivers/input/mouse easier to
understand than linux/drivers/usb/ , but they are for the slower PS/2
mouses and not for usb mouses.


I considered using RTAI linux for getting a stable latency untill the
timing of the mouse interrupt is timestampt, but thought, that probably
this could be done just as well by hacking the mouse driver.


:)


Hedinn





-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click
_______________________________________________
[EMAIL PROTECTED]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to