pok3r-custom / pok3r_re_firmware

Reverse engineering project for the POK3R and related keyboards.
219 stars 17 forks source link

pok3r RGB v1.04.00 #11

Closed Japa986 closed 6 years ago

Japa986 commented 6 years ago

Hi, I tried this tool, but it doesn't seem to be detecting my keyboard.

I'm getting [00:00:00:001] E [|:] Unknown Device and [00:00:00:017] N List Devices... in the logs folder.

Also I see you included the latest firmware as exe, but the bin files (patched and non-patched) are for previous version 1.03.00.

Does all that mean it's not compatible with 1.04.00 ?

Thanks

edit: tried to flash anyway and got this lol with c++ runtime library error

[00:00:00:002] N Opened POK3R RGB [00:00:00:006] N Update Firmware: disassemble\pok3r_rgb\v130\firmware_v130.bin [00:00:00:011] E [|:] FUCK WINDOWS

ChaoticEnigma commented 6 years ago

I'm not sure what you're trying to do... The version of the firmware on the keyboard should have no impact on whether pok3rtool works with a keyboard. I should clarify somewhere in the README that pok3rtool is a development tool. The only real reason to use this is if you want to put different firmware on your keyboard, and there isn't much of that around.

The patched POK3R RGB firmware exists only so the bootloader could be read out of the flash on a keyboard. After the first time that is done for each keyboard, it really only exists for posterity. (Once we have a copy of the bootloader, we can disable the flash protection and run the firmware with a debugger.) So there wasn't a reason to patch a copy of the 1.04.00 firmware.

The error you got is a proper bug, I would appreciate the log file for that if you have it.

Japa986 commented 6 years ago

Thanks for replying and making it clearer what the purpose of the tool is.

Short answer is I wanted to use the tool to try and re-flash the firmware with either the existing or lower version of firmware that is on my keyboard.

Longer answer.. reason I tried that is because I have a problem with my keyboard being read-only. Nothing I program "sticks", but keyboard works fine otherwise. Didn't get anywhere asking Vortex support or on various forums.

Also now I'm 99% certain that this can't be fixed with any firmware changes, possible custom once in future or existing.

About the log, I wouldn't mind posting it except there is nothing in it unless there is a command which would produce a more detailed log and in the end I think that bug might be only due to my keyboard being in a state like I mentioned above.

ChaoticEnigma commented 6 years ago

I looked into the first issue you were having (pok3rtool not listing the Pok3r RGB). I never implemented a function needed to do that on windows, but it should work now on master.

For the second error you got when flashing, I'm not sure, but I made a change that may give a clearer error. What did you use to compile this? MinGW, MSYS, gcc, Visual C++, etc?

So, by read-only, you mean you can't program keys on your keyboard? Have you tried other layers? (the default layer is read-only by design). What makes you think it couldn't be fixed by firmware? Are you sure it is a hardware problem?

Japa986 commented 6 years ago

List command now works.

[00:00:00:025] N List Devices...
[00:00:00:039] 0 D [|:] Devices: 1
[00:00:00:044] 0 D [|:] send:
0000  12200000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 | . ..............................
0020  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 | ................................
[00:00:00:056] 0 D [|:] recv:
0000  12200000 1a000000 56003100 2e003000 34002e00 30003000 00000000 00000000 | . ......V.1...0.4...0.0.........
0020  0000ffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff | ................................
[00:00:00:065] N POK3R RGB: V1.04.00

I'm using the mingw32 to compile. This master version no longer gives the c++ runtime error and I managed to flash the patched v130 firmware.

https://pastebin.com/pxNvCvEW

Exactly, can't program the keys. Of course I tried other layers.. I wish it was something as simple as that, but thanks for trying to help and sorry for off-topic I did try geehack, but nobody had any ideas.

Basically this tool was my last try before marking it as unfixable and giving up. At least I can still use it as a normal keyboard so that is good.

ChaoticEnigma commented 6 years ago

Well hold up, no need to close the book on this so fast. There's no magic here, and only so many things to go wrong. That pastebin is truncated, so I can't see if it succeeded or not, but if you say it worked, that's good. It's honestly the least likely to be a firmware issue. I'm able to program keys and leds persistently with the v130 and v140 firmware.

That basically leaves PCB defect, and flash defect. The fact that the keyboard works at all gives some hope that the flash chip may be ok. What it sounds like, is that the Write-Protect (WP#) pin on the flash chip is active. Look at this datasheet for the flash chip, on the first page is the pinout. The flash chip is right next to the microcontroller (the big one). If you have a voltmeter/multimeter, try to measure the voltage between pins 3 and 4 (WP# and VSS) of the flash chip while the board is powered. Try to get as close to the black plastic on both pins as possible. Note the orientation of the chip, indicated by the dot in the corner.

You should meaure 3.3V between those pins. If you measure 0V, that is your problem.

Japa986 commented 6 years ago

It's black magic I swear. Not sure how that pastebin got cut.. but this one should be complete. https://pastebin.com/icq7EsXE

Also I tested all the other commands and all worked, including dumping the firmware to file so the tool is working great even on windows.

Here is the flash chip and voltage between pins 3 and 4. https://imgur.com/Omq96I2

Hmm so it's a PCB defect, strange as the keyboard worked for quite some time before this happened.

ChaoticEnigma commented 6 years ago

Hold on, are you saying that the keyboard used to work (programming, leds), but it stopped working (programming? leds?)? It failed suddenly? No idea why?

My thought was that the WP# pin might be lifted or not have soldered. If this failed recently, that won't be the issue. We can rule out PCB defects, the issue would be component failure.

Japa986 commented 6 years ago

Probably should have mentioned that earlier.. yes, it used to work and some things are still "stuck" as programmed from before.

Also holding ALT keys (until they stop blinking) to reset does nothing and holding FN+R resets the layer temporary until you change the layer or unplug/plug keyboard. So I can set the lightning temporary, but can't program anything or remove existing programming.

Component failure.. if I had to guess that could be flash memory, as it should store the programming or you mean multiple components.. nvm.

Well at least I learned some things so thank you and goodbye.

Japa986 commented 6 years ago

Update: The keyboard fixed itself.

There are three factors that could have attributed to this. One is new PC, but I previously tried using it on other devices and second it was unplugged for at least two weeks while I was gathering the parts for that new PC, but being without power shouldn't do anything either. Last factor that I can think of are the cables, but again I tried a different cable before and it did nothing.

Conclusion: Sometime you just get lucky.. WTH??