[SOLVED] shutdown button ?

Post Reply
Koejo
Posts: 35
Joined: Thu Jun 29, 2017 7:22 pm
languages_spoken: english
Has thanked: 0
Been thanked: 1 time
Contact:

[SOLVED] shutdown button ?

Post by Koejo »

hallo,
sorry for my bad english. it isn`t my homelanguage

i am looking for an shutdon button. the c2 will mostly run 24/7 but sometime i will restart him.
i Need only the shutdown button

User avatar
odroid
Site Admin
Posts: 38033
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English, Korean
ODROIDs: ODROID
Has thanked: 1999 times
Been thanked: 1206 times
Contact:

Re: shutdown button ?

Post by odroid »


Koejo
Posts: 35
Joined: Thu Jun 29, 2017 7:22 pm
languages_spoken: english
Has thanked: 0
Been thanked: 1 time
Contact:

Re: shutdown button ?

Post by Koejo »

hallo,
thx for Reply.....
i am not sure about that. my questions

Modifying and Flashing Kernel dts

You have to modify the dts file. C2 Linux DTS C2 Android DTS
<kernel_path>/arch/arm64/boot/dts/meson64_odroidc2.dts
...
gpio_keypad{
.
status = "okay";
.
};
..."
what i have to modify ?
i will take the Buttons in the link

"Pin#29 of 40pin expansion connector.
The pin is assigned to GPIOX.BIT0 and its GPIO number is #228."

than
After compile the dts file

first i have to save it as an dts file ?

how i compile the dts file ?

than

Setting boot.ini
You can assign GPIO number with env gpiopower in boot.ini.
# gpio power key : J2 (2x20) Pin#29 , GPIOX.BIT0
setenv gpiopower "228"
...
...
setenv bootargs ${bootargs} gpiopower=${gpiopower}

do i have to copy this in the boot.ini ?

Koejo
Posts: 35
Joined: Thu Jun 29, 2017 7:22 pm
languages_spoken: english
Has thanked: 0
Been thanked: 1 time
Contact:

Re: shutdown button ?

Post by Koejo »

hmm,

niemand eine Idee wie das zu realisieren ist oder hat das schon gemacht ?

hmm, nobody can help ?

joy
Posts: 1584
Joined: Fri Oct 02, 2015 1:44 pm
languages_spoken: english
ODROIDs: .
Has thanked: 179 times
Been thanked: 210 times

Re: shutdown button ?

Post by joy »

Hi, Koejo.

1. dtb
Do you use C2 Ubuntu (Linux)?
If so, you don't need to modify or compile dts file.
It's already applied on the latest Ubuntu release version.
To make sure, you need to confirm that you're using the latest Ubuntu version.

2. Pin HW
And then about the pin assignment for power key,
let's consider you use pin number '29'.
You need to prepare a tab switch that connected to two ports, "POWER KEY" and "Ground".
- "Power Key" : connect to pin '29' of 2x20 pin connector.
- "Ground" " : connect to pin '39' of 2x20 pin connector.

3. boot.ini
You need to add gpiopower options in boot.ini.

Code: Select all

# GPIO Power Key
setenv gpiopower "228"

# gpiopower =${gpiopower}
setenv bootargs "root=UUID=e139ce78-9841-40fe-8823-96a304a09859 rootwait ro ${condev} no_console_suspend gpiopower=${gpiopower} hdmimode=${m} ${cmode} m_bpp=${m_bpp} vout=${vout} fsck.repair=yes net.ifnames=0 elevator=noop disablehpd=${hpd} max_freq=${max_freq} maxcpus=${maxcpus} monitor_onoff=${monitor_onoff} disableuhs=${disableuhs} mmc_removable=${mmc_removable} usbmulticam=${usbmulticam} ${hid_quirks}"
Please find the attachment.
I modified the latest boot.ini file for gpio power key with pin number '29'.
Attachments
boot.ini
(6.69 KiB) Downloaded 272 times

Koejo
Posts: 35
Joined: Thu Jun 29, 2017 7:22 pm
languages_spoken: english
Has thanked: 0
Been thanked: 1 time
Contact:

Re: shutdown button ?

Post by Koejo »

thanks :-)
works perfect :-)

joy
Posts: 1584
Joined: Fri Oct 02, 2015 1:44 pm
languages_spoken: english
ODROIDs: .
Has thanked: 179 times
Been thanked: 210 times

Re: [SOLVED] shutdown button ?

Post by joy »

Oh~ Good to know that! :D

Koejo
Posts: 35
Joined: Thu Jun 29, 2017 7:22 pm
languages_spoken: english
Has thanked: 0
Been thanked: 1 time
Contact:

Re: [SOLVED] shutdown button ?

Post by Koejo »

hmm, since the update to ubuntu 18 it doesnt work.

is there a solution ?

Koejo
Posts: 35
Joined: Thu Jun 29, 2017 7:22 pm
languages_spoken: english
Has thanked: 0
Been thanked: 1 time
Contact:

Re: [SOLVED] shutdown button ?

Post by Koejo »

hmm, nobody this Problem that this doesnt work ?

User avatar
odroid
Site Admin
Posts: 38033
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English, Korean
ODROIDs: ODROID
Has thanked: 1999 times
Been thanked: 1206 times
Contact:

Re: [SOLVED] shutdown button ?

Post by odroid »

We will check the functionality on Ubuntu 18.04 in the next week.
I think the updated Kernel 3.16 might miss a tweak.

joy
Posts: 1584
Joined: Fri Oct 02, 2015 1:44 pm
languages_spoken: english
ODROIDs: .
Has thanked: 179 times
Been thanked: 210 times

Re: [SOLVED] shutdown button ?

Post by joy »

Hello, Koejo.

I've checked GPIO shutdown functionality on C2 Ubuntu 18.04
and confirmed it works as it does with Ubuntu 16.04.

Could you check the followings if you still the problem that it doesn't work?

1. version
To make sure, let's synchronize the uname version.

Code: Select all

root@odroid:~# uname -a
Linux odroid 3.16.57-24 #1 SMP PREEMPT Mon Jul 2 18:10:24 -03 2018 aarch64 aarch64 aarch64 GNU/Linux
2. boot.ini
From the pure base version of Ubuntu 18.04, I've modified some parts of boot.ini.
https://wiki.odroid.com/odroid-c2/appli ... 1_-_ubuntu
For example, I'm using PIN#29 for POWERKEY (gpio no. 228) and PIN#30 for GND.

Code: Select all

### add an env of gpio power key
setenv gpiopower "228"

### modify bootargs
### add "gpiopower=${gpiopower}" in bootargs
setenv bootargs "root=UUID=e139ce78-9841-40fe-8823-96a304a09859 rootwait ro ${condev} no_console_suspend hdmimode=${m} ${cmode} _bpp=${m_bpp} vout=${vout} fsck.repair=yes net.ifnames=0 elevator=noop disablehpd=${hpd} max_freq=${max_freq} maxcpus=${maxcpus} monitor_onoff=${monitor_onoff} disableuhs=${disableuhs} mmc_removable=${mmc_removable} usbmulticam=${usbmulticam} ${hid_quirks} gpiopower=${gpiopower}"
Then, do system reboot.

3. check gpio_keypad driver loading
After system reboot, I get this message from dmesg.

Code: Select all

root@odroid:~# dmesg | grep gpio_keypad
[    4.105626] gpio-key c8100000.gpio_keypad: gpio_key: 0 power(228)
[    4.105675] gpio-key c8100000.gpio_keypad: start setup_timer
[    4.105681] gpio-key c8100000.gpio_keypad: power key(116) registed.
[    4.105796] input: gpio_keypad as /devices/c8100000.gpio_keypad/input/input2
[    4.105884] gpio-key c8100000.gpio_keypad: gpio keypad register input device completed.
4. check key event
Also I can get normal key events of the registered power key.

Code: Select all

root@odroid:~# tail -f /var/log/syslog
.....
.....
Jul 30 03:10:38 odroid kernel: [  681.041797] input input2: key 116 down
Jul 30 03:10:39 odroid kernel: [  681.191794] input input2: key 116 up
Jul 30 03:10:39 odroid kernel: [  682.031770] input input2: key 116 down
Jul 30 03:10:40 odroid kernel: [  682.181762] input input2: key 116 up
Jul 30 03:10:40 odroid kernel: [  682.691750] input input2: key 116 down
Jul 30 03:10:40 odroid kernel: [  682.871744] input input2: key 116 up

Do you get the same result with me from 1 to 4 steps?
If not so, please share (1) which PIN port you use (2) your version (3) your boot.ini.


(updated)
5. system power off
And you need to set up some power button action for Ubuntu system.
https://wiki.odroid.com/odroid-c2/appli ... _power_off

Koejo
Posts: 35
Joined: Thu Jun 29, 2017 7:22 pm
languages_spoken: english
Has thanked: 0
Been thanked: 1 time
Contact:

Re: [SOLVED] shutdown button ?

Post by Koejo »

thx work now perfect.

thank you

joy
Posts: 1584
Joined: Fri Oct 02, 2015 1:44 pm
languages_spoken: english
ODROIDs: .
Has thanked: 179 times
Been thanked: 210 times

Re: [SOLVED] shutdown button ?

Post by joy »

@Koejo,
Thank you for your feedback.
Glad to hear that! :)

mranderson
Posts: 11
Joined: Fri Jul 08, 2016 6:28 am
languages_spoken: english
ODROIDs: c2
Has thanked: 0
Been thanked: 0
Contact:

Re: [SOLVED] shutdown button ?

Post by mranderson »

how can I modify this file <kernel_path>/arch/arm64/boot/dts/meson64_odroidc2.dts
on odroid c2 using android? I can't find it anywhere?

User avatar
odroid
Site Admin
Posts: 38033
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English, Korean
ODROIDs: ODROID
Has thanked: 1999 times
Been thanked: 1206 times
Contact:

Re: [SOLVED] shutdown button ?

Post by odroid »

You have to edit/compile the DTS file on a (virtual) Linux PC.
https://wiki.odroid.com/odroid-c2/appli ... _-_android

joy
Posts: 1584
Joined: Fri Oct 02, 2015 1:44 pm
languages_spoken: english
ODROIDs: .
Has thanked: 179 times
Been thanked: 210 times

Re: [SOLVED] shutdown button ?

Post by joy »

odroid wrote:
Wed Feb 06, 2019 9:54 am
You have to edit/compile the DTS file on a (virtual) Linux PC.
https://wiki.odroid.com/odroid-c2/appli ... _-_android
And please refer to this line.
https://github.com/hardkernel/linux/blo ... 2.dts#L830

Post Reply

Return to “Ubuntu”

Who is online

Users browsing this forum: No registered users and 3 guests