You are not logged in.

#126 2017-08-15 19:49:29

MarthaParkin
Member
Registered: 2016-03-19
Posts: 232

Re: [Solved] Point of sale keyboard shows up as usb hub and doesn't work

R00KIE wrote:

I'd like to see that upstream bug report. Also if the bug report didn't get anywhere you could check which mailing to send an email and ask about this, it is in your best interest to get this fixed upstream, otherwise you will be here asking the same question again the next time you decide to update the kernel.

Oh ideally I agree but if it is such an edge case (which it is really isn't it cos no1 else really uses these keyboards except hobbyists/tinkerers) then they probably wouldn't see the point?

What I remember about the report is that I posted it and I was checking for like 3 weeks and no updates so I just gave up checking iirc.

I gotta have it working for now (it is an orthlinear keyboard) because I can't type properly with slanted keyboards any more smile however I might instead save up for and expensive $100 or so one which is still orthlinear but would actually be supported by a manufacturer and tested to work on linux or at least made to work with desktop PCs; which this one isn't.

The upstream would be sweet because I am happy with this keyboard otherwise however I am skeptical they would be motivated to fix it for reason stated above.

Nice one mich! Thanks for showing back up and helping out. I will give the patch a go tommoro.

Oh that makes me wonder...regarding the correctness check, could that be them attempting to fix the issue? I'll have to look on my harddrive to see if I can find the link to the bug report.

Last edited by MarthaParkin (2017-08-15 19:56:08)

Offline

#127 2017-08-15 19:51:54

MarthaParkin
Member
Registered: 2016-03-19
Posts: 232

Re: [Solved] Point of sale keyboard shows up as usb hub and doesn't work

mich41 wrote:

Maybe save a copy of the old one for now, I'm not sure what version we ultimately settled on.

What version of what?

I just found a reply from my email exchanges where the guy offered a patch but that was just after we had fixed it in the thread. Here is what he sent

From 48235867cb513b26b621641ad4fa06380e95bdd5 Mon Sep 17 00:00:00 2001
From: Oliver Neukum <oneukum@suse.com>
Date: Thu, 16 Jun 2016 14:27:39 +0200
Subject: [PATCH] hub: support for quirky device

This hub claims to have many more ports than it really has.
Introducing a quirk for such devices.

Signed-off-by: Oliver Neukum <oneukum@suse.com>
---
 drivers/usb/core/hub.c | 12 ++++++++++++
 drivers/usb/core/hub.h |  1 +
 2 files changed, 13 insertions(+)

diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
index bee1351..f3dfbd3 100644
--- a/drivers/usb/core/hub.c
+++ b/drivers/usb/core/hub.c
@@ -35,6 +35,7 @@
 
 #define USB_VENDOR_GENESYS_LOGIC		0x05e3
 #define HUB_QUIRK_CHECK_PORT_AUTOSUSPEND	0x01
+#define HUB_QUIRK_SHADOW_PORTS5			0x02
 
 /* Protect struct usb_device->state and ->children members
  * Note: Both are also protected by ->dev.sem, except that ->state can
@@ -1419,6 +1420,8 @@ static int hub_configure(struct usb_hub *hub,
 	}
 
 	maxchild = hub->descriptor->bNbrPorts;
+	if (hub->max_real_ports)
+		maxchild = min(maxchild, hub->max_real_ports);
 	dev_info(hub_dev, "%d port%s detected\n", maxchild,
 			(maxchild == 1) ? "" : "s");
 
@@ -1852,6 +1855,9 @@ descriptor_error:
 	if (id->driver_info & HUB_QUIRK_CHECK_PORT_AUTOSUSPEND)
 		hub->quirk_check_port_auto_suspend = 1;
 
+	if (id->driver_info & HUB_QUIRK_SHADOW_PORTS5)
+		hub->max_real_ports = 5;
+
 	if (hub_configure(hub, endpoint) >= 0)
 		return 0;
 
@@ -5233,11 +5239,17 @@ out_hdev_lock:
 }
 
 static const struct usb_device_id hub_id_table[] = {
+	/* quirky and broken devices */
+	{ USB_DEVICE(0x0db5, 0x0119),
+	.driver_info = HUB_QUIRK_SHADOW_PORTS5, },
+
     { .match_flags = USB_DEVICE_ID_MATCH_VENDOR
 			| USB_DEVICE_ID_MATCH_INT_CLASS,
       .idVendor = USB_VENDOR_GENESYS_LOGIC,
       .bInterfaceClass = USB_CLASS_HUB,
       .driver_info = HUB_QUIRK_CHECK_PORT_AUTOSUSPEND},
+
+	/* generic match */
     { .match_flags = USB_DEVICE_ID_MATCH_DEV_CLASS,
       .bDeviceClass = USB_CLASS_HUB},
     { .match_flags = USB_DEVICE_ID_MATCH_INT_CLASS,
diff --git a/drivers/usb/core/hub.h b/drivers/usb/core/hub.h
index 34c1a7e..d5668b0 100644
--- a/drivers/usb/core/hub.h
+++ b/drivers/usb/core/hub.h
@@ -73,6 +73,7 @@ struct usb_hub {
 	unsigned		quirk_check_port_auto_suspend:1;
 
 	unsigned		has_indicators:1;
+	unsigned		max_real_ports; /* hubs showing bogus ports */
 	u8			indicator[USB_MAXCHILDREN];
 	struct delayed_work	leds;
 	struct delayed_work	init_work;
-- 
2.1.4

Since it was already working I never tried that patch though I pointed him to this thread and what got it working. Didn't hear anything back from him after that.

I've just sent the guy a reply with the latest info now too.

Last edited by MarthaParkin (2017-08-15 20:47:03)

Offline

#128 2017-08-16 08:10:20

MarthaParkin
Member
Registered: 2016-03-19
Posts: 232

Re: [Solved] Point of sale keyboard shows up as usb hub and doesn't work

So I have just tried with both mich41's new patch and also with the patch the dev provided above (not both at the same time ofc. each seperately) and neither worked.

Just to check, since the paths have changed since I did it a year ago, I should be building from

/linux/repos/core-x86_64

garnered from

$ ASPROOT=. asp checkout linux

right? for my 64bit system. I doubt that is the problem however wanted to double check I wasn't patching it wrong somehow.

Last edited by MarthaParkin (2017-08-16 08:12:34)

Offline

#129 2017-08-16 12:01:17

mich41
Member
Registered: 2012-06-22
Posts: 796

Re: [Solved] Point of sale keyboard shows up as usb hub and doesn't work

You probably forgot to add

patch -p1 -i "${srcdir}/mich41.patch"

to PKGBUILD. In fact, I now suspect that you also forgot it yesterday when testing the old version of my patch because I think the old version wouldn't compile on kernel 4.12.

Offline

#130 2017-08-16 12:19:16

MarthaParkin
Member
Registered: 2016-03-19
Posts: 232

Re: [Solved] Point of sale keyboard shows up as usb hub and doesn't work

mich41 wrote:

You probably forgot to add

patch -p1 -i "${srcdir}/mich41.patch"

to PKGBUILD. In fact, I now suspect that you also forgot it yesterday when testing the old version of my patch because I think the old version wouldn't compile on kernel 4.12.

Oh crap my bad!

Yes I had only been putting the file in sources. I forget the other bit smile. Let's try that again.

Offline

#131 2017-08-16 14:03:08

MarthaParkin
Member
Registered: 2016-03-19
Posts: 232

Re: [Solved] Point of sale keyboard shows up as usb hub and doesn't work

Ok still not working but I got some new error messages for you...

[  138.821126] usb 8-4: new full-speed USB device number 4 using ohci-pci
[  139.020011] hub 8-4:1.0: USB hub found
[  139.021875] hub 8-4:1.0: 31 ports detected
[  139.023921] hub 8-4:1.0: insufficient power available to use all downstream ports
[  139.213875] hub 8-4:1.0: hub_ext_port_status failed (err = -32)

Last edited by MarthaParkin (2017-08-16 14:28:55)

Offline

#132 2017-08-16 14:11:41

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 19,792

Re: [Solved] Point of sale keyboard shows up as usb hub and doesn't work

Please use code tags.

 [  139.021875] hub 8-4:1.0: 31 ports detected
 [  139.023921] hub 8-4:1.0: insufficient power available to use all downstream ports

Um, yeah.  Does this POS device have the option of external power?

Being a "full speed" device, it is likely a USB 2.0 device running a 12MHz. 
A USB 2.0 port cannot be asked to deliver more than 500mA @ 5V.  Each port is guaranteed to have not less than 100mA available to it.  That means, for all practical purposes, you can have up to four devices on a non self-powered device.
Your device states it supports 31 devices. On a single 12 MHz link.  I think the "designer" of this thing ignored the USB specification and took shortcuts in their device descriptor.

Last edited by ewaller (2017-08-16 14:12:05)


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
Sometimes it is the people no one can imagine anything of who do the things no one can imagine. -- Alan Turing
---
How to Ask Questions the Smart Way

Offline

#133 2017-08-16 14:28:38

MarthaParkin
Member
Registered: 2016-03-19
Posts: 232

Re: [Solved] Point of sale keyboard shows up as usb hub and doesn't work

That was an accident re code tags.

No, no option of external power afaik; only the usb lead coming out of it.

Last edited by MarthaParkin (2017-08-16 14:29:47)

Offline

#134 2017-08-16 14:40:29

mich41
Member
Registered: 2012-06-22
Posts: 796

Re: [Solved] Point of sale keyboard shows up as usb hub and doesn't work

Try with 5 instead of maxchild in this line of the patch:

+		hub->descriptor->bNbrPorts = maxchild;

Don't change the ; at the end.

I think we did similar tweaks last year due to some problems. Do you still have the final version of this patch which fixed it then?

Offline

#135 2017-08-16 16:11:20

MarthaParkin
Member
Registered: 2016-03-19
Posts: 232

Re: [Solved] Point of sale keyboard shows up as usb hub and doesn't work

mich41 wrote:

Try with 5 instead of maxchild in this line of the patch:

+		hub->descriptor->bNbrPorts = maxchild;

Don't change the ; at the end.

I think we did similar tweaks last year due to some problems. Do you still have the final version of this patch which fixed it then?

Ye here it is...

diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
index 84df093..643898e 100644
--- a/drivers/usb/core/hub.c
+++ b/drivers/usb/core/hub.c
@@ -1393,9 +1393,7 @@ static int hub_configure(struct usb_hub *hub,
 		message = "can't read hub descriptor";
 		goto fail;
 	} else if (hub->descriptor->bNbrPorts > USB_MAXCHILDREN) {
-		message = "hub has too many ports!";
-		ret = -ENODEV;
-		goto fail;
+		hub->descriptor->bNbrPorts = 5;
 	} else if (hub->descriptor->bNbrPorts == 0) {
 		message = "hub doesn't have any ports!";
 		ret = -ENODEV;

Seems your memory did not fail you smile

Last edited by MarthaParkin (2017-08-16 16:12:37)

Offline

#136 2017-08-16 17:00:10

MarthaParkin
Member
Registered: 2016-03-19
Posts: 232

Re: [Solved] Point of sale keyboard shows up as usb hub and doesn't work

Yipee! That seems to have got it! Thanks bro smile.

I will forward the new patch to the devs again to see if they will do anything with it.

Offline

#137 2017-08-16 17:18:19

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 19,792

Re: [Solved] Point of sale keyboard shows up as usb hub and doesn't work

I'd be curious as to what gets posted when you connect the device now that the descriptor count is locked down to 5 in the driver.


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
Sometimes it is the people no one can imagine anything of who do the things no one can imagine. -- Alan Turing
---
How to Ask Questions the Smart Way

Offline

#138 2017-08-16 17:58:04

MarthaParkin
Member
Registered: 2016-03-19
Posts: 232

Re: [Solved] Point of sale keyboard shows up as usb hub and doesn't work

ewaller wrote:

I'd be curious as to what gets posted when you connect the device now that the descriptor count is locked down to 5 in the driver.

Hmm alot of new stuff has appeared smile

[ 1030.248224] usb 8-3: new full-speed USB device number 8 using ohci-pci
[ 1030.447035] hub 8-3:1.0: USB hub found
[ 1030.448935] hub 8-3:1.0: 5 ports detected
[ 1030.450887] hub 8-3:1.0: insufficient power available to use all downstream ports
[ 1030.751580] usb 8-3.1: new full-speed USB device number 9 using ohci-pci
[ 1030.876746] input: Access Keyboards Ltd. USB HID keyboard as /devices/pci0000:00/0000:00:12.0/usb8/8-3/8-3.1/8-3.1:1.0/0003:0DB5:011A.0008/input/input22
[ 1030.932101] hid-generic 0003:0DB5:011A.0008: input,hidraw3: USB HID v1.10 Keyboard [Access Keyboards Ltd. USB HID keyboard] on usb-0000:00:12.0-3.1/input0
[ 1030.936706] hid-generic 0003:0DB5:011A.0009: hiddev0,hidraw4: USB HID v1.10 Device [Access Keyboards Ltd. USB HID keyboard] on usb-0000:00:12.0-3.1/input1
[ 1031.011641] usb 8-3.2: new full-speed USB device number 10 using ohci-pci
[ 1036.151945] usb 8-3.2: device descriptor read/64, error -110

EDIT: These also had appeared after checking some minutes later.

[ 1051.723209] usb 8-3.2: device descriptor read/64, error -110
[ 1051.903179] usb 8-3.2: new full-speed USB device number 11 using ohci-pci
[ 1057.060266] usb 8-3.2: device descriptor read/64, error -110
[ 1072.634839] usb 8-3.2: device descriptor read/64, error -110
[ 1072.814856] usb 8-3.2: new full-speed USB device number 12 using ohci-pci
[ 1083.432345] usb 8-3.2: device not accepting address 12, error -110
[ 1083.508968] usb 8-3.2: new full-speed USB device number 13 using ohci-pci
[ 1094.099803] usb 8-3.2: device not accepting address 13, error -110
[ 1094.100905] usb 8-3-port2: unable to enumerate USB device

It seems to cycle for a while then pipe down. I know from the previous working patch that once that it gets to the final line then the error messages stop appearing.

Last edited by MarthaParkin (2017-08-16 18:14:30)

Offline

#139 2017-08-16 19:48:13

mich41
Member
Registered: 2012-06-22
Posts: 796

Re: [Solved] Point of sale keyboard shows up as usb hub and doesn't work

If you further reduce the number of ports from 5 to 1, this error -110 junk should disappear because it's on port 2 wink

As for upstreaming, my patch surely won't be accepted. The one from Oliver Neukum is better, but I think it may not work on 4.12.

Offline

#140 2017-08-17 06:42:30

MarthaParkin
Member
Registered: 2016-03-19
Posts: 232

Re: [Solved] Point of sale keyboard shows up as usb hub and doesn't work

Cool, I don't actually see the error messages except at the login terminal so not a big deal. Just glad to have it working again!

Not been able to work for several days due to these issues so gotta catch up first.

Maybe yours wouldn't be accepted but it might inspire them for their own patch.

Last edited by MarthaParkin (2017-08-17 06:43:03)

Offline

#141 2017-08-17 13:57:29

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 19,792

Re: [Solved] Point of sale keyboard shows up as usb hub and doesn't work

MarthaParkin wrote:

Maybe yours wouldn't be accepted but it might inspire them for their own patch.

The root of the problem is in your device, not in the driver.   There is something wrong with the device descriptor. 
The "Patch" is a hack to prevent the enumeration of 32 devices.   I am sure the driver is more in line with the requirements of the USB specification than is your device.


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
Sometimes it is the people no one can imagine anything of who do the things no one can imagine. -- Alan Turing
---
How to Ask Questions the Smart Way

Offline

Board footer

Powered by FluxBB