Why is a keyboard with a USB extension cable—which is connected to a hub—not working?

Solution 1:

Shamelessly plagiarizing USB Cable Length Limitations And How To Break Them from yourcablestore.com (they're trying to sell you stuff anyway; like the shorter cable you need or a good powered hub):

USB 2.0

The 2.0 specification limits the length of a cable between USB 2.0 devices (Full Speed or Hi-Speed) to 5 meters (or about 16 feet and 5 inches). In other words, you cannot just connect a bunch of extension cables together (like taking a 6 foot cord and extending it with 4 other 6 foot extension cords) and run them 30 feet to another room. However, you can connect a 6 foot cable with a 10 foot extension cable for a total of 16 feet, which is below the maximum cable length for USB 2.0.

USB 3.0

The 3.0/3.1 specification does not specify a maximum cable length between USB 3.0/3.1 devices (SuperSpeed or SuperSpeed+), but there is a recommended length of 3 meters (or about 9 feet and 10 inches). However, the biggest limitation to the length of the cable is the quality of the cable. Results may vary, but with a high quality cable you should be able to go beyond 3 meters. However, to ensure you achieve the best results possible, use an active cable when going more than 10 feet (3 meters).

In order to go beyond these cable length limits (or recommended lengths) you need to use self-powered USB hubs or active (repeater) cables; both of which have their own limits as well. Other options such as USB over Ethernet or building your own USB bridge can extend the USB range further.

The USB 2.0 specification requires that cable delay be less than 5.2 ns per meter (192 000 km/s, which is close to the maximum achievable transmission speed for standard copper wire). -USB, WIKI

Remember these are the theoretical maximum lengths; your mileage will vary from cable to cable.

Solution 2:

I do not know why your keyboard isn't rcognised, it sometimes happen so if the extension is long and of low quality.

I curently use a usb extension cable of 5m long and another of 1m long, if there is no problem with the extension(use it to connect any other devices like pendrive or use it on another pc) and it is of good quality, then there's something wrong with the keyboard.