LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware
User Name
Password
Linux - Hardware This forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?

Notices


Reply
  Search this Thread
Old 08-17-2018, 03:52 AM   #1
Poison Nuke
Member
 
Registered: Aug 2012
Location: Germany
Posts: 41

Rep: Reputation: Disabled
Polling-Rate for USB-Touchpad?


Hello,

is there a way to set the polling rate for a touchpad?
Im using a Magic Trackpad 2 and Im receiving 90 updates per second from my customized kernel-module.

But bInterval in lsmod reports an poll-rate of 8ms, how is that possible? So it should update 125 times a second, not only 90.

Ive tried to set the mousepoll option in usbhid without effect.

It is a Raspbian with kernel 4.17.
 
Old 08-17-2018, 04:16 PM   #2
ferrari
LQ Guru
 
Registered: Sep 2003
Location: Auckland, NZ
Distribution: openSUSE Leap
Posts: 5,791

Rep: Reputation: 1140Reputation: 1140Reputation: 1140Reputation: 1140Reputation: 1140Reputation: 1140Reputation: 1140Reputation: 1140Reputation: 1140
This Archwiki reference may be helpful here
https://wiki.archlinux.org/index.php/Mouse_polling_rate
In particular, this link to the section about polling rates not changing when plugged in to a USB3.0 port (with the xhci_hcd driver)...
https://wiki.archlinux.org/index.php...e_not_changing
 
Old 08-18-2018, 03:45 AM   #3
Poison Nuke
Member
 
Registered: Aug 2012
Location: Germany
Posts: 41

Original Poster
Rep: Reputation: Disabled
thank you, but Ive tried that and some other mousepoll tutorials already, but didnt change anything.

I also wonder, why bInterval (and so evhz too) is reporting 8 ms, but still there are only 90 updates per second ?
 
Old 08-18-2018, 03:52 AM   #4
ferrari
LQ Guru
 
Registered: Sep 2003
Location: Auckland, NZ
Distribution: openSUSE Leap
Posts: 5,791

Rep: Reputation: 1140Reputation: 1140Reputation: 1140Reputation: 1140Reputation: 1140Reputation: 1140Reputation: 1140Reputation: 1140Reputation: 1140
I was pointing you at a possible reason why the polling rate might not be work as expected. Is the the mouse connected to a USB 2.0 or USB 3.0 port? Is the xhci_hcd driver in use for that port?

Report back with the output of
Code:
sudo cat /sys/kernel/debug/usb/devices
or
Code:
usb-devices
 
Old 08-18-2018, 04:08 AM   #5
Poison Nuke
Member
 
Registered: Aug 2012
Location: Germany
Posts: 41

Original Poster
Rep: Reputation: Disabled
can do this on monday. But it is a Raspberry Pi 3B+ so cant be a USB3 for sure

the driver in use is the bcm5974 (a USB driver), which I modified slightly to send the polled data to my application directly. The system is a raspbian with simple Xfce desktop so that the Xorg-Server will run the driver. So possibly I have to change something on the xorg settings?
 
Old 08-18-2018, 04:12 AM   #6
ferrari
LQ Guru
 
Registered: Sep 2003
Location: Auckland, NZ
Distribution: openSUSE Leap
Posts: 5,791

Rep: Reputation: 1140Reputation: 1140Reputation: 1140Reputation: 1140Reputation: 1140Reputation: 1140Reputation: 1140Reputation: 1140Reputation: 1140
It's more about the Linux *-hcd driver in use than the port. Don't get confused between the kernel and Xorg (userspace) input drivers.
 
Old 08-18-2018, 07:09 AM   #7
Poison Nuke
Member
 
Registered: Aug 2012
Location: Germany
Posts: 41

Original Poster
Rep: Reputation: Disabled
what drivers are possible and which one would be worse?
And if I have that "bad" driver, could I easily change some lines of code in the source and recompile it? I guess it would be a bad idea, because a lot of other devices might get screwed or so? ^^
 
Old 08-18-2018, 04:01 PM   #8
ferrari
LQ Guru
 
Registered: Sep 2003
Location: Auckland, NZ
Distribution: openSUSE Leap
Posts: 5,791

Rep: Reputation: 1140Reputation: 1140Reputation: 1140Reputation: 1140Reputation: 1140Reputation: 1140Reputation: 1140Reputation: 1140Reputation: 1140
Stay with the line of investigation (as per post #2 and #4). The Archwiki reference mentions
Quote:
Polling rate not changing

The USB 3 driver xhci-hcd may be ignoring the usbhid mousepoll setting. See the linux-usb mailing list message and Bug.

The xhci-hcd module should respect the interval requested by the device, so check the documentation for the device for a hardware or firmware setting.

A work-around that may help is to connect the device to a port using a different driver.

Another work-around is to disable xHCI. There might be a BIOS setting for this or you can do so by blacklisting the xhci-hcd module. However, either way will cause any USB 3 ports to act as USB 2 as the kernel will use the ehci-hcd module instead.
When we know if that is impacting here, it is possible to force the use of the ehci-hcd driver.

The other aspect I'm now wondering about is setting the polling rate with respect to the bcm5974 driver. I assume that you followed advice relating to the usbhid driver, and that won't be relevant here AFAIU.
 
Old 08-20-2018, 09:04 AM   #9
Poison Nuke
Member
 
Registered: Aug 2012
Location: Germany
Posts: 41

Original Poster
Rep: Reputation: Disabled
it looks like the usbhid driver:

Quote:
raspberrypi:~# cat /sys/kernel/debug/usb/devices

T: Bus=01 Lev=00 Prnt=00 Port=00 Cnt=00 Dev#= 1 Spd=480 MxCh= 1
B: Alloc=-45096/800 us (-5636%), #Int=-22555, #Iso= 0
D: Ver= 2.00 Cls=09(hub ) Sub=00 Prot=01 MxPS=64 #Cfgs= 1
P: Vendor=1d6b ProdID=0002 Rev= 4.14
S: Manufacturer=Linux 4.14.44-v7+ dwc_otg_hcd
S: Product=DWC OTG Controller
S: SerialNumber=3f980000.usb
C:* #Ifs= 1 Cfg#= 1 Atr=e0 MxPwr= 0mA
I:* If#= 0 Alt= 0 #EPs= 1 Cls=09(hub ) Sub=00 Prot=00 Driver=hub
E: Ad=81(I) Atr=03(Int.) MxPS= 4 Ivl=256ms

T: Bus=01 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#= 2 Spd=480 MxCh= 4
D: Ver= 2.00 Cls=09(hub ) Sub=00 Prot=02 MxPS=64 #Cfgs= 1
P: Vendor=0424 ProdID=2514 Rev= b.b3
C:* #Ifs= 1 Cfg#= 1 Atr=e0 MxPwr= 2mA
I: If#= 0 Alt= 0 #EPs= 1 Cls=09(hub ) Sub=00 Prot=01 Driver=hub
E: Ad=81(I) Atr=03(Int.) MxPS= 1 Ivl=256ms
I:* If#= 0 Alt= 1 #EPs= 1 Cls=09(hub ) Sub=00 Prot=02 Driver=hub
E: Ad=81(I) Atr=03(Int.) MxPS= 1 Ivl=256ms

T: Bus=01 Lev=02 Prnt=02 Port=00 Cnt=01 Dev#= 3 Spd=480 MxCh= 3
D: Ver= 2.00 Cls=09(hub ) Sub=00 Prot=02 MxPS=64 #Cfgs= 1
P: Vendor=0424 ProdID=2514 Rev= b.b3
C:* #Ifs= 1 Cfg#= 1 Atr=e0 MxPwr= 2mA
I: If#= 0 Alt= 0 #EPs= 1 Cls=09(hub ) Sub=00 Prot=01 Driver=hub
E: Ad=81(I) Atr=03(Int.) MxPS= 1 Ivl=256ms
I:* If#= 0 Alt= 1 #EPs= 1 Cls=09(hub ) Sub=00 Prot=02 Driver=hub
E: Ad=81(I) Atr=03(Int.) MxPS= 1 Ivl=256ms

T: Bus=01 Lev=03 Prnt=03 Port=00 Cnt=01 Dev#= 6 Spd=480 MxCh= 0
D: Ver= 2.10 Cls=ff(vend.) Sub=00 Prot=ff MxPS=64 #Cfgs= 1
P: Vendor=0424 ProdID=7800 Rev= 3.00
C:* #Ifs= 1 Cfg#= 1 Atr=e0 MxPwr= 2mA
I:* If#= 0 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=ff Driver=lan78xx
E: Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E: Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E: Ad=83(I) Atr=03(Int.) MxPS= 16 Ivl=1ms

T: Bus=01 Lev=03 Prnt=03 Port=01 Cnt=02 Dev#= 4 Spd=12 MxCh= 0
D: Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs= 1
P: Vendor=05ac ProdID=0265 Rev= 8.04
S: Manufacturer=Apple Inc.
S: Product=Magic Trackpad 2
S: SerialNumber=CC2643204KCGTFQAA
C:* #Ifs= 4 Cfg#= 1 Atr=a0 MxPwr=500mA
I:* If#= 0 Alt= 0 #EPs= 1 Cls=03(HID ) Sub=00 Prot=00 Driver=usbhid
E: Ad=81(I) Atr=03(Int.) MxPS= 16 Ivl=8ms
I:* If#= 1 Alt= 0 #EPs= 1 Cls=03(HID ) Sub=01 Prot=02 Driver=bcm5974
E: Ad=83(I) Atr=03(Int.) MxPS= 64 Ivl=1ms
I:* If#= 2 Alt= 0 #EPs= 2 Cls=03(HID ) Sub=00 Prot=00 Driver=usbhid
E: Ad=84(I) Atr=03(Int.) MxPS= 16 Ivl=8ms
E: Ad=04(O) Atr=03(Int.) MxPS= 64 Ivl=2ms
I:* If#= 3 Alt= 0 #EPs= 1 Cls=03(HID ) Sub=00 Prot=00 Driver=usbhid
E: Ad=85(I) Atr=03(Int.) MxPS= 64 Ivl=2ms

T: Bus=01 Lev=03 Prnt=03 Port=02 Cnt=03 Dev#= 5 Spd=12 MxCh= 0
D: Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs= 1
P: Vendor=24ae ProdID=1006 Rev= 1.10
S: Manufacturer=RAPOO
S: Product=Rapoo 2.4G Wireless Touchpad Keyboard
C:* #Ifs= 3 Cfg#= 1 Atr=a0 MxPwr=100mA
I:* If#= 0 Alt= 0 #EPs= 1 Cls=03(HID ) Sub=01 Prot=02 Driver=usbhid
E: Ad=81(I) Atr=03(Int.) MxPS= 64 Ivl=10ms
I:* If#= 1 Alt= 0 #EPs= 1 Cls=03(HID ) Sub=01 Prot=01 Driver=usbhid
E: Ad=82(I) Atr=03(Int.) MxPS= 64 Ivl=10ms
I:* If#= 2 Alt= 0 #EPs= 1 Cls=03(HID ) Sub=01 Prot=01 Driver=usbhid
E: Ad=83(I) Atr=03(Int.) MxPS= 64 Ivl=10ms

So in theory, my settings should have an effect and poll the device with 125Hz and not 90?
 
Old 08-20-2018, 02:38 PM   #10
ferrari
LQ Guru
 
Registered: Sep 2003
Location: Auckland, NZ
Distribution: openSUSE Leap
Posts: 5,791

Rep: Reputation: 1140Reputation: 1140Reputation: 1140Reputation: 1140Reputation: 1140Reputation: 1140Reputation: 1140Reputation: 1140Reputation: 1140
That looks as it should be. It is a composite USB device.
Code:
T: Bus=01 Lev=03 Prnt=03 Port=01 Cnt=02 Dev#= 4 Spd=12 MxCh= 0
D: Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs= 1
P: Vendor=05ac ProdID=0265 Rev= 8.04
S: Manufacturer=Apple Inc.
S: Product=Magic Trackpad 2
S: SerialNumber=CC2643204KCGTFQAA
C:* #Ifs= 4 Cfg#= 1 Atr=a0 MxPwr=500mA
I:* If#= 0 Alt= 0 #EPs= 1 Cls=03(HID ) Sub=00 Prot=00 Driver=usbhid
E: Ad=81(I) Atr=03(Int.) MxPS= 16 Ivl=8ms
I:* If#= 1 Alt= 0 #EPs= 1 Cls=03(HID ) Sub=01 Prot=02 Driver=bcm5974
E: Ad=83(I) Atr=03(Int.) MxPS= 64 Ivl=1ms
I:* If#= 2 Alt= 0 #EPs= 2 Cls=03(HID ) Sub=00 Prot=00 Driver=usbhid
E: Ad=84(I) Atr=03(Int.) MxPS= 16 Ivl=8ms
E: Ad=04(O) Atr=03(Int.) MxPS= 64 Ivl=2ms
I:* If#= 3 Alt= 0 #EPs= 1 Cls=03(HID ) Sub=00 Prot=00 Driver=usbhid
E: Ad=85(I) Atr=03(Int.) MxPS= 64 Ivl=2ms
The 'Spd=12' paramter shows that it is behaving as a 'full-speed' (USB 1.1) device, rather than a 'high-speed' (USB 2.0) device. Although these HID devices don't require high data rates (so full-speed is more than sufficient), I'm not sure if this might impact on the maximum polling rate somehow.
 
Old 08-20-2018, 02:38 PM   #11
ferrari
LQ Guru
 
Registered: Sep 2003
Location: Auckland, NZ
Distribution: openSUSE Leap
Posts: 5,791

Rep: Reputation: 1140Reputation: 1140Reputation: 1140Reputation: 1140Reputation: 1140Reputation: 1140Reputation: 1140Reputation: 1140Reputation: 1140
That looks as it should be. It is a composite USB device.
Code:
T: Bus=01 Lev=03 Prnt=03 Port=01 Cnt=02 Dev#= 4 Spd=12 MxCh= 0
D: Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs= 1
P: Vendor=05ac ProdID=0265 Rev= 8.04
S: Manufacturer=Apple Inc.
S: Product=Magic Trackpad 2
S: SerialNumber=CC2643204KCGTFQAA
C:* #Ifs= 4 Cfg#= 1 Atr=a0 MxPwr=500mA
I:* If#= 0 Alt= 0 #EPs= 1 Cls=03(HID ) Sub=00 Prot=00 Driver=usbhid
E: Ad=81(I) Atr=03(Int.) MxPS= 16 Ivl=8ms
I:* If#= 1 Alt= 0 #EPs= 1 Cls=03(HID ) Sub=01 Prot=02 Driver=bcm5974
E: Ad=83(I) Atr=03(Int.) MxPS= 64 Ivl=1ms
I:* If#= 2 Alt= 0 #EPs= 2 Cls=03(HID ) Sub=00 Prot=00 Driver=usbhid
E: Ad=84(I) Atr=03(Int.) MxPS= 16 Ivl=8ms
E: Ad=04(O) Atr=03(Int.) MxPS= 64 Ivl=2ms
I:* If#= 3 Alt= 0 #EPs= 1 Cls=03(HID ) Sub=00 Prot=00 Driver=usbhid
E: Ad=85(I) Atr=03(Int.) MxPS= 64 Ivl=2ms
The 'Spd=12' paramter shows that it is behaving as a 'full-speed' (USB 1.1) device, rather than a 'high-speed' (USB 2.0) device. Although these HID devices don't require high data rates (so full-speed is more than sufficient), I'm not sure if this might impact on the maximum polling rate somehow.
 
Old 08-21-2018, 02:32 AM   #12
Poison Nuke
Member
 
Registered: Aug 2012
Location: Germany
Posts: 41

Original Poster
Rep: Reputation: Disabled
but there stands lvl=8ms, that should be 125Hz, shouldnt it? So where does the 90Hz come from?

And for the bcm driver there is even a 1ms lvl listed, what does that mean?
 
Old 08-21-2018, 03:03 AM   #13
ferrari
LQ Guru
 
Registered: Sep 2003
Location: Auckland, NZ
Distribution: openSUSE Leap
Posts: 5,791

Rep: Reputation: 1140Reputation: 1140Reputation: 1140Reputation: 1140Reputation: 1140Reputation: 1140Reputation: 1140Reputation: 1140Reputation: 1140
Quote:
So where does the 90Hz come from?
I'm not sure to be honest. Where did you see that reported?

Quote:
And for the bcm driver there is even a 1ms lvl listed, what does that mean?
Well, that implies a respectable 1000Hz polling rate.

Is your 'Magic Trackpad 2' responding as you'd like from an operational perspective? Maybe noting needs to be done explicitly.
 
Old 08-21-2018, 10:06 AM   #14
Poison Nuke
Member
 
Registered: Aug 2012
Location: Germany
Posts: 41

Original Poster
Rep: Reputation: Disabled
I see the update rate in my application, which is fed directly from the bcm driver.

And Im creating a new input prototype and goal is less then 40ms total in out latency. At the moment I have 80ms, which is too much (you can feel it). So I try to minimize every possible bottleneck.
 
Old 07-06-2019, 03:37 PM   #15
Synesthesia
Member
 
Registered: Jan 2004
Location: the abyss
Posts: 209

Rep: Reputation: 30
How did this turn out? I'm curious about increasing the polling rate for the trackpad 2... I wonder if we can get it up to 500hz at least.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
faster interrupt polling of usb device rbees Linux - Hardware 3 01-10-2018 02:55 PM
[SOLVED] external USB drive write rate timl Linux - Hardware 5 10-18-2013 04:44 PM
serial USB converter baud rate noir911 Linux - Hardware 1 02-02-2008 06:33 PM
Using Touchpad + USB WLAN means touchpad and keyboard stops responding randomly ultrabeam16 Linux - Laptop and Netbook 0 03-21-2004 02:19 PM
USB *AND* touchpad DAChristen29 Linux - Hardware 4 11-01-2003 10:55 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware

All times are GMT -5. The time now is 05:44 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration