OGA v1.1 issues (sleep, and gamepad changed?)

Talking about OS and emulation core development
shanti
Posts: 267
Joined: Fri Feb 15, 2019 3:12 am
languages_spoken: english, spanish
ODROIDs: Odroid N2
Has thanked: 55 times
Been thanked: 96 times
Contact:

OGA v1.1 issues (sleep, and gamepad changed?)

Post by shanti » Wed May 20, 2020 1:36 pm

so I got the new revision, everything is working fine except for 2 small issues.

1.- Sleep, it seems the module esp8089 has some problems, I followed what @joy suggested (here viewtopic.php?f=187&p=293067#p293067), and while there is no more kernel panic, the module does not load upon waking up the device, so WiFi is dead (works fine before going to sleep).

Before sleep

Code: Select all

lsmod
Module                  Size  Used by
esp8089               282624  0
dwc2                  151552  0
sch_fq_codel           20480  5
wireguard             139264  0
ipv6                  450560  25 wireguard
ip6_udp_tunnel         16384  1 wireguard
udp_tunnel             16384  1 wireguard
After

Code: Select all

lsmod
Module                  Size  Used by
dwc2                  151552  0
sch_fq_codel           20480  1
wireguard             139264  0
ipv6                  450560  25 wireguard
ip6_udp_tunnel         16384  1 wireguard
udp_tunnel             16384  1 wireguard
And if I try to load the module with modprobe a kernel panic happens (detailed logs https://pastebin.com/VsMz2vQd)


2.- This is probably something on my end, but I find it rather weird, if I load the new dtb rk3326-odroidgo2-linux-v11.dtb (on the new or old revision OGA), buttons seem to respond different (up is left, down is right, and a few other buttons) but if I use the old dtb, then buttons seem to work exactly the same as the old revision, this might be something related to SDL apps as evtest seems to see the buttons exactly the same on both dtbs, I see no big changes to buttons on the dts to warrant this, any idea why this happens?

It seems I can just use the new rk3326-odroidgo2-linux-v11.dtb for both revisions (and it seems to work) and the buttons will work the same on both, but is this a good idea? old revision seems to work the same with the new dtb.

joy
Posts: 1226
Joined: Fri Oct 02, 2015 1:44 pm
languages_spoken: english
ODROIDs: ODROID-C1+, XU4, X
Has thanked: 106 times
Been thanked: 141 times
Contact:

Re: OGA v1.1 issues (sleep, and gamepad changed?)

Post by joy » Wed May 20, 2020 1:56 pm

Hi @shanti,
Thank you for your feedback.

I will check two issues, sleep and buttons, soon again.

joy
Posts: 1226
Joined: Fri Oct 02, 2015 1:44 pm
languages_spoken: english
ODROIDs: ODROID-C1+, XU4, X
Has thanked: 106 times
Been thanked: 141 times
Contact:

Re: OGA v1.1 issues (sleep, and gamepad changed?)

Post by joy » Wed May 20, 2020 2:38 pm

Hello @shanti,

1. Sleep
I found the latest kernel commit makes the kernel panic again.
Let me try to fix it.
I will update the status once I'm done.

2. Gamepad
To make sure, I've checked buttons event,
but I can't reproduce the issue you mentioned on HK emulationstation. (Ubuntu 20.04 ES image)
As you said, all key map is same as before except L2 and R2. :roll:

shanti
Posts: 267
Joined: Fri Feb 15, 2019 3:12 am
languages_spoken: english, spanish
ODROIDs: Odroid N2
Has thanked: 55 times
Been thanked: 96 times
Contact:

Re: OGA v1.1 issues (sleep, and gamepad changed?)

Post by shanti » Wed May 20, 2020 3:49 pm

joy wrote:
Wed May 20, 2020 2:38 pm
Hello @shanti,

1. Sleep
I found the latest kernel commit makes the kernel panic again.
Let me try to fix it.
I will update the status once I'm done.

2. Gamepad
To make sure, I've checked buttons event,
but I can't reproduce the issue you mentioned on HK emulationstation. (Ubuntu 20.04 ES image)
As you said, all key map is same as before except L2 and R2. :roll:
Thanks!

Yeah the gamepad one is a weird one, but I am not 100% sure why it happens, but it is something on the DTB as switching to the old one makes the button work the same again. any pointers as to what I could check on the dts?

EDIT: Oh isn't the reference image using libgo2 for input instead of SDL?

EDIT2: This is a diff for the Retroarch gamepad config, left one is with the old DTB, the right is for the V1.1 DTB, they are mapped to the same buttons on the device, but they are detected as different numbers
https://www.diffchecker.com/Xi77NNTx

joy
Posts: 1226
Joined: Fri Oct 02, 2015 1:44 pm
languages_spoken: english
ODROIDs: ODROID-C1+, XU4, X
Has thanked: 106 times
Been thanked: 141 times
Contact:

Re: OGA v1.1 issues (sleep, and gamepad changed?)

Post by joy » Wed May 20, 2020 5:26 pm

@shanti,
I have an update of sleep issue.
- Kernel patch
- Updated workaround with 'sleep' file

1. Kernel patch

With this kernel patch, kernel panic after resume can be fixed.

Code: Select all

Subject: [PATCH] net: esp8089: Fix reset gpio free missing
---
diff --git a/drivers/net/wireless/esp8089/sdio_stub.c b/drivers/net/wireless/esp8089/sdio_stub.c
index b77d505..8c8f6a0 100755
--- a/drivers/net/wireless/esp8089/sdio_stub.c
+++ b/drivers/net/wireless/esp8089/sdio_stub.c
@@ -40,6 +40,7 @@
 	printk("ESP8089 reset via GPIO %d\n", esp_reset_gpio);
 	gpio_request(esp_reset_gpio,"esp_reset");
 	gpio_direction_output(esp_reset_gpio, 1);
+	gpio_free(esp_reset_gpio);
 }
 
 void sif_platform_target_poweroff(void)

2. Updated workaround with 'sleep' file

And about esp8089 module auto-loading after resume, I need to develop related logic more.
To improve system stability with the WIFI module from several unexpected conditions like hard reboot tests,
I've adjusted some port controls (removed mmc-pwrseq for WIFI_EN) and now, it's needed to re-load esp8089 manually after resume.

So please use this 'sleep' file.
- /lib/systemd/system-sleep/sleep
( permission a+x )

Code: Select all

#!/bin/bash

case $1 in
  pre)
       rmmod esp8089
       ;;
  post)
       modprobe -i esp8089
       ;;
esac
-------------------------------------------------------------------------------------------------

Here is my test brief.
(1) Booting

Code: Select all

# lsmod
Module                  Size  Used by
esp8089               266240  0
sch_fq_codel           20480  5
ip_tables              24576  0
x_tables               32768  1 ip_tables
ipv6                  372736  24
(2) Enter suspend mode

Code: Select all

# systemctl suspend
(3) Resume by pushing power key
(4) Confirm wlan0 network connection

Code: Select all

# lsmod
Module                  Size  Used by
esp8089               266240  0
sch_fq_codel           20480  5
ip_tables              24576  0
x_tables               32768  1 ip_tables
ipv6                  372736  24

# ip addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
4: wlan0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
    link/ether 18:fe:34:16:7d:73 brd ff:ff:ff:ff:ff:ff
    inet 192.168.0.132/24 brd 192.168.0.255 scope global dynamic noprefixroute wlan0
       valid_lft 7198sec preferred_lft 7198sec
    inet6 fe80::cd72:b800:99cf:76fc/64 scope link noprefixroute 
       valid_lft forever preferred_lft forever

Code: Select all

# ping google.com
PING google.com (216.58.199.110) 56(84) bytes of data.
64 bytes from hkg07s22-in-f110.1e100.net (216.58.199.110): icmp_seq=1 ttl=52 time=83.4 ms
64 bytes from hkg07s22-in-f110.1e100.net (216.58.199.110): icmp_seq=2 ttl=52 time=84.2 ms
Could you check it?
If you need more information or something for your test, please let me know.
I will include this patch for a next kernel update.
Sorry for the inconvenience.

My final goal is to implement esp8089 suspend/resume logic (including dwc2) on kernel space without this workaround
but I'm not sure I can do it within a short period.
So for now, please use this workaround. :)

joy
Posts: 1226
Joined: Fri Oct 02, 2015 1:44 pm
languages_spoken: english
ODROIDs: ODROID-C1+, XU4, X
Has thanked: 106 times
Been thanked: 141 times
Contact:

Re: OGA v1.1 issues (sleep, and gamepad changed?)

Post by joy » Wed May 20, 2020 5:59 pm

shanti wrote:
Wed May 20, 2020 3:49 pm

EDIT: Oh isn't the reference image using libgo2 for input instead of SDL?

EDIT2: This is a diff for the Retroarch gamepad config, left one is with the old DTB, the right is for the V1.1 DTB, they are mapped to the same buttons on the device, but they are detected as different numbers
https://www.diffchecker.com/Xi77NNTx
Sorry. I have no idea. :(
But maybe @crashoverride can explain it and help us, I think. :)

crashoverride
Posts: 4969
Joined: Tue Dec 30, 2014 8:42 pm
languages_spoken: english
ODROIDs: C1
Has thanked: 0
Been thanked: 291 times
Contact:

Re: OGA v1.1 issues (sleep, and gamepad changed?)

Post by crashoverride » Wed May 20, 2020 11:04 pm

shanti wrote:
Wed May 20, 2020 3:49 pm
EDIT: Oh isn't the reference image using libgo2 for input instead of SDL?
joy wrote:
Wed May 20, 2020 2:38 pm
I can't reproduce the issue you mentioned on HK emulationstation. (Ubuntu 20.04 ES image)
This is a SDL specific issue. Every time the gamepad definition changes in the device tree, the numbers used by SDL change. A Linux input device (evdev) and libgo2 use well defined identifiers. SDL uses index numbers without any guarantees about about order or assignment. Since the Reference Image uses libgo2 for input, it does not have this issue.

For SDL, a mapping and use of its game controller API are likely required:
https://wiki.libsdl.org/CategoryGameController
SDL_GameController uses the naming-conventions of xbox360/XInput for all supported devices, so you'll know that SDL_CONTROLLER_AXIS_LEFTX is always the X-Axis of the left Analog Stick, or SDL_CONTROLLER_BUTTON_B is always the rightmost buttons of the 4 buttons on the right, for example.
https://github.com/gabomdq/SDL_GameControllerDB
These users thanked the author crashoverride for the post:
joy (Thu May 21, 2020 7:44 am)

shanti
Posts: 267
Joined: Fri Feb 15, 2019 3:12 am
languages_spoken: english, spanish
ODROIDs: Odroid N2
Has thanked: 55 times
Been thanked: 96 times
Contact:

Re: OGA v1.1 issues (sleep, and gamepad changed?)

Post by shanti » Thu May 21, 2020 1:23 am

Thanks @joy I will test and get back at you.

And thanks @crashoverride for the explanation, I thought something like that might be going on. I don't think I could get all the apps that use SDL to start using SDL_GameControllerDB, but unfortunately even if they did use it, the buttons also changed (I tested it with VVVVVV that uses the DB) as the definitions use the button numbers anyways.

(as you can see on this entry for the OGA joypad)

Code: Select all

19000000010000000100000001010000,odroidgo2_joypad,a:b1,b:b0,x:b2,y:b3,leftshoulder:b4,rightshoulder:b5,dpdown:b7,dpleft:b8,dpright:b9,dpup:b6,leftx:a0,lefty:a1,guide:b10,leftstick:b12,lefttrigger:b11,rightstick:b13,righttrigger:b14,start:b15,platform:Linux,
Anyways I don't want to make this bigger if its not needed, do you think the same dtb could work for both revisions without issues? I have tested running the v1.1 DTB on the older v1.0 and it seems to work fine, but I have not done extensive testing, and I am not sure this would be the best solution?

EDIT: Or is there a way to change the name/id of the joypad in the DTB? I could then use a patch and have 2 separate configs, this would be the best solution for the moment I think.

crashoverride
Posts: 4969
Joined: Tue Dec 30, 2014 8:42 pm
languages_spoken: english
ODROIDs: C1
Has thanked: 0
Been thanked: 291 times
Contact:

Re: OGA v1.1 issues (sleep, and gamepad changed?)

Post by crashoverride » Thu May 21, 2020 2:49 am

shanti wrote:
Thu May 21, 2020 1:23 am
do you think the same dtb could work for both revisions without issues?
This would be a "dirty hack". It would require that the driver misreport information in order to work around a SDL issue. In Linux, a driver reports only the buttons it actually has.

Possible solutions are:
1) Custom game OS's can choose to use a single dtb and accept any consequences of the choice.
- or -
2) Figure out what SDL uses to generate its controller GUIDs and modify the v1.0 and v1.1 dtbs to generate different GUIDs. This would mean that a mapping database would have two (2) entries for GO-Advance. Its important that the device name (odroidgo2_joypad) not change because /dev/input entries are created based on the name.

shanti
Posts: 267
Joined: Fri Feb 15, 2019 3:12 am
languages_spoken: english, spanish
ODROIDs: Odroid N2
Has thanked: 55 times
Been thanked: 96 times
Contact:

Re: OGA v1.1 issues (sleep, and gamepad changed?)

Post by shanti » Thu May 21, 2020 3:08 am

I guess option 2 would be best, but sadly I have no real idea how this gets calculated.

I think the joypad should have had a different name and/or ID in some way, as the gamepad is different between each revision, why is this important for me? well...take EmuELEC or Lakka for example, (or any distro that uses SDL/Retroarch and is not tied to libgo2) this means there is going to need to be 2 images just for this tiny change, or have extensive configuration steps for the user that uses a different revision (or the same SD card on both revisions maybe?) , as opposed to just being plug-and-play as it used to be. As it is right now, they are not compatible with each other thus making older releases not usable on newer revision (or vice versa) without re-configuring everything.

I will clarify that I might be wrong, all of this is based on my testing with Lakka and EmuELEC (as those are the ones I have compiled with v1.1 support) I still need to do more testing on this using other distros, probably Batocera for example will also be affected.

crashoverride
Posts: 4969
Joined: Tue Dec 30, 2014 8:42 pm
languages_spoken: english
ODROIDs: C1
Has thanked: 0
Been thanked: 291 times
Contact:

Re: OGA v1.1 issues (sleep, and gamepad changed?)

Post by crashoverride » Thu May 21, 2020 5:17 am

shanti wrote:
Thu May 21, 2020 3:08 am
I guess option 2 would be best, but sadly I have no real idea how this gets calculated.
I think if we modify the driver to pull product and/or version ID from the device tree, it should make SDL think its a different device GUID:
https://github.com/hardkernel/linux/blo ... #L668-L670

[edit]
There are many devices in the gamepad database with the exact same name, so I do not think changing the name would be required.

crashoverride
Posts: 4969
Joined: Tue Dec 30, 2014 8:42 pm
languages_spoken: english
ODROIDs: C1
Has thanked: 0
Been thanked: 291 times
Contact:

Re: OGA v1.1 issues (sleep, and gamepad changed?)

Post by crashoverride » Thu May 21, 2020 5:38 am

I thought of another work-around for SDL. Gamepad devices can be created in user-space. Therefore, it should be possible to create a program that presents a virtual gamepad for SDL to use with a unique name. This virtual device can report having L1/L2 + R1/R2 without requiring any kernel/dtb "hacks". The program would then use the kernel gamepad driver and just route the events.

My preference is still to report corrected vendor/product/version information in the kernel driver.

Slaminger
Posts: 118
Joined: Tue Jul 16, 2019 12:30 am
languages_spoken: english
ODROIDs: Xu4, n2, c2, c4, OGA, OGA-BE
Location: Canada
Has thanked: 17 times
Been thanked: 33 times
Contact:

Re: OGA v1.1 issues (sleep, and gamepad changed?)

Post by Slaminger » Thu May 21, 2020 6:40 am

Has anyone tried getting data to the USB c port?? USB c would support video out.

shanti
Posts: 267
Joined: Fri Feb 15, 2019 3:12 am
languages_spoken: english, spanish
ODROIDs: Odroid N2
Has thanked: 55 times
Been thanked: 96 times
Contact:

Re: OGA v1.1 issues (sleep, and gamepad changed?)

Post by shanti » Thu May 21, 2020 7:33 am

crashoverride wrote:
Thu May 21, 2020 5:38 am
I thought of another work-around for SDL. Gamepad devices can be created in user-space. Therefore, it should be possible to create a program that presents a virtual gamepad for SDL to use with a unique name. This virtual device can report having L1/L2 + R1/R2 without requiring any kernel/dtb "hacks". The program would then use the kernel gamepad driver and just route the events.

My preference is still to report corrected vendor/product/version information in the kernel driver.
This does not sound like a bad idea, but, do you know of any program that already does this?
crashoverride wrote:
Thu May 21, 2020 5:17 am
shanti wrote:
Thu May 21, 2020 3:08 am
I guess option 2 would be best, but sadly I have no real idea how this gets calculated.
I think if we modify the driver to pull product and/or version ID from the device tree, it should make SDL think its a different device GUID:
https://github.com/hardkernel/linux/blo ... #L668-L670

[edit]
There are many devices in the gamepad database with the exact same name, so I do not think changing the name would be required.
But I am not sure all programs (e.g. Retroarch) use the GUID but they do use the name (I am not 100% sure on this again but you can see it on the cfg I pasted earlier https://www.diffchecker.com/Xi77NNTx) so if there is a way to pull the name and the ID from the DTB for me this would be the ideal solution, even if I have to do it via patch (not upstream) but my knowledge on DTB is not that great, so do you think you could share any tips on how to do this?

Ideally the name should probably be "odroidgo2_joypad_v11" for the new one and "input->id.version" should be 0x0111 maybe?

EDIT: just got confirmation that Retroarch does use vid:pid so just changing the id as you say would be sufficient

Code: Select all

input_device = "Microsoft X-Box One pad"
input_driver = "udev"
input_vendor_id = 1118
input_product_id = 721
Last edited by shanti on Thu May 21, 2020 8:09 am, edited 1 time in total.

crashoverride
Posts: 4969
Joined: Tue Dec 30, 2014 8:42 pm
languages_spoken: english
ODROIDs: C1
Has thanked: 0
Been thanked: 291 times
Contact:

Re: OGA v1.1 issues (sleep, and gamepad changed?)

Post by crashoverride » Thu May 21, 2020 8:03 am

shanti wrote:
Thu May 21, 2020 7:33 am
do you know of any program that already does this?
It would be trivial to write since half of it already exits in libgo2.
shanti wrote:
Thu May 21, 2020 7:33 am
Ideally the name should probably be "odroidgo2_joypad_v11" for the new one and "input->id.version" should be 0x0111 maybe?
The problem with changing the name is that it pushes what is a SDL problem to everyone else. Anyone authoring software for GO-Advance would need to check for multiple names instead of opening a single known name.
https://github.com/OtherCrashOverride/l ... nput.c#L42

Once vendor/product/version are in place, it should be possible to write a UDEV RULE to rename the device. However, I do not know if this would be enough for SDL to treat it differently.

Another possibility would be to modify the device tree in boot.ini to rename the node based on hardware version. This would still require a patch to the driver to read the name value from the device tree.

We should probably wait for feedback from HardKernel to see what they suggest. There are now plenty of options presented.

crashoverride
Posts: 4969
Joined: Tue Dec 30, 2014 8:42 pm
languages_spoken: english
ODROIDs: C1
Has thanked: 0
Been thanked: 291 times
Contact:

Re: OGA v1.1 issues (sleep, and gamepad changed?)

Post by crashoverride » Thu May 21, 2020 8:04 am

Slaminger wrote:
Thu May 21, 2020 6:40 am
Has anyone tried getting data to the USB c port?? USB c would support video out.
The USB-C port is for charging only. As noted in the announcement, it does not provide any data lines.

shanti
Posts: 267
Joined: Fri Feb 15, 2019 3:12 am
languages_spoken: english, spanish
ODROIDs: Odroid N2
Has thanked: 55 times
Been thanked: 96 times
Contact:

Re: OGA v1.1 issues (sleep, and gamepad changed?)

Post by shanti » Thu May 21, 2020 8:12 am

crashoverride wrote:
Thu May 21, 2020 8:03 am
shanti wrote:
Thu May 21, 2020 7:33 am
do you know of any program that already does this?
It would be trivial to write since half of it already exits in libgo2.
shanti wrote:
Thu May 21, 2020 7:33 am
Ideally the name should probably be "odroidgo2_joypad_v11" for the new one and "input->id.version" should be 0x0111 maybe?
The problem with changing the name is that it pushes what is a SDL problem to everyone else. Anyone authoring software for GO-Advance would need to check for multiple names instead of opening a single known name.
https://github.com/OtherCrashOverride/l ... nput.c#L42

Once vendor/product/version are in place, it should be possible to write a UDEV RULE to rename the device. However, I do not know if this would be enough for SDL to treat it differently.

Another possibility would be to modify the device tree in boot.ini to rename the node based on hardware version. This would still require a patch to the driver to read the name value from the device tree.

We should probably wait for feedback from HardKernel to see what they suggest. There are now plenty of options presented.
I think you are right on the name, I just got confirmation as well that Retroarch does use vid:pid so just changeing the pid should be enough to handle them as different gamepads.


"This would still require a patch to the driver to read the name value from the device tree."

This I think would be the best solution, as it could leave the driver as is for distros that do not have the problem, or give a simple solution for the ones that do have the problem.

shanti
Posts: 267
Joined: Fri Feb 15, 2019 3:12 am
languages_spoken: english, spanish
ODROIDs: Odroid N2
Has thanked: 55 times
Been thanked: 96 times
Contact:

Re: OGA v1.1 issues (sleep, and gamepad changed?)

Post by shanti » Thu May 21, 2020 4:18 pm

joy wrote:
Wed May 20, 2020 5:26 pm
@shanti,
I have an update of sleep issue.
- Kernel patch
- Updated workaround with 'sleep' file
...
So for now, please use this workaround. :)
Sorry I just got time to test this and it works perfectly fine :) Thank you @joy!
These users thanked the author shanti for the post (total 2):
odroid (Thu May 21, 2020 4:46 pm) • joy (Thu May 21, 2020 5:01 pm)

shanti
Posts: 267
Joined: Fri Feb 15, 2019 3:12 am
languages_spoken: english, spanish
ODROIDs: Odroid N2
Has thanked: 55 times
Been thanked: 96 times
Contact:

Re: OGA v1.1 issues (sleep, and gamepad changed?)

Post by shanti » Thu May 21, 2020 4:56 pm

crashoverride wrote:
Thu May 21, 2020 8:03 am
Another possibility would be to modify the device tree in boot.ini to rename the node based on hardware version. This would still require a patch to the driver to read the name value from the device tree.
So I edited the driver just to do some testing, and it seems that changing the name is required (at least for my use) as well as the id.version. So my suggestion would be to add a node in the dtb file to change the name and version, or editable values in boot.ini which if not present would use the default name and version, I think this would solve it for all.

joy
Posts: 1226
Joined: Fri Oct 02, 2015 1:44 pm
languages_spoken: english
ODROIDs: ODROID-C1+, XU4, X
Has thanked: 106 times
Been thanked: 141 times
Contact:

Re: OGA v1.1 issues (sleep, and gamepad changed?)

Post by joy » Thu May 21, 2020 7:19 pm

shanti wrote:
Thu May 21, 2020 4:18 pm
joy wrote:
Wed May 20, 2020 5:26 pm
@shanti,
I have an update of sleep issue.
- Kernel patch
- Updated workaround with 'sleep' file
...
So for now, please use this workaround. :)
Sorry I just got time to test this and it works perfectly fine :) Thank you @joy!
Hi @shanti,
Thank you for your confirmation!
You found a serious issue before OGA rev 1.1 official release,
so we can prepare more stable image in advance. :D

The kernel commit has been merged in HK Github and a new kernel package will be released soon.
https://github.com/hardkernel/linux/com ... dgoA-4.4.y
These users thanked the author joy for the post (total 2):
rooted (Thu May 21, 2020 8:53 pm) • shanti (Fri May 22, 2020 2:17 am)

shanti
Posts: 267
Joined: Fri Feb 15, 2019 3:12 am
languages_spoken: english, spanish
ODROIDs: Odroid N2
Has thanked: 55 times
Been thanked: 96 times
Contact:

Re: OGA v1.1 issues (sleep, and gamepad changed?)

Post by shanti » Fri May 22, 2020 2:05 am

joy wrote:
Thu May 21, 2020 7:19 pm
Hi @shanti,
Thank you for your confirmation!
You found a serious issue before OGA rev 1.1 official release,
so we can prepare more stable image in advance. :D

The kernel commit has been merged in HK Github and a new kernel package will be released soon.
https://github.com/hardkernel/linux/com ... dgoA-4.4.y
Thank you for the quick fix!

do you have any input on the dtb ideas to handle the gamepad issue? I been trying to figure out how to add them to the dtb, but I am failing really bad, so even if its not something up-streamed I would really like to add it to the dtb as a patch!
Last edited by shanti on Fri May 22, 2020 2:46 am, edited 1 time in total.

Slaminger
Posts: 118
Joined: Tue Jul 16, 2019 12:30 am
languages_spoken: english
ODROIDs: Xu4, n2, c2, c4, OGA, OGA-BE
Location: Canada
Has thanked: 17 times
Been thanked: 33 times
Contact:

Re: OGA v1.1 issues (sleep, and gamepad changed?)

Post by Slaminger » Fri May 22, 2020 2:20 am

crashoverride wrote:
Thu May 21, 2020 8:04 am
Slaminger wrote:
Thu May 21, 2020 6:40 am
Has anyone tried getting data to the USB c port?? USB c would support video out.
The USB-C port is for charging only. As noted in the announcement, it does not provide any data lines.
I know, I was curious if there was a way to give it data, connecting the data pins on the port to the gpio or something.

crashoverride
Posts: 4969
Joined: Tue Dec 30, 2014 8:42 pm
languages_spoken: english
ODROIDs: C1
Has thanked: 0
Been thanked: 291 times
Contact:

Re: OGA v1.1 issues (sleep, and gamepad changed?)

Post by crashoverride » Fri May 22, 2020 4:41 am

Slaminger wrote:
Fri May 22, 2020 2:20 am
I was curious if there was a way to give it data, connecting the data pins on the port to the gpio or something.
There is nothing to connect to it. The single USB port is used by the USB-A connector, and the single video output is connected to the LCD panel.

Slaminger
Posts: 118
Joined: Tue Jul 16, 2019 12:30 am
languages_spoken: english
ODROIDs: Xu4, n2, c2, c4, OGA, OGA-BE
Location: Canada
Has thanked: 17 times
Been thanked: 33 times
Contact:

Re: OGA v1.1 issues (sleep, and gamepad changed?)

Post by Slaminger » Fri May 22, 2020 4:47 am

crashoverride wrote:
Fri May 22, 2020 4:41 am
Slaminger wrote:
Fri May 22, 2020 2:20 am
I was curious if there was a way to give it data, connecting the data pins on the port to the gpio or something.
There is nothing to connect to it. The single USB port is used by the USB-A connector, and the single video output is connected to the LCD panel.
Fair enough, I'm having a quirk with the on board WiFi, its connecting but the IP its getting is way out of the normal range devices on my network get. Can't sftp, and domain comes back as domain not set.invalid

crashoverride
Posts: 4969
Joined: Tue Dec 30, 2014 8:42 pm
languages_spoken: english
ODROIDs: C1
Has thanked: 0
Been thanked: 291 times
Contact:

Re: OGA v1.1 issues (sleep, and gamepad changed?)

Post by crashoverride » Fri May 22, 2020 5:29 am

Slaminger wrote:
Fri May 22, 2020 4:47 am
its connecting but the IP its getting is way out of the normal range devices on my network get. Can't sftp, and domain comes back as domain not set.invalid
This would most likely be a network configuration issue. Try connecting with a different 2.4GHz device (802.11n) as 5GHz devices (802.11ac) are typically configured separately and distinct from the prior.

Slaminger
Posts: 118
Joined: Tue Jul 16, 2019 12:30 am
languages_spoken: english
ODROIDs: Xu4, n2, c2, c4, OGA, OGA-BE
Location: Canada
Has thanked: 17 times
Been thanked: 33 times
Contact:

Re: OGA v1.1 issues (sleep, and gamepad changed?)

Post by Slaminger » Fri May 22, 2020 7:01 am

crashoverride wrote:
Fri May 22, 2020 5:29 am
Slaminger wrote:
Fri May 22, 2020 4:47 am
its connecting but the IP its getting is way out of the normal range devices on my network get. Can't sftp, and domain comes back as domain not set.invalid
This would most likely be a network configuration issue. Try connecting with a different 2.4GHz device (802.11n) as 5GHz devices (802.11ac) are typically configured separately and distinct from the prior.
I've tried on two different routers, my normal network devices all are 10.0.0 numbers, and this one is 192.168. One router is 5g the other is 2.4

crashoverride
Posts: 4969
Joined: Tue Dec 30, 2014 8:42 pm
languages_spoken: english
ODROIDs: C1
Has thanked: 0
Been thanked: 291 times
Contact:

Re: OGA v1.1 issues (sleep, and gamepad changed?)

Post by crashoverride » Fri May 22, 2020 7:53 am

Slaminger wrote:
Fri May 22, 2020 7:01 am
I've tried on two different routers, my normal network devices all are 10.0.0 numbers, and this one is 192.168. One router is 5g the other is 2.4
From a console, use the following command to list connections:

Code: Select all

nmcli con show
Then use the following command with the WIFI connection listed from the above command:

Code: Select all

nmcli con show "WIFI_CONNECTION_NAME_LISTED_ABOVE"
Copy and paste the output to a pastebin for review.

Slaminger
Posts: 118
Joined: Tue Jul 16, 2019 12:30 am
languages_spoken: english
ODROIDs: Xu4, n2, c2, c4, OGA, OGA-BE
Location: Canada
Has thanked: 17 times
Been thanked: 33 times
Contact:

Re: OGA v1.1 issues (sleep, and gamepad changed?)

Post by Slaminger » Sat May 23, 2020 2:53 am

crashoverride wrote:
Fri May 22, 2020 7:53 am
Slaminger wrote:
Fri May 22, 2020 7:01 am
I've tried on two different routers, my normal network devices all are 10.0.0 numbers, and this one is 192.168. One router is 5g the other is 2.4
From a console, use the following command to list connections:

Code: Select all

nmcli con show
Then use the following command with the WIFI connection listed from the above command:

Code: Select all

nmcli con show "WIFI_CONNECTION_NAME_LISTED_ABOVE"
Copy and paste the output to a pastebin for review.
I got it, but I'm not sure its going to help. It looks normal to me. I booted it up today and it gave me a 10.0.0.103 IP, which is normal, after a reboot it showed the 192 IP again, I took the Ubuntu 20 SD and put it into the model 1 oga, used the WiFi adapter, still got the wrong IP. The issue is I can't ssh in so I have no way to get a log. I can only ssh in when the IP is correct, but then its working fine.
Last edited by Slaminger on Sat May 23, 2020 6:37 am, edited 1 time in total.

Slaminger
Posts: 118
Joined: Tue Jul 16, 2019 12:30 am
languages_spoken: english
ODROIDs: Xu4, n2, c2, c4, OGA, OGA-BE
Location: Canada
Has thanked: 17 times
Been thanked: 33 times
Contact:

Re: OGA v1.1 issues (sleep, and gamepad changed?)

Post by Slaminger » Sat May 23, 2020 6:32 am

Does this chip inside not see 5g WiFi?

crashoverride
Posts: 4969
Joined: Tue Dec 30, 2014 8:42 pm
languages_spoken: english
ODROIDs: C1
Has thanked: 0
Been thanked: 291 times
Contact:

Re: OGA v1.1 issues (sleep, and gamepad changed?)

Post by crashoverride » Sat May 23, 2020 7:33 am

Slaminger wrote:
Sat May 23, 2020 2:53 am
The issue is I can't ssh in so I have no way to get a log.
Connect an Ethernet adapter to the USB port. WIFI and Ethernet will work at the same time.
Slaminger wrote:
Sat May 23, 2020 6:32 am
Does this chip inside not see 5g WiFi?
The WIFI is 802.11n. It only operates in the 2.4Ghz bands.

crashoverride
Posts: 4969
Joined: Tue Dec 30, 2014 8:42 pm
languages_spoken: english
ODROIDs: C1
Has thanked: 0
Been thanked: 291 times
Contact:

Re: OGA v1.1 issues (sleep, and gamepad changed?)

Post by crashoverride » Sat May 23, 2020 7:36 am

Slaminger wrote:
Sat May 23, 2020 2:53 am
I took the Ubuntu 20 SD and put it into the model 1 oga, used the WiFi adapter, still got the wrong IP.
Is it possible there is another WIFI AP nearby with the same SSID as the one you are connecting to?

[edit]
What is the full IP address that starts with 192.168 ?

[edit]
Ensure there are no other devices on the network acting as a DHCP server. You can use WireShark on a desktop PC to capture DHCP broadcasts.

Slaminger
Posts: 118
Joined: Tue Jul 16, 2019 12:30 am
languages_spoken: english
ODROIDs: Xu4, n2, c2, c4, OGA, OGA-BE
Location: Canada
Has thanked: 17 times
Been thanked: 33 times
Contact:

Re: OGA v1.1 issues (sleep, and gamepad changed?)

Post by Slaminger » Sat May 23, 2020 7:51 am

192.168.100.104

on the new oga when I check my router I see:
18:FE:34:02:B5:46

IPv6 Address
2604:3d09:b77f:8d60:4050:3d95:7468:1520
Local Link IPv6 Address
fe80::220e:a3f0:4746:bf76
MAC Address
18:FE:34:02:B5:46
Comments

Where as on model 1 I see:
goadvance

IPv4 Address
10.0.0.236
IPv6 Address
2604:3d09:b77f:8d60:ecf7:7f72:bce:7c91
Local Link IPv6 Address
fe80::c6ab:c4a8:cf8c:db20
MAC Address
70:F1:1C:15:D8:81
Comments

on the newer oga model no ipv4 is being assigned to the device
just for testing I took the old build on ubuntu 19 and tossed it into the new OGA, put in the usb wifi stick and the ip was correct, so I tried taking the ubuntu 20 sd card and putting it into the old oga, connected the wifi usb and logged into the network, wrong ip.
my network has 2.4g and 5g but was set for the device to choose what signal it wanted, I tried defining them both as their own named networks, when I do that I can only see 2.4g on the oga, but it does not fix the issue.

I just got it working, fingers crossed. since I noticed it wasn't getting an ipv4 and only ipv6 for some reason I went into my router settings and into the oga-be device settings there, and manually switched it from dhcp to fixed ip, then manually assigned one that would fall into my network range, now its connected. but its still odd that the issue occurred, no?

crashoverride
Posts: 4969
Joined: Tue Dec 30, 2014 8:42 pm
languages_spoken: english
ODROIDs: C1
Has thanked: 0
Been thanked: 291 times
Contact:

Re: OGA v1.1 issues (sleep, and gamepad changed?)

Post by crashoverride » Sat May 23, 2020 8:14 am

Slaminger wrote:
Sat May 23, 2020 7:51 am
IPv6 Address
2604:3d09:b77f:8d60:4050:3d95:7468:1520
Slaminger wrote:
Sat May 23, 2020 7:51 am
IPv6 Address
2604:3d09:b77f:8d60:ecf7:7f72:bce:7c91
Check for the existence of another DHCP server on your network using WireShark. Its likely a race condition between them.

[edit]
To clarify, the point of interest is the IPv4 addressed assigned: 192.168.100.104

This is not an address range that would be self assigned. This strongly suggests that a DHCP lease is being offered with it.

Slaminger
Posts: 118
Joined: Tue Jul 16, 2019 12:30 am
languages_spoken: english
ODROIDs: Xu4, n2, c2, c4, OGA, OGA-BE
Location: Canada
Has thanked: 17 times
Been thanked: 33 times
Contact:

Re: OGA v1.1 issues (sleep, and gamepad changed?)

Post by Slaminger » Sat May 23, 2020 8:41 am

crashoverride wrote:
Sat May 23, 2020 8:14 am
Slaminger wrote:
Sat May 23, 2020 7:51 am
IPv6 Address
2604:3d09:b77f:8d60:4050:3d95:7468:1520
Slaminger wrote:
Sat May 23, 2020 7:51 am
IPv6 Address
2604:3d09:b77f:8d60:ecf7:7f72:bce:7c91
Check for the existence of another DHCP server on your network using WireShark. Its likely a race condition between them.

[edit]
To clarify, the point of interest is the IPv4 addressed assigned: 192.168.100.104

This is not an address range that would be self assigned. This strongly suggests that a DHCP lease is being offered with it.
ill grab wireshark and take a look
is there a semi easy way to backport the l2 r2 and wifi stuff into ubuntu 19 in the short term? these units are going to be shipping soon and libav is depreciated in ubuntu 20, so ive been having to manually install all of the stuff deb by deb and its incredibly slow. But I noticed I can just pop the sd from model 1 in and it works fine minus the l2 r2 and wifi

crashoverride
Posts: 4969
Joined: Tue Dec 30, 2014 8:42 pm
languages_spoken: english
ODROIDs: C1
Has thanked: 0
Been thanked: 291 times
Contact:

Re: OGA v1.1 issues (sleep, and gamepad changed?)

Post by crashoverride » Sat May 23, 2020 8:50 am

Slaminger wrote:
Sat May 23, 2020 8:41 am
Is there a semi easy way to backport the l2 r2 and wifi stuff into ubuntu 19 in the short term?
There are no OS dependencies on Ubuntu 20.04. The kernel, libgo2, and RetroRun should all work/compile on previous OS versions. Note that there is/was a GCC issue with armhf on Ubuntu 19.10 that was mitigated by using Clang/LLVM to compile RetroRun for 32bit.

Slaminger
Posts: 118
Joined: Tue Jul 16, 2019 12:30 am
languages_spoken: english
ODROIDs: Xu4, n2, c2, c4, OGA, OGA-BE
Location: Canada
Has thanked: 17 times
Been thanked: 33 times
Contact:

Re: OGA v1.1 issues (sleep, and gamepad changed?)

Post by Slaminger » Sat May 23, 2020 8:54 am

crashoverride wrote:
Sat May 23, 2020 8:50 am
Slaminger wrote:
Sat May 23, 2020 8:41 am
Is there a semi easy way to backport the l2 r2 and wifi stuff into ubuntu 19 in the short term?
There are no OS dependencies on Ubuntu 20.04. The kernel, libgo2, and RetroRun should all work/compile on previous OS versions. Note that there is/was a GCC issue with armhf on Ubuntu 19.10 that was mitigated by using Clang/LLVM to compile RetroRun for 32bit.
so in theory I should be able to recompile the libgo2 kernel and retrorun and rebuild them on ubuntu 19, and it should work?
do you happen to have the link the new kernel?

crashoverride
Posts: 4969
Joined: Tue Dec 30, 2014 8:42 pm
languages_spoken: english
ODROIDs: C1
Has thanked: 0
Been thanked: 291 times
Contact:

Re: OGA v1.1 issues (sleep, and gamepad changed?)

Post by crashoverride » Sat May 23, 2020 9:48 am

Slaminger wrote:
Sat May 23, 2020 8:54 am
so in theory I should be able to recompile the libgo2 kernel and retrorun and rebuild them on ubuntu 19, and it should work?
do you happen to have the link the new kernel?
For Ubuntu, there is no need to compile the kernel or uboot. Packaged versions are available from the repository. The links for uboot and kernel source code are contained in the "Development Resources" thread:
viewtopic.php?f=194&t=37203

Other than what was already stated about 32bit GCC, I am not aware of any issues preventing use of libgo2 or RetroRun on Ubuntu 19.10.

valadaa48
Posts: 90
Joined: Mon Feb 17, 2020 1:35 pm
languages_spoken: english
ODROIDs: odroid go advance
Has thanked: 3 times
Been thanked: 9 times
Contact:

Re: OGA v1.1 issues (sleep, and gamepad changed?)

Post by valadaa48 » Mon May 25, 2020 3:03 am

Sorry I'm late to the party. I just built my v11 last night. So far I think it's a great improvement over the v1.0 - kudos HK!

After some testing I also ran into the gamepad issue shanti reported. We worked together to find a solution that is also backwards compatible and think we have a reasonable patch: https://github.com/hardkernel/linux/pull/398

The basis here is that since the button layout is different, for all intents and purposes this is a new gamepad and should be identified as such. Looking at the other joypad drivers in the kernel, the general pattern appears to be that they derive the input_dev's name and product by capturing things like button/axis counts. We agreed to merely append " v11" to this new gamepad so as to keep the old name lest we break existing mappings.

@crash you brought up many good points and I hope that you find this patch to satisfy those conditions. Also, the joypad path remains the same which is in line with what the other drivers appear to do.

We tested this patch on v10 and v11 and it appears to accommodate the aforementioned issues. I think shanti has some further data to provide as part of his testing.

Thanks
These users thanked the author valadaa48 for the post:
joy (Mon May 25, 2020 10:42 am)

shanti
Posts: 267
Joined: Fri Feb 15, 2019 3:12 am
languages_spoken: english, spanish
ODROIDs: Odroid N2
Has thanked: 55 times
Been thanked: 96 times
Contact:

Re: OGA v1.1 issues (sleep, and gamepad changed?)

Post by shanti » Mon May 25, 2020 3:15 am

I've tested the patch on both the v1.0 and v1.1, and now it works as intended, it gets detected as a different gamepad, with its own name and guid, and as @valadaa48 mentioned, it still uses the same path, I made this diff to show the differences the patch makes.

https://www.diffchecker.com/H3Ivn4My

IMHO this is very important, the patch is clean, does not break old images or programs that use the path (like libgo2) and now the same image can be compatible with both versions just by adding a separate gamepad config (which is cleaner/better than my previous approach that was creating a script to copy the correct config depending on version) and we don't have to rely on SDL changing how they handle gamepads.

crashoverride
Posts: 4969
Joined: Tue Dec 30, 2014 8:42 pm
languages_spoken: english
ODROIDs: C1
Has thanked: 0
Been thanked: 291 times
Contact:

Re: OGA v1.1 issues (sleep, and gamepad changed?)

Post by crashoverride » Mon May 25, 2020 4:55 am

valadaa48 wrote:
Mon May 25, 2020 3:03 am
I hope that you find this patch to satisfy those conditions. Also, the joypad path remains the same which is in line with what the other drivers appear to do.
I do not have time to test this at the moment. I am in the middle of a development cycle and don't have a spare GO-Advance BE to devote to it. Hopefully, HardKernel can do an internal test and confirm it does not break libgo2 (EmulationStation/RetroRun).

I have two comments regarding the patch:
1) We really should set a vendor ID. The current number (1) is very likely to collide if a customer adds a driver for their GPIO experiments. Since we are introducing a change anyway, we should probably take advantage of this opportunity.
https://github.com/hardkernel/linux/pul ... 4265bbL668

2) The name should be uniform. It ends up being "odroidgo2_joypad v11" (underscore and space). I recommend using "ODROID GO-Advance Joypad" and "ODROID GO-Advance Joypad v1.1". If the name is for human use only, then it should be "friendly".
https://github.com/hardkernel/linux/pul ... 4265bbR667

PaulF8080
Posts: 58
Joined: Fri Feb 14, 2020 9:40 am
languages_spoken: english
ODROIDs: go, go advance, xu4
Has thanked: 0
Been thanked: 5 times
Contact:

Re: OGA v1.1 issues (sleep, and gamepad changed?)

Post by PaulF8080 » Mon May 25, 2020 5:43 am

I had to add my hat to a raspberry pi device-tree along time ago so it's a little fuzzy. If you decompile the DTB the you see the compiler has replaced the names with numbers. If want to add pins without getting all new numbers in the DTB, you make an overlay DTO file to add the pins.

valadaa48
Posts: 90
Joined: Mon Feb 17, 2020 1:35 pm
languages_spoken: english
ODROIDs: odroid go advance
Has thanked: 3 times
Been thanked: 9 times
Contact:

Re: OGA v1.1 issues (sleep, and gamepad changed?)

Post by valadaa48 » Mon May 25, 2020 6:36 am

crashoverride wrote:
Mon May 25, 2020 4:55 am
I do not have time to test this at the moment. I am in the middle of a development cycle and don't have a spare GO-Advance BE to devote to it. Hopefully, HardKernel can do an internal test and confirm it does not break libgo2 (EmulationStation/RetroRun).
I tested it against your latest retrorun, ES and libgo2 and it appears to be working. But I welcome others to test it for further confirmation.
crashoverride wrote:
Mon May 25, 2020 4:55 am
I have two comments regarding the patch:
1) We really should set a vendor ID. The current number (1) is very likely to collide if a customer adds a driver for their GPIO experiments. Since we are introducing a change anyway, we should probably take advantage of this opportunity.
https://github.com/hardkernel/linux/pul ... 4265bbL668
This will break backwards compatibility with some apps that use GUID but I agree it should be/have been set from the start. I'll defer to HK to assign an ID.
crashoverride wrote:
Mon May 25, 2020 4:55 am
2) The name should be uniform. It ends up being "odroidgo2_joypad v11" (underscore and space). I recommend using "ODROID GO-Advance Joypad" and "ODROID GO-Advance Joypad v1.1". If the name is for human use only, then it should be "friendly".
https://github.com/hardkernel/linux/pul ... 4265bbR667
Again this would break backwards compatibility that match against joypad name (not path as mentioned before). If HK wants to change it then I'm OK with it.

PaulF8080
Posts: 58
Joined: Fri Feb 14, 2020 9:40 am
languages_spoken: english
ODROIDs: go, go advance, xu4
Has thanked: 0
Been thanked: 5 times
Contact:

Re: OGA v1.1 issues (sleep, and gamepad changed?)

Post by PaulF8080 » Mon May 25, 2020 6:49 am

I've been thinking. No comments, please. :-) If the pin names are numbers in the DTB that may explain why the SDL map in a long string of numbers and why the buttons shift around when you recompile the DTB.

crashoverride
Posts: 4969
Joined: Tue Dec 30, 2014 8:42 pm
languages_spoken: english
ODROIDs: C1
Has thanked: 0
Been thanked: 291 times
Contact:

Re: OGA v1.1 issues (sleep, and gamepad changed?)

Post by crashoverride » Mon May 25, 2020 7:24 am

valadaa48 wrote:
Mon May 25, 2020 6:36 am
I'll defer to HK to assign an ID.
I also defer to them to assign an ID.
valadaa48 wrote:
Mon May 25, 2020 6:36 am
this would break backwards compatibility that match against joypad name
We are already breaking it with the "v11" addition. Existing images with the previous kernel version will not be affected. Only images that adopt the new kernel will. Anything using SDL + new kernel will already be "broken". I don't see a scenario (let me know if I am mistaken) where this complicates things beyond the already "v11" string change.

I think we should also take a look here:
https://github.com/hardkernel/linux/pul ... 4265bbR666

What happens if a future hardware revision adds another analog stick (a plausible scenario)? The button counting logic is insufficient. Is there enough flexibility for a change of this type in the future? I am not saying it needs a change, just that we need to make sure we don't create a future problem.

shanti
Posts: 267
Joined: Fri Feb 15, 2019 3:12 am
languages_spoken: english, spanish
ODROIDs: Odroid N2
Has thanked: 55 times
Been thanked: 96 times
Contact:

Re: OGA v1.1 issues (sleep, and gamepad changed?)

Post by shanti » Mon May 25, 2020 8:02 am

crashoverride wrote:
Mon May 25, 2020 7:24 am
valadaa48 wrote:
Mon May 25, 2020 6:36 am
I'll defer to HK to assign an ID.
I also defer to them to assign an ID.
valadaa48 wrote:
Mon May 25, 2020 6:36 am
this would break backwards compatibility that match against joypad name
We are already breaking it with the "v11" addition. Existing images with the previous kernel version will not be affected. Only images that adopt the new kernel will. Anything using SDL + new kernel will already be "broken". I don't see a scenario (let me know if I am mistaken) where this complicates things beyond the already "v11" string change.

I think we should also take a look here:
https://github.com/hardkernel/linux/pul ... 4265bbR666

What happens if a future hardware revision adds another analog stick (a plausible scenario)? The button counting logic is insufficient. Is there enough flexibility for a change of this type in the future? I am not saying it needs a change, just that we need to make sure we don't create a future problem.
If I can chime in on this.

With the patch as it currently stands, on v1.0 everything will work the same, with v1.1 it will need to change. but if we change the name on both then both revisions will need to be accommodated, guess its not that hard.

As for future revisions... We also tried passing the changes from the dtb, @valadaa48 made a patch were the name could be changed from the dtb and it worked great, but for some reason changing the id.product was not working, even if we set it up on the dtb it always returned 0x000 and that is why he opted to do it by button count. If we could get that part to work then all of this can be defined on the dtb and I think will be future proof, or... a bit more at least.

crashoverride
Posts: 4969
Joined: Tue Dec 30, 2014 8:42 pm
languages_spoken: english
ODROIDs: C1
Has thanked: 0
Been thanked: 291 times
Contact:

Re: OGA v1.1 issues (sleep, and gamepad changed?)

Post by crashoverride » Mon May 25, 2020 8:33 am

shanti wrote:
Mon May 25, 2020 8:02 am
If we could get that part to work then all of this can be defined on the dtb and I think will be future proof, or... a bit more at least.
I also think the DTB approach is best. It currently defines what buttons and controls the gamepad has, so its best suited for vendor/product/rev info as a change of buttons/controls automatically means a change of product/revision.

The main constraint here is time. I believe there is a desire for "day 1" images. Therefore, it would be beneficial to get this matter sorted sooner, rather than later. If we go with the proposed patch now, we should be able to revert it later and replace it with a DTB approach that is functionally equivalent. The decision is ultimately up to HardKernel, so we will need to wait for their response.

shanti
Posts: 267
Joined: Fri Feb 15, 2019 3:12 am
languages_spoken: english, spanish
ODROIDs: Odroid N2
Has thanked: 55 times
Been thanked: 96 times
Contact:

Re: OGA v1.1 issues (sleep, and gamepad changed?)

Post by shanti » Mon May 25, 2020 9:16 am

I believe the hurdle was here:

dtb:

Code: Select all

joypad-product = <0x0111>;
driver:

Code: Select all

device_property_read_u16(dev, "joypad-product", &id.product);
result was

Code: Select all

id.product 0x000
compiled and worked fine, it was just the value was 0x000 if someone knows how to properly pass that value from the dtb to id.product, then basically the dtb approach could be implemented ASAP.
These users thanked the author shanti for the post:
joy (Mon May 25, 2020 11:07 am)

joy
Posts: 1226
Joined: Fri Oct 02, 2015 1:44 pm
languages_spoken: english
ODROIDs: ODROID-C1+, XU4, X
Has thanked: 106 times
Been thanked: 141 times
Contact:

Re: OGA v1.1 issues (sleep, and gamepad changed?)

Post by joy » Mon May 25, 2020 11:06 am

crashoverride wrote:
Mon May 25, 2020 8:33 am
shanti wrote:
Mon May 25, 2020 8:02 am
If we could get that part to work then all of this can be defined on the dtb and I think will be future proof, or... a bit more at least.
I also think the DTB approach is best. It currently defines what buttons and controls the gamepad has, so its best suited for vendor/product/rev info as a change of buttons/controls automatically means a change of product/revision.

The main constraint here is time. I believe there is a desire for "day 1" images. Therefore, it would be beneficial to get this matter sorted sooner, rather than later. If we go with the proposed patch now, we should be able to revert it later and replace it with a DTB approach that is functionally equivalent. The decision is ultimately up to HardKernel, so we will need to wait for their response.
shanti wrote:
Mon May 25, 2020 9:16 am
I believe the hurdle was here:

dtb:

Code: Select all

joypad-product = <0x0111>;
driver:

Code: Select all

device_property_read_u16(dev, "joypad-product", &id.product);
result was

Code: Select all

id.product 0x000
compiled and worked fine, it was just the value was 0x000 if someone knows how to properly pass that value from the dtb to id.product, then basically the dtb approach could be implemented ASAP.
If this issue can be fixed with different "input->id.product", I also think DTB approach is better one,
because it's more expandable for additional HW revisions.

One more parameter in dtb is needed and joypad driver should be updated as @shanti mentioned.

Let me make a kernel patch and test it based on @valadaa48 and @shanti's approach.

joy
Posts: 1226
Joined: Fri Oct 02, 2015 1:44 pm
languages_spoken: english
ODROIDs: ODROID-C1+, XU4, X
Has thanked: 106 times
Been thanked: 141 times
Contact:

Re: OGA v1.1 issues (sleep, and gamepad changed?)

Post by joy » Mon May 25, 2020 1:16 pm

Hello @shanti and @valadaa48, @crashoverride,
Based on your approach, I made a kernel patch and tested it.

Code: Select all

diff --git a/arch/arm64/boot/dts/rockchip/rk3326-odroidgo2-linux-v11.dts b/arch/arm64/boot/dts/rockchip/rk3326-odroidgo2-linux-v11.dts
index 405043c..76c4616 100644
--- a/arch/arm64/boot/dts/rockchip/rk3326-odroidgo2-linux-v11.dts
+++ b/arch/arm64/boot/dts/rockchip/rk3326-odroidgo2-linux-v11.dts
@@ -22,6 +22,7 @@
 
 	joypad: odroidgo2-joypad {
                 compatible = "odroidgo2-joypad";
+		joypad-revision = <0x0011>;
                 /*
                   - odroidgo2-joypad sysfs list -
 		   * for poll device interval(ms)
diff --git a/arch/arm64/boot/dts/rockchip/rk3326-odroidgo2-linux.dts b/arch/arm64/boot/dts/rockchip/rk3326-odroidgo2-linux.dts
index 687bdf3..9d9ec07 100644
--- a/arch/arm64/boot/dts/rockchip/rk3326-odroidgo2-linux.dts
+++ b/arch/arm64/boot/dts/rockchip/rk3326-odroidgo2-linux.dts
@@ -22,6 +22,7 @@
 
 	joypad: odroidgo2-joypad {
                 compatible = "odroidgo2-joypad";
+		joypad-revision = <0x0010>;
                 /*
                   - odroidgo2-joypad sysfs list -
 		   * for poll device interval(ms)
diff --git a/drivers/input/joystick/odroidgo2-joypad.c b/drivers/input/joystick/odroidgo2-joypad.c
index 208bfb4..a50aca7 100644
--- a/drivers/input/joystick/odroidgo2-joypad.c
+++ b/drivers/input/joystick/odroidgo2-joypad.c
@@ -646,6 +646,7 @@
 	struct input_polled_dev *poll_dev;
 	struct input_dev *input;
 	int nbtn, error;
+	u32 val = 0;
 
 	poll_dev = devm_input_allocate_polled_device(dev);
 	if (!poll_dev) {
@@ -666,7 +667,13 @@
 
 	input->id.bustype = BUS_HOST;
 	input->id.vendor  = 0x0001;
-	input->id.product = 0x0001;
+
+	if (device_property_read_u32(dev, "joypad-revision", &val))
+		input->id.product = 0x0010; /* default rev1.0 */
+	else
+		input->id.product = (u16)val;
+	dev_info(dev,"joypad-revision 0x%x\n", input->id.product);
+
 	input->id.version = 0x0101;
 
 	/* IIO ADC key setup (0 mv ~ 1800 mv) * adc->scale */

Code: Select all

OGA rev 1.0 : id.product 0x0010 (in kernel log : joypad-revision 0x10)
OGA rev 1.1 : id.product 0x0011 (in kernel log : joypad-revision 0x11) 
Other revision : property "joypad-revision" will be changed in its dts.
As I tested, device_property_read_u16 always returns '0' and I'm trying to figure it out.
Anyway, using device_property_read_u32, you will get the expected value from DTB.

Did I understand correctly what you mean?
I'm not sure I perfectly understood the gamepad event handling.
So, I have two questions.
1. id.product value
Is it ok to use the values, "0x0010" for rev1.0 and "0x0011" for rev1.1?

2. id.version
Is it available to use "id.version" instead of "id.product"?

shanti
Posts: 267
Joined: Fri Feb 15, 2019 3:12 am
languages_spoken: english, spanish
ODROIDs: Odroid N2
Has thanked: 55 times
Been thanked: 96 times
Contact:

Re: OGA v1.1 issues (sleep, and gamepad changed?)

Post by shanti » Mon May 25, 2020 1:38 pm

@joy, there 2 things that need to be changed, either id.product or id.version or preferably both (gives the option, for future HW revisions if any), plus the name

so dtb could be like

Code: Select all

joypad-name = "odroidgo2_joypad_v11";
joypad-product = <0x0111>;
joypad-revision = <0x0111>;
and the driver would read them accordingly with your workaround

something like this with whatever ifs are necessary to keep default values I guess? (sorry I am on mobile ATM)

Code: Select all

device_property_read_u32(dev, "joypad-product", &val)
device_property_read_u32(dev, "joypad-revision", &val2)

device_property_read_string(dev, "joypad-name", &input->name);
input->phys = DRV_NAME "/input0";

input->id.product = (u16)val;
input->id.version = (u16)val2;

Post Reply

Return to “Platform development”

Who is online

Users browsing this forum: No registered users and 2 guests