View previous topic :: View next topic |
Author |
Message |
belek666
Joined: 14 Apr 2008 Posts: 21
|
Posted: Mon Oct 12, 2009 4:20 am Post subject: ps2kbd.irx problem |
|
|
I have problem with keyboard support in any homebrew program. I can't find any working ps2kbd.irx for my keyboard. In ps2link I get this log:
Code: | PS2KBD: Found a keyboard device
PS2KBD: Connected device
PS2KBD - USB Keyboard Library
PS2KEYBOARD: Configuration set error res 290, bytes 0, arg a8700 |
290 = 0x122
from usbd.h
Code: | #define USB_RC_ABORTED 0x122 // Operation Aborted |
What that mean? How I can fix it?
Thanks for any help. |
|
Back to top |
|
|
Mega Man
Joined: 18 Jun 2005 Posts: 274
|
Posted: Mon Oct 12, 2009 8:38 am Post subject: |
|
|
Maybe there are connection problems:
1. Try to plug it out and reconnect the keyboard.
2. You should only use a USB hub with power supply or connect the keyboard directly to the USB port of the PS2.
There was also a bug in the USB driver (usbd.irx) which could generate such errors, so use a newer USB driver (11.08.2009, SVN rev 1599 or higher) |
|
Back to top |
|
|
belek666
Joined: 14 Apr 2008 Posts: 21
|
Posted: Mon Oct 12, 2009 6:42 pm Post subject: |
|
|
Thanks for reply. I tried reconnect keyboard but it doesn't help. I don't use any USB hubs and I used latest usbd.irx.
I have simply remove "return" function in ps2kbd src where I got error:
Code: |
if(resultCode != USB_RC_OK)
{
printf("PS2KEYBOARD: Configuration set error res %d, bytes %d, arg %p\n", resultCode, bytes, arg);
return;
} |
After that in ps2link I got this:
Code: | PS2KBD: Found a keyboard device
PS2KBD: Connected device
PS2KEYBOARD: Configuration set error res 290, bytes 0, arg a8700
PS2KEYBOARD: Data Recv set res 4, bytes 0, arg a8700 |
Code: | #define USB_RC_STALL 0x004 // Endpoint Stalled |
and leds on keyboard have lighted but it's not working. |
|
Back to top |
|
|
Mega Man
Joined: 18 Jun 2005 Posts: 274
|
Posted: Tue Oct 13, 2009 7:27 am Post subject: |
|
|
The failed call to UsbSetDeviceConfiguration() didn't set the configuration, so every try to use an USB endpoint will stall.
I add here an explanation, because you may to solve the problem by experimenting:
An USB endpoint is a one way pipe to communicate to the USB device. The only way for a device to refuse the communication is to stall. The configuration endpoint 0x00/0x80 is an exception. The endpoint 0x00/0x80 is used to configure the device and is always available. This endpoint allows communication in both directions. The other endpoints need to be activated by selecting a configuration.
The call UsbSetDeviceConfiguration() will activate a configuration. You can ask the device which configuration can be used. The function UsbGetDeviceStaticDescriptor() can read this configuration. I detected that this descriptor is sometimes bad. At least the listed endpoints were mixed up.
So what you can do:
1. Guess the correct configuration number: Replace "conf->bConfigurationValue" in the call to UsbSetDeviceConfiguration() by one number. Normally 1 is working, maybe you will need 2 or 3.
2. Read the configuration number from a working operating system: Connect the keyboard to an Linux and enter the command "lsusb -v" to get all possible configurations. Then look for possible values for bConfigurationValue. You need to select something which supports the boot protocol. |
|
Back to top |
|
|
belek666
Joined: 14 Apr 2008 Posts: 21
|
Posted: Tue Oct 13, 2009 9:12 pm Post subject: |
|
|
I tried guess the correct configuration number (I checked from 1 to 10) and no luck. Then I launched ubuntu and from there I got bConfigurationValue = 1. Again no luck. There must be something wrong in ps2kbd.irx because my keyboard is working with modules from PS2 game (which aren't usable in homebrew). |
|
Back to top |
|
|
Mega Man
Joined: 18 Jun 2005 Posts: 274
|
Posted: Sat Oct 17, 2009 6:31 pm Post subject: |
|
|
Ok, I think the problem is usbd.irx and not ps2kbd.irx, because usbd.irx is responsible for UsbSetDeviceConfiguration. You can try to use a usbd.irx from a PS2 game disc. Some old versions are compatible (at least with ps2kdb.irx). As far as I remember the version included in naplink was working with it. Other USB stuff was not working, but the keyboard. |
|
Back to top |
|
|
belek666
Joined: 14 Apr 2008 Posts: 21
|
Posted: Sat Oct 17, 2009 8:43 pm Post subject: |
|
|
I've tested usbd.irx from naplink and the same error occurred. Also module taken from ps2 game (where my keyboard works) didn't help. I believe there must be bug in ps2kbd.irx.
I found something in ps2kbd. When I uncomment one line (which is printing configuration value) in src:
Code: |
printf("Configuration value %d\n", conf->bConfigurationValue);
UsbSetDeviceConfiguration(currDev->configEndp, conf->bConfigurationValue, ps2kbd_config_set, currDev); |
in ps2link I only got this:
Code: | PS2KBD - USB Keyboard Library
PS2KBD: Found a keyboard device
PS2KBD: Connected device |
but keyboard is not working.
Sorry for bad English. |
|
Back to top |
|
|
Mega Man
Joined: 18 Jun 2005 Posts: 274
|
Posted: Sat Oct 17, 2009 10:03 pm Post subject: |
|
|
Sorry, I've no further idea.
The ps2link connection sometimes looses lines if you print too much. You should also modify a printed line to verify that your code reaches the target. |
|
Back to top |
|
|
|