lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <8b6adbc45d134da7b0fd1f9044a37cf6@asem.it>
Date:   Fri, 2 Oct 2020 10:26:11 +0000
From:   Flavio Suligoi <f.suligoi@...m.it>
To:     Andy Shevchenko <andy.shevchenko@...il.com>
CC:     Bartosz Golaszewski <brgl@...ev.pl>,
        "linux-gpio@...r.kernel.org" <linux-gpio@...r.kernel.org>,
        "linux-acpi@...r.kernel.org" <linux-acpi@...r.kernel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: RE: How to use an ACPI declared GPIO in a userspace ...

Hi Andy,

with my custom SSDT table:

DefinitionBlock ("gpio_button.aml", "SSDT", 5, "ASEMsp", "GPIO_BTN", 1)
{
	External (_SB_.GPO1, DeviceObj)
	Scope (\_SB.GPO1)
	{
		Device (BTNS)
		{
			Name (_HID, "ASEM0005")		// _HID: Hardware ID PRP0001
			Name (_UID, Zero)             // _UID: Unique ID
			Name (_DDN, "DDN - SW Readable Button")  // _DDN: DOS Device Name
			Name (_STR, Unicode ("STR - SW Readable Button"))  // _STR: Description String

			Name (_CRS, ResourceTemplate ()	 // _CRS: Current Resource Settings
			{
				GpioIo (
					Shared,                  // Not shared
					PullNone,                // No need for pulls
					0,                       // Debounce timeout
					0,                       // Drive strength
					IoRestrictionInputOnly,  // Only used as input
					"\\_SB.GPO1",            // GPIO controller
					0, ResourceConsumer, , ) // Must be 0
					{
						25,                // GPIO number 25
					}
			})
		}
	}
}

I'm able to see the GPIO in:

/sys/bus/platform/devices/ASEM0005:00/firmware_node:

-r--r--r--    1 root     root          4096 Oct  2 12:10 description
-r--r--r--    1 root     root          4096 Oct  2 12:10 hid
-r--r--r--    1 root     root          4096 Oct  2 12:10 modalias
-r--r--r--    1 root     root          4096 Oct  2 12:10 path
lrwxrwxrwx    1 root     root             0 Oct  2 12:10 physical_node -> ../../../../platform/INT3452:01/ASEM0005:00
drwxr-xr-x    2 root     root             0 Oct  2 12:10 power
lrwxrwxrwx    1 root     root             0 Oct  2 12:10 subsystem -> ../../../../../bus/acpi
-rw-r--r--    1 root     root          4096 Oct  2 12:10 uevent
-r--r--r--    1 root     root          4096 Oct  2 12:10 uid

and so I can see some useful info:

# cat description
STR - SW Readable Button
# cat hid
ASEM0005
# cat modalias
acpi:ASEM0005:
bmxxxx-x86-64:/sys/bus/platform/devices/ASEM0005:00/firmware_node# cat path
\_SB_.GPO1.BTNS

So, from userspace, I can discover the GPIO controller /dev/gpiochip1,
but I don't know how to discover the GPIO number (25 in this case).
Do you have any suggestion about how to discover this GPIO number?

Thanks!

> --
> With Best Regards,
> Andy Shevchenko

Best regards,
Flavio

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ