You are not logged in.

#51 2016-05-02 16:34:35

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

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

Ok I still don't get it. Where should the two ch11.h files be? and what should be the diff command to make them? I read the patch file should be in same directory as the PKGBUILD but I tried putting the ch11 files in there and makepkg still gave the same error as above.

Also do I need to put the paths to the ch11 files into the PGKBUILD sources or only the .patch file?

Offline

#52 2016-05-02 17:12:12

Ropid
Member
Registered: 2015-03-09
Posts: 1,069

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

I looked at the changes you'll have to do. First, here's a patch file that sets that 31 to 255 in ch11.h:

diff -ur src/linux-4.5/include/uapi/linux/usb/ch11.h b/linux-4.5/include/uapi/linux/usb/ch11.h
--- src/linux-4.5/include/uapi/linux/usb/ch11.h	2016-03-14 05:28:54.000000000 +0100
+++ b/linux-4.5/include/uapi/linux/usb/ch11.h	2016-05-02 18:54:22.678338988 +0200
@@ -20,7 +20,7 @@
  * limit. Because the arrays need to add a bit for hub status data, we
  * use 31, so plus one evens out to four bytes.
  */
-#define USB_MAXCHILDREN		31
+#define USB_MAXCHILDREN		255
 
 /*
  * Hub request types

Save this file as "ch11.h.patch" next to the PKGBUILD.

In the PKGBUILD, go to the line where you see "prepare() {". Add the following before that line:

source+=('ch11.h.patch')
sha256sums+=('SKIP')

Now go down a few lines and into the "prepare()" function. Look for where "change-default-console-loglevel.patch" gets applied. Add this line after it:

  patch -p2 -i "${srcdir}/ch11.h.patch"

You're done. Things should compile fine now, but I don't know if the USB stuff will actually work with that 255 value instead of 31.

Here's a link to the whole changed PKGBUILD and that patch file:

https://gist.github.com/anonymous/8c300 … 8e86dbd980

EDIT:

I started building it for fun after writing this post. It does not work for me. There is first this suspicious error at some point:

In file included from drivers/usb/core/hub.c:33:0:
drivers/usb/core/hub.h:57:2: error: #error event_bits[] is too short!
 #error event_bits[] is too short!

And then it stops a while later with this here:

Makefile:950: recipe for target 'drivers' failed
make: *** [drivers] Error 2
==> ERROR: A failure occurred in build().
    Aborting...

Last edited by Ropid (2016-05-02 17:36:00)

Offline

#53 2016-05-02 18:04:37

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

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

Thanks for help.

Hmm sad

I tried again myself before I read your reply and when it asked for the patch path I just set it where it asked and it started compiling so I don't know if it will compile properly for me or if I will get to the error you had soon or my own errors due to not setting the path properly before. Don't even know if it'll add the patch change.

This computer I am compiling on is slow so you perhaps just got to it quicker than me big_smile

Why wouldn't it compile? I thought this would be a straight forward thing since the change is so small and it isn't like it is changing any complex moving parts.

Last edited by MarthaParkin (2016-05-02 18:05:29)

Offline

#54 2016-05-02 18:17:46

Ropid
Member
Registered: 2015-03-09
Posts: 1,069

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

I looked into that "drivers/usb/core/usb.h" file that was mentioned in the error message and it seems there's a manually added check in there to make sure that particular value can't be over 31, can only be smaller. It looks like this:

#if USB_MAXCHILDREN > 31 /* 8*sizeof(unsigned long) - 1 */
#error event_bits[] is too short!
#endif

Offline

#55 2016-05-02 18:35:01

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

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

So where to go from here?

btw if I want to compile on my 8 core rather than this old single core do I have to make any specific changes to do that or can I just copy the folder over and makepkg?

Offline

#56 2016-05-02 18:53:48

Ropid
Member
Registered: 2015-03-09
Posts: 1,069

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

You should be able to use the other machine without having to do anything special.

About what to do next... I wonder if this hub stuff isn't what's actually going on with hardware. Perhaps the device does not really want to show up as a hub, it's just getting mistaken for a hub for some reason. I don't know where the rules for that come from. There might be a way to configure this and to force the kernel to see this device as a normal keyboard.

Offline

#57 2016-05-02 19:57:40

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

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

Mine just exited with an error but a different one to yours it seems or is that the same as yours?

  CC      drivers/pci/probe.o
drivers/pci/probe.c: In function ‘pci_scan_bridge’:
drivers/pci/probe.c:996:1: internal compiler error: Segmentation fault
 }
 ^
Please submit a full bug report,
with preprocessed source if appropriate.
See <https://bugs.archlinux.org/> for instructions.
scripts/Makefile.build:258: recipe for target 'drivers/pci/probe.o' failed
make[2]: *** [drivers/pci/probe.o] Error 1
scripts/Makefile.build:407: recipe for target 'drivers/pci' failed
make[1]: *** [drivers/pci] Error 2
Makefile:950: recipe for target 'drivers' failed
make: *** [drivers] Error 2
==> ERROR: A failure occurred in build().
    Aborting...

Hmm I shall eagerly await further input from more knowledgeable minds than myself smile

Last edited by MarthaParkin (2016-05-02 20:28:03)

Offline

#58 2016-05-03 00:27:15

R00KIE
Forum Fellow
From: Between a computer and a chair
Registered: 2008-09-14
Posts: 4,734

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

I assume that Lone_Wolf was not being sarcastic, if you manage to tame the kernel PKGBUILD then you'll be able to edit/read any other pkgbuild. It seems to me you are learning lots of new things at the same time and from personal experience I'd say it takes a while until everything sinks in and you have a good idea how all the pieces fit together, and I'd say you seem to be doing quite well.

To add to what was said before, in the unified diff header you can see the path to the file you are going to patch, and as you found out, patch will complain if it can't find the file.

Regarding your last error, it seems a problem with gcc. I don't have many suggestions except making sure your system is fully up to date and making sure you start with a clean kernel tree. I believe makepkg deletes the src dir before doing all the pkgbuild steps but just to make sure delete it manually before running makepkg again.

If I recall correctly I've had problem when compiling with more than one job at a time, if you are using make -jX where X is larger than one try with just one (if you don't use -j just ignore this).


R00KIE
Tm90aGluZyB0byBzZWUgaGVyZSwgbW92ZSBhbG9uZy4K

Offline

#59 2016-05-03 09:08:09

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

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

Ropid wrote:

I looked into that "drivers/usb/core/usb.h" file that was mentioned in the error message and it seems there's a manually added check in there to make sure that particular value can't be over 31, can only be smaller. It looks like this:

#if USB_MAXCHILDREN > 31 /* 8*sizeof(unsigned long) - 1 */
#error event_bits[] is too short!
#endif

Yep, changing this to 63 maybe would work on 64 bit systems, but forget about 100 or whatever it was that you needed.

Try this patch instead:

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 = USB_MAXCHILDREN;
 	} else if (hub->descriptor->bNbrPorts == 0) {
 		message = "hub doesn't have any ports!";
 		ret = -ENODEV;

It doesn't really matter because this hub descriptor is bogus and we determined the real number of ports is 5.

EDIT:
I can't reproduce this gcc crash with latest gcc and Linux v4.4.8. Maybe will try with your version later.

Last edited by mich41 (2016-05-03 09:39:40)

Offline

#60 2016-05-03 09:42:12

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

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

Cool smile. Yes it is alot to process was a taxing day mentally yesterday trying to compute everything in my mind.

As for the -j thing no I wasn't using it. I just did a bare 'makepkg' following the wiki.

R00KIE wrote:

I assume that Lone_Wolf was not being sarcastic, if you manage to tame the kernel PKGBUILD then you'll be able to edit/read any other pkgbuild. It seems to me you are learning lots of new things at the same time and from personal experience I'd say it takes a while until everything sinks in and you have a good idea how all the pieces fit together, and I'd say you seem to be doing quite well.

To add to what was said before, in the unified diff header you can see the path to the file you are going to patch, and as you found out, patch will complain if it can't find the file.

Regarding your last error, it seems a problem with gcc. I don't have many suggestions except making sure your system is fully up to date and making sure you start with a clean kernel tree. I believe makepkg deletes the src dir before doing all the pkgbuild steps but just to make sure delete it manually before running makepkg again.

If I recall correctly I've had problem when compiling with more than one job at a time, if you are using make -jX where X is larger than one try with just one (if you don't use -j just ignore this).

Offline

#61 2016-05-03 09:44:26

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

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

Thanks. is this instead of the original one to raise the port value? Could you explain what it does. From my guess it is just making the code pass rather than raise an error is that right?

I will try compiling on my 8 core later to speed things up.

mich41 wrote:
Ropid wrote:

I looked into that "drivers/usb/core/usb.h" file that was mentioned in the error message and it seems there's a manually added check in there to make sure that particular value can't be over 31, can only be smaller. It looks like this:

#if USB_MAXCHILDREN > 31 /* 8*sizeof(unsigned long) - 1 */
#error event_bits[] is too short!
#endif

Yep, changing this to 63 maybe would work on 64 bit systems, but forget about 100 or whatever it was that you needed.

Try this patch instead:

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 = USB_MAXCHILDREN;
 	} else if (hub->descriptor->bNbrPorts == 0) {
 		message = "hub doesn't have any ports!";
 		ret = -ENODEV;

It doesn't really matter because this hub descriptor is bogus and we determined the real number of ports is 5.

EDIT:
I can't reproduce this gcc crash with latest gcc and Linux v4.4.8. Maybe will try with your version later.

Offline

#62 2016-05-03 09:57:05

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

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

It's changing the port count in driver's copy of hub descriptor from >31 to exactly 31. Updating the code to support >31 ports would be much harder and unnecessary because the hub has only 5 ports.

I have to admit I haven't tested this patch, but it seems like it might work wink

Offline

#63 2016-05-03 09:59:20

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

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

Well ye it doesn't matter how it does it as long as it avoids it throwing the too many ports error I'm guessing/hoping tongue

btw should I use any switches with makepkg or not? since ROOKIE alluded I might want to.

Last edited by MarthaParkin (2016-05-03 10:00:48)

Offline

#64 2016-05-03 10:59:32

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

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

It's MAKEFLAGS in /etc/makepkg.conf, uncomment that line and set it to -j8 to use 8 cores. It's a good idea because Arch's kernel configuration takes eternity to build.

And the bad/good/weird/??? news is that I just launched a build of Arch kernel package:

pacman -S abs
abs core
cp -a /var/abs/core/linux /tmp
cd /tmp/linux
makepkg

... and it didn't crash on drivers/pci/probe.o. No custom build options besides -j6.

If you have some Intel Haswell/Broadwell/Skylake CPU, check if intel-ucode helps with that crash.

https://wiki.archlinux.org/index.php/microcode

Last edited by mich41 (2016-05-03 11:01:36)

Offline

#65 2016-05-03 11:21:26

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

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

Well this is a different computer than the one I got the error on so I doubt it will happen on this badboy if it's cpu related.

But we will see when the rubber hits the road big_smile

Offline

#66 2016-05-07 10:14:18

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:
Ropid wrote:

I looked into that "drivers/usb/core/usb.h" file that was mentioned in the error message and it seems there's a manually added check in there to make sure that particular value can't be over 31, can only be smaller. It looks like this:

#if USB_MAXCHILDREN > 31 /* 8*sizeof(unsigned long) - 1 */
#error event_bits[] is too short!
#endif

Yep, changing this to 63 maybe would work on 64 bit systems, but forget about 100 or whatever it was that you needed.

Try this patch instead:

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 = USB_MAXCHILDREN;
 	} else if (hub->descriptor->bNbrPorts == 0) {
 		message = "hub doesn't have any ports!";
 		ret = -ENODEV;

It doesn't really matter because this hub descriptor is bogus and we determined the real number of ports is 5.

EDIT:
I can't reproduce this gcc crash with latest gcc and Linux v4.4.8. Maybe will try with your version later.

Could someone explain a little more the A and B part regarding how I need to set up the paths for each? because I only managed to fluke it the first time I managed to make it compile and even then I had to input the path manually.

If I already downloaded the abs core is this where I point A; to the source file which was downloaded (rather than making yet another copy)? It talks about a and b folders in the wiki but in my case since it is only one file it only needs to be file a and b? And the B folder can be any path just as long as it contains the changed file?

Offline

#67 2016-05-07 11:21:18

bstaletic
Member
Registered: 2014-02-02
Posts: 658

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

Both a and be should have the same path in your case. You shouldn't edit the patch. What it actually says is:
- We have a file in drivers/usb/core/ named hub.c that represents the original file to be patched
- We have a file in drivers/usb/core/ named hub.c that represents the file as it should look after patching
- Let's see what's different...
- In the new file there's a few lines missing - so those should be marked with a minus.
- There's also one new line that wasn't there before - it should be marked with a plus.
Now when using the patch you just need to match a with the actual dir.

I'm not using Arch, but if I remember correctly, the prepare() starts with "cd ${srcdir}" and at one point starts applying patches? If so, just add one line similar to others containing your patch. Hope I made it a bit more clear.

The first compilation error you've got is probabbly caused by something silly. I've usually got that kind of errors due to things like no more space, or no more memory. My favourite one was an insane build system of some javascript engine that caused grsec kernel to kill it. The message was pretty KISS - "Killed." big_smile

Last edited by bstaletic (2016-05-07 11:22:33)

Offline

#68 2016-05-07 12:10:51

Ropid
Member
Registered: 2015-03-09
Posts: 1,069

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

MarthaParkin wrote:

Could someone explain a little more the A and B part regarding how I need to set up the paths for each? because I only managed to fluke it the first time I managed to make it compile and even then I had to input the path manually.

If I already downloaded the abs core is this where I point A; to the source file which was downloaded (rather than making yet another copy)? It talks about a and b folders in the wiki but in my case since it is only one file it only needs to be file a and b? And the B folder can be any path just as long as it contains the changed file?

First, about the two diff/patch examples you've seen, here's one with "a" and "b" in it:

--- a/drivers/usb/core/hub.c
+++ b/drivers/usb/core/hub.c

When you do "patch -p1" to apply it, that "-p1" will remove those "a/" and "b/" from the name.

The one I worked on was this:

--- src/linux-4.5/include/uapi/linux/usb/ch11.h	2016-03-14 05:28:54.000000000 +0100
+++ b/linux-4.5/include/uapi/linux/usb/ch11.h	2016-05-02 18:54:22.678338988 +0200

This one gets applied with "patch -p2". The "-p2" will remove "src/linux-4.5/" and "b/linux-4.5/".

Those names you see there were actual folders at some point while working on the diff. In my case, what I did concretely is this:

First, I did "makepkg -o". The man-page says this about "-o" (long name is "--nobuild"): "Download and extract files, run the prepare() function, but do not build them."

I have "BUILDDIR=/tmp/makepkg" set up in my /etc/makepkg.conf. That's where makepkg will work on building the package, and that's where I have to look for the extracted sources after the "makepkg -o".

After the "makepkg -o", I went into /tmp/makepkg/linux/. There is a "src" folder there. I made a copy of the whole folder with "cp -a src b". I then went into "b" and searched for the file I wanted to edit. That's where the names in the patch file came from in my case.

Going back into the build directory where there's "src" and "b" next to each other, running "diff -ur src b" creates the contents of the patch file. It should find the edited files and the changed content and print it. You redirect the output into a patch file next to where you have the PKGBUILD, then can go and edit the PKGBUILD and add the patch.

Next, I did "rm -rf /tmp/makepkg" to clean the stuff over there, then tried "makepkg -o" again to see if the patch works.

Offline

#69 2016-05-07 14:03:07

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

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

==> Extracting sources...
  -> Extracting linux-4.5.tar.xz with bsdtar
  -> Extracting patch-4.5.1.xz with xz
==> Starting prepare()...
patching file drivers/usb/core/hub.c
Hunk #1 FAILED at 1393.
1 out of 1 hunk FAILED -- saving rejects to file drivers/usb/core/hub.c.rej
==> ERROR: A failure occurred in prepare().
    Aborting...

Looks like I did something wrong.

Any ideas?

All I did was place the patch file in the pkgbuild directory and change the two lines for sources and prepare for the patch and let it run.

Maybe I missed something?

Last edited by MarthaParkin (2016-05-07 14:21:05)

Offline

#70 2016-05-07 14:22:50

Ropid
Member
Registered: 2015-03-09
Posts: 1,069

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

Make it apply the patch after the 4.5.x update patch is applied.

EDIT: In one of the posts, mich41 wrote something about kernel 4.4.8. Perhaps that's the version he patched and it's different in the 4.5 kernels.

Last edited by Ropid (2016-05-07 14:26:24)

Offline

#71 2016-05-07 14:36:21

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

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

Sure that's the version I used. But I hoped it would work on 4.5.1 as well. And, in fact, I just checked that it does. See - I'm always right tongue

Make sure there are no errors in the patch - tabs replaced with spaces, broken lines, blank lines, etc.

The right way to do it:

Select patch text in the browser.

cat >silly-patch.patch

middle click
ENTER
CTRL+D

Last edited by mich41 (2016-05-07 14:41:54)

Offline

#72 2016-05-07 14:43:04

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

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

Ropid wrote:

Make it apply the patch after the 4.5.x update patch is applied.

EDIT: In one of the posts, mich41 wrote something about kernel 4.4.8. Perhaps that's the version he patched and it's different in the 4.5 kernels.

like this?

prepare() {
  cd "${srcdir}/${_srcname}"

  # add upstream patch
  patch -p1 -i "${srcdir}/patch-${pkgver}"

  # add latest fixes from stable queue, if needed
  # http://git.kernel.org/?p=linux/kernel/git/stable/stable-queue.git

  # set DEFAULT_CONSOLE_LOGLEVEL to 4 (same value as the 'quiet' kernel param)
  # remove this when a Kconfig knob is made available by upstream
  # (relevant patch sent upstream: https://lkml.org/lkml/2011/7/26/227)
  patch -p1 -i "${srcdir}/change-default-console-loglevel.patch"

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

I just tried that and same error.

Hmm so how do I work with his version? I tried redoing ABSROOT=. abs core/linux guessing that it might download his newer version but it seems to be the same as the one I got before.

Offline

#73 2016-05-07 14:45:11

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:

Sure that's the version I used. But I hoped it would work on 4.5.1 as well. And, in fact, I just checked that it does. See - I'm always right tongue

Make sure there are no errors in the patch - tabs replaced with spaces, broken lines, blank lines, etc.

The right way to do it:

Select patch text in the browser.

cat >silly-patch.patch

middle click
ENTER
CTRL+D

Well I am browsing on windows so not viewing the forum with linux.

Just pasting into the base windows notepad will be ok? That is what I did initially. Then c and p from notepad to putty terminal.

Or something else I should do?

Edit: I just did a diff check and there does indeed seem to be a swathe of tabs missing. So let me try again.

Last edited by MarthaParkin (2016-05-07 14:50:26)

Offline

#74 2016-05-07 15:01:40

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

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

Ok I tried but still having problems with formatting but this time with a different error

Hunk #1 succeeded at 39 (offset 2 lines).
patch unexpectedly ends in middle of line
patch: **** Only garbage was found in the patch input.
==> ERROR: A failure occurred in prepare().
    Aborting...

Could you just upload the file here so I can download it so then we know the formatting will be correct.

Offline

#75 2016-05-07 15:10:25

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

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

Your problem may be caused by Windows using CRLF instead of just LF to encode newlines. Anyway, this should work:

http://pastebin.com/6iqtap5w

Offline

Board footer

Powered by FluxBB