Getting LibreELEC to work with UPS3

Moderators: odroid, mdrjr

Getting LibreELEC to work with UPS3

Unread postby zang74 » Sat Dec 16, 2017 5:43 am

So, I've got a UPS3 attached to my Odroid C2 running LibreELEC. I installed the shutdown script, but it doesn't appear to be working. It doesn't shut down if power is pulled, and I get following if I run the script manually:

Code: Select all
/storage/scripts/ups.sh
sh: write error: Invalid argument
Power is shutdown or AC Adaptor is disconnected
/storage/scripts/ups.sh: line 62: can't create /sys/class/gpio/gpio239/direction: nonexistent directory
cat: can't open '/sys/class/gpio/gpio239/value': No such file or directory

sh: 0: unknown operand
battery is good


Here's what's showing in /sys/class/gpio:

Code: Select all
/sys/class/gpio # ls
export       gpio225      gpio247      gpiochip122  gpiochip136  unexport
zang74
 
Posts: 11
Joined: Mon Oct 24, 2016 12:35 am
languages_spoken: english
ODROIDs: Odroid C2

Re: Getting LibreELEC to work with UPS3

Unread postby odroid » Sat Dec 16, 2017 4:20 pm

Try to export GPIO 239 on the command line first.
User avatar
odroid
Site Admin
 
Posts: 29053
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English
ODROIDs: ODROID

Re: Getting LibreELEC to work with UPS3

Unread postby zang74 » Sun Dec 17, 2017 12:41 pm

Code: Select all
echo 239 > /sys/class/gpio/export
gets me:
Code: Select all
-sh: write error: Invalid argument
zang74
 
Posts: 11
Joined: Mon Oct 24, 2016 12:35 am
languages_spoken: english
ODROIDs: Odroid C2

Re: Getting LibreELEC to work with UPS3

Unread postby odroid » Mon Dec 18, 2017 10:36 am

I think another device driver might use GPIO#239 already.
Check "lsmod" output.
User avatar
odroid
Site Admin
 
Posts: 29053
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English
ODROIDs: ODROID

Re: Getting LibreELEC to work with UPS3

Unread postby zang74 » Tue Dec 19, 2017 9:04 am

Not sure what would bother the GPIO; there are no other hats attached, and an RF keyboard and USB key are the only peripherals.
Code: Select all
/sys/class/gpio # lsmod
Module                  Size  Used by
8021q                  19103  0
rtc_pcf8563             3551  0
ir_lirc_codec           4420  0
lirc_dev                8560  1 ir_lirc_codec
ir_mce_kbd_decoder      3076  0
ir_sanyo_decoder        1571  0
ir_sony_decoder         1601  0
ir_jvc_decoder          1591  0
ir_rc6_decoder          1959  0
ir_rc5_decoder          1527  0
ir_nec_decoder          1671  0
rc_odroid                894  0
meson_ir                3793  0
rc_core                13500  12 lirc_dev,meson_ir,ir_lirc_codec,ir_rc5_decoder,ir_nec_decoder,ir_sony_decoder,rc_odroid,ir_mce_kbd_decoder,ir_jvc_decoder,ir_rc6_decoder,ir_sanyo_decoder
mali                  199584  5
amlvideodri            11018  0
videobuf_res            5474  1 amlvideodri
videobuf_core          16589  2 amlvideodri,videobuf_res
videodev              131672  1 amlvideodri
autofs4                24843  0
fbcon                  37599  0
bitblit                 4444  1 fbcon
softcursor              1176  1 bitblit
font                    7279  1 fbcon
zang74
 
Posts: 11
Joined: Mon Oct 24, 2016 12:35 am
languages_spoken: english
ODROIDs: Odroid C2

Re: Getting LibreELEC to work with UPS3

Unread postby odroid » Tue Dec 19, 2017 11:06 am

There is nothing strange in your lsmod output.
Some GPIO configuration could be different in LibreELEC kernel source.

I've just tested GPIO#239 on Ubuntu image and there is no issue.
Code: Select all
root@odroid64:/home/odroid# echo 239 > /sys/class/gpio/export                   
root@odroid64:/home/odroid# ls /sys/class/gpio/                                 
export  gpio239  gpiochip122  gpiochip136  unexport
User avatar
odroid
Site Admin
 
Posts: 29053
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English
ODROIDs: ODROID


Return to UPS

Who is online

Users browsing this forum: No registered users and 1 guest