Re: [systemd-devel] [PATCH 2/2] logind: add support for gpio-keys Power Button

2014-09-27 Thread Zbigniew Jędrzejewski-Szmek
Hi,

I'll merge 1/2 for now. As for 2/2, let's see what others say.

Zbyszek


On Sat, Sep 27, 2014 at 09:55:45AM +0200, Koen Kooi wrote:
> This might be too broad since it will listen on *all* gpio-keys based
> input devices for a power button press, but such is life.
> 
> root@arietta-g25:~# udevadm info -a /dev/input/event0
> 
> Udevadm info starts with the device specified by the devpath and then
> walks up the chain of parent devices. It prints for every device
> found, all possible attributes in the udev rules key format.
> A rule to match, can be composed by the attributes of the device
> and the attributes from one single parent device.
> 
>   looking at device '/devices/keys/input/input0/event0':
> KERNEL=="event0"
> SUBSYSTEM=="input"
> DRIVER==""
> 
>   looking at parent device '/devices/keys/input/input0':
> KERNELS=="input0"
> SUBSYSTEMS=="input"
> DRIVERS==""
> ATTRS{name}=="keys"
> ATTRS{phys}=="gpio-keys/input0"
> ATTRS{uniq}==""
> ATTRS{properties}=="0"
> 
>   looking at parent device '/devices/keys':
> KERNELS=="keys"
> SUBSYSTEMS=="platform"
> DRIVERS=="gpio-keys"
> ATTRS{keys}=="116"
> ATTRS{switches}==""
> ATTRS{driver_override}=="(null)"
> ATTRS{disabled_keys}==""
> ATTRS{disabled_switches}==""
> ---
>  src/login/70-power-switch.rules | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/src/login/70-power-switch.rules b/src/login/70-power-switch.rules
> index 695d246..7bbe096 100644
> --- a/src/login/70-power-switch.rules
> +++ b/src/login/70-power-switch.rules
> @@ -11,5 +11,6 @@ SUBSYSTEM=="input", KERNEL=="event*", SUBSYSTEMS=="acpi", 
> TAG+="power-switch"
>  SUBSYSTEM=="input", KERNEL=="event*", KERNELS=="thinkpad_acpi", 
> TAG+="power-switch"
>  SUBSYSTEM=="input", KERNEL=="event*", ATTRS{name}=="twl4030_pwrbutton", 
> TAG+="power-switch"
>  SUBSYSTEM=="input", KERNEL=="event*", ATTRS{name}=="tps65217_pwr_but", 
> TAG+="power-switch"
> +SUBSYSTEM=="input", KERNEL=="event*", ATTRS{name}=="keys", 
> TAG+="power-switch"
>  
>  LABEL="power_switch_end"
> -- 
> 1.9.0
> 
> ___
> systemd-devel mailing list
> systemd-devel@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/systemd-devel
> 
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] [PATCH] shell-completion(zsh): journalctl's -b changes

2014-09-27 Thread Daniel Mack
On 09/27/2014 02:48 PM, Eric Cook wrote:
> removed pointless index sort of bootids.
> use `compadd -a' to add each array, instead of expanding possibly hundreds of 
> words needlessly.
> optional completion of -b

Applied, thanks.


> 
> ---
>  shell-completion/zsh/_journalctl | 8 
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/shell-completion/zsh/_journalctl 
> b/shell-completion/zsh/_journalctl
> index 0d16a26..a469bbc 100644
> --- a/shell-completion/zsh/_journalctl
> +++ b/shell-completion/zsh/_journalctl
> @@ -41,11 +41,11 @@ _journal_fields() {
>  
>  _journal_boots() {
>local -a _bootid _previousboots
> -  _bootid=( ${(fao)"$(_call_program bootid "$service -F _BOOT_ID")"}  )
> +  _bootid=( ${(f)"$(_call_program bootid "$service -F _BOOT_ID")"}  )
>_previousboots=( -{1..${#_bootid}} )
>_alternative : \
> -"offsets:boot offsets:(${_previousboots[1,-2]})" \
> -"bootid:boot ids:(${_bootid[@]})"
> +"offsets:boot offsets:compadd -a '_previousboots[1,-2]'" \
> +"bootid:boot ids:compadd -a _bootid"
>  }
>  
>  _arguments -s \
> @@ -63,7 +63,7 @@ _arguments -s \
>  {-x,--catalog}'[Show explanatory texts with each log line]' \
>  {-q,--quiet}"[Don't show privilege warning]" \
>  {-m,--merge}'[Show entries from all available journals]' \
> -{-b+,--boot=}'[Show data only from the specified boot or offset]:boot id 
> or offset:_journal_boots' \
> +{-b+,--boot=}'[Show data only from the specified boot or offset]::boot 
> id or offset:_journal_boots' \
>  '--list-boots[List boots ordered by time]' \
>  {-k,--dmesg}'[Show only kernel messages from the current boot]' \
>  {-u+,--unit=}'[Show data only from the specified 
> unit]:units:_journal_fields _SYSTEMD_UNIT' \
> 

___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] [PATCH] fstab-generator: Honor usr=, usrfstype= and usrflags=

2014-09-27 Thread Tobias Hunger
Ping?

This is really useful to test out the changes proposed in
http://0pointer.net/blog/revisiting-how-we-put-together-linux-systems.html

Yes, Lennart seems to want to move to something more strict that can
also work with the uefi secure boot, but this helps me get a test
system of the ground where the / und /usr mounts are defined in the
bootloader entries. Even works with encrypted partitions here;-)

Best Regards,
Tobias
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


[systemd-devel] [PATCH] shell-completion(zsh): journalctl's -b changes

2014-09-27 Thread Eric Cook
removed pointless index sort of bootids.
use `compadd -a' to add each array, instead of expanding possibly hundreds of 
words needlessly.
optional completion of -b

---
 shell-completion/zsh/_journalctl | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/shell-completion/zsh/_journalctl b/shell-completion/zsh/_journalctl
index 0d16a26..a469bbc 100644
--- a/shell-completion/zsh/_journalctl
+++ b/shell-completion/zsh/_journalctl
@@ -41,11 +41,11 @@ _journal_fields() {
 
 _journal_boots() {
   local -a _bootid _previousboots
-  _bootid=( ${(fao)"$(_call_program bootid "$service -F _BOOT_ID")"}  )
+  _bootid=( ${(f)"$(_call_program bootid "$service -F _BOOT_ID")"}  )
   _previousboots=( -{1..${#_bootid}} )
   _alternative : \
-"offsets:boot offsets:(${_previousboots[1,-2]})" \
-"bootid:boot ids:(${_bootid[@]})"
+"offsets:boot offsets:compadd -a '_previousboots[1,-2]'" \
+"bootid:boot ids:compadd -a _bootid"
 }
 
 _arguments -s \
@@ -63,7 +63,7 @@ _arguments -s \
 {-x,--catalog}'[Show explanatory texts with each log line]' \
 {-q,--quiet}"[Don't show privilege warning]" \
 {-m,--merge}'[Show entries from all available journals]' \
-{-b+,--boot=}'[Show data only from the specified boot or offset]:boot id 
or offset:_journal_boots' \
+{-b+,--boot=}'[Show data only from the specified boot or offset]::boot id 
or offset:_journal_boots' \
 '--list-boots[List boots ordered by time]' \
 {-k,--dmesg}'[Show only kernel messages from the current boot]' \
 {-u+,--unit=}'[Show data only from the specified 
unit]:units:_journal_fields _SYSTEMD_UNIT' \
-- 
2.1.1

___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] Systemd-nspawn -- Canot add interface to container

2014-09-27 Thread James Lott
Figured out that 'ip link set  netns ' works much the same as 'iw 
phy  set netns ', but I still can't seem to figure out what types 
of interfaces --network-interface will accept. If anyone happens to have a good 
example of how to use it, I would love to take a look at it.

> On Sep 26, 2014, at 4:28 PM, James Lott  wrote:
> 
> Hello again!
> 
> Once again, thanks for all the help with getting my wireless interface moved 
> into the container! Now I just have one more interface I'm having trouble 
> with. I can't seem to move my ethernet interfaces into the container. I'm 
> getting the same error, so I presume it's for the same reason. I can find the 
> path to my physical devices in kernel space (they're both on a USB bus), but 
> I 
> can't figure out what device name I should pass to systemd-nspawn (or what 
> other userspace program I could use to move one of the interfaces into a 
> container's namespace). Thanks in advance for any pointers!
> 
> [root@host01 lanvpn]# systemd-nspawn --network-interface=eth1   
> Spawning container lanvpn on /home/lanvpn.
> Press ^] three times within 1s to kill container.
> Failed to move interface eth1 to namespace: File exists
> [root@host01 lanvpn]# ls -lah /sys/class/net/ | egrep 'eth[0-1] ' 
>   
>  
> lrwxrwxrwx  1 root root 0 Dec 31  1969 eth0 -> 
> ../../devices/platform/bcm2708_usb/usb1/1-1/1-1.1/1-1.1:1.0/net/eth0
> lrwxrwxrwx  1 root root 0 Dec 31  1969 eth1 -> 
> ../../devices/platform/bcm2708_usb/usb1/1-1/1-1.3/1-1.3.1/1-1.3.1:1.0/net/eth1
> 
>> On Thursday 25 September 2014 17:05:34 James Lott wrote:
>> Shame on me for not spending more time trying to figure this out before
>> responding. Please ignore my previous sad plea for help, I understand fully
>> now exactly what you're saying, and was able to successfully move the phy0
>> interface into my container.
>> 
>> At this point, my challenge is going to be coordinating the movement of this
>> interface within a service file, so I don't need to do it manually when
>> starting the container... but I suppose I can write an ExecStartPost script
>> which can manage this.
>> 
>> Thanks again for all your help!
>> 
>>> On Thursday 25 September 2014 16:25:02 James Lott wrote:
>>> Hi Zbyszek,
>>> 
>>> Thanks for all your help! This is a new concept to me though, as I have
>>> never tried to refer to a process inside of a container from outside of
>>> the
>>> container before (I did not realize this was possible). Since specifying
>>> PID 1 would obviously be referring to the host system's init process,
>>> would
>>> you be willing to give me an example that might help me understand how I
>>> can specify an in-container PID from the host system? Thanks again for
>>> taking the time to help me grasp all of this :)
>>> 
 On Sep 25, 2014, at 2:10 PM, Zbigniew Jędrzejewski-Szmek
>> 
>>  wrote:
> On Thu, Sep 25, 2014 at 10:40:42AM -0700, James Lott wrote:
> Hi Mantas,
> 
> Thanks for the clarification. The first thing I tried actually was
> using
> the PID of the systemd-nspawn instance, like so
> 
> [root@host01 lanvpn]# ps aux | grep -v grep | grep systemd-nspawn
> root   143  0.0  0.3   2884   728 ?Ss   08:42   0:00
> /usr/bin/systemd-nspawn --network-bridge=switch1 -bD /home/proxy -M 0
> root  4564  0.7  0.6   2884  1124 pts/3S+   10:38   0:00
> systemd-
> nspawn --private-network
> [root@host01 lanvpn]# iw phy phy0 set netns 4564
 
 systemd-nspawn is *outside* of the container. You should use the child
 of
 systemd-nspawn, i.e. the init process, instead.
 
 Zbyszek
>>> 
>>> ___
>>> systemd-devel mailing list
>>> systemd-devel@lists.freedesktop.org
>>> http://lists.freedesktop.org/mailman/listinfo/systemd-devel
>> 
>> ___
>> systemd-devel mailing list
>> systemd-devel@lists.freedesktop.org
>> http://lists.freedesktop.org/mailman/listinfo/systemd-devel
> 
> ___
> systemd-devel mailing list
> systemd-devel@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/systemd-devel
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] Having systemd shutdown when pressing the power button

2014-09-27 Thread Koen Kooi

Op 28 aug. 2014, om 15:42 heeft Lennart Poettering  het 
volgende geschreven:

> On Thu, 28.08.14 10:50, Koen Kooi (k...@dominion.thruhere.net) wrote:
> 
>> Hi,
> 
> Heya,
> 
>> I am working on a system (http://www.acmesystems.it/arietta) where I
>> hooked up the button as a power key:
>> 
>>  
>> https://github.com/koenkooi/linux/commit/c823e0b046efcfff61e21fa4c89d5d68090ef6de
>> 
>> Evtest shows it doing the right thing (issuing KEY_POWER) when being
>> pressed, but systemd seems to totally ignore it. I've seen this
>> behaviour in the past and noticed the DE (GNOME2, old but it works)
>> would pick it up and present the dialog. Since this is a headless
>> system I want systemd to handle it instead of the DE (which isn't
>> installed).  Every doc or blog post I read says that systemd should
>> already be handling it, but it isn't in my case. I suspect that
>> systemd only handles ACPI powerkey events, but I haven't actually
>> looked at the code.
>> 
>> Are more people experiencing this and does someone have a workaround
>> or fix?
> 
> You have to tag your input devices with the "power-switch" udev tag,
> otherwise logind won't pick up the device.
> 
> See 70-power-switch.rules for the current default:
> 
>SUBSYSTEM=="input", KERNEL=="event*", SUBSYSTEMS=="acpi", 
> TAG+="power-switch"
>SUBSYSTEM=="input", KERNEL=="event*", KERNELS=="thinkpad_acpi", 
> TAG+="power-switch"

Thanks, I've sent 2 patches to add rules for more power buttons, but...

> 
> I'd really like to open this up, to be done on all kbds by default, but
> I feel uneasy about listening to all keypresses on all keyboards by
> default We don't want that logind is woken up on virtually *all*
> keypresses on the entire system, all the time.

... patch 2/2 opens up gpio-keys for this. All the boards I have in my office 
use gpio-keys for things like up/down, volume or other 'control' type of 
things. Matrix setups use a different driver, so I don't expect this to catch 
proper keyboards. Having said that, I can understand if you reject 2/2.

regards,

Koen

> 
> David Hermann did a kernel patch to improve the situation:
> 
> https://www.mail-archive.com/linux-input@vger.kernel.org/msg11143.html
> 
> With this in place, userspace can set a mask of input keys it is
> interested in, and we could use that for logind to just subscribe to
> power keypresses and be happy...
> 
> Unfortunately though the patch got repeatedly ignored by the input
> maintainers, even though it got resent multiple times... :-(
> 
> Lennart
> 
> -- 
> Lennart Poettering, Red Hat

___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


[systemd-devel] [PATCH 1/2] logind: add support for TPS65217 Power Button

2014-09-27 Thread Koen Kooi
This PMIC is found on TI AM335x based boards like the beaglebone and
beaglebone black.

root@beaglebone-white:~# udevadm info -a /dev/input/event0

Udevadm info starts with the device specified by the devpath and then
walks up the chain of parent devices. It prints for every device
found, all possible attributes in the udev rules key format.
A rule to match, can be composed by the attributes of the device
and the attributes from one single parent device.

  looking at device
'/devices/ocp.3/44e0b000.i2c/i2c-0/0-0024/input/input0/event0':
KERNEL=="event0"
SUBSYSTEM=="input"
DRIVER==""

  looking at parent device
'/devices/ocp.3/44e0b000.i2c/i2c-0/0-0024/input/input0':
KERNELS=="input0"
SUBSYSTEMS=="input"
DRIVERS==""
ATTRS{name}=="tps65217_pwr_but"
ATTRS{phys}==""
ATTRS{uniq}==""
ATTRS{properties}=="0"

  looking at parent device '/devices/ocp.3/44e0b000.i2c/i2c-0/0-0024':
KERNELS=="0-0024"
SUBSYSTEMS=="i2c"
DRIVERS=="tps65217"
ATTRS{name}=="tps65217"

  looking at parent device '/devices/ocp.3/44e0b000.i2c/i2c-0':
KERNELS=="i2c-0"
SUBSYSTEMS=="i2c"
DRIVERS==""
ATTRS{name}=="OMAP I2C adapter"

  looking at parent device '/devices/ocp.3/44e0b000.i2c':
KERNELS=="44e0b000.i2c"
SUBSYSTEMS=="platform"
DRIVERS=="omap_i2c"

  looking at parent device '/devices/ocp.3':
KERNELS=="ocp.3"
SUBSYSTEMS=="platform"
DRIVERS==""
---
 src/login/70-power-switch.rules | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/login/70-power-switch.rules b/src/login/70-power-switch.rules
index a6997f7..695d246 100644
--- a/src/login/70-power-switch.rules
+++ b/src/login/70-power-switch.rules
@@ -10,5 +10,6 @@ ACTION=="remove", GOTO="power_switch_end"
 SUBSYSTEM=="input", KERNEL=="event*", SUBSYSTEMS=="acpi", TAG+="power-switch"
 SUBSYSTEM=="input", KERNEL=="event*", KERNELS=="thinkpad_acpi", 
TAG+="power-switch"
 SUBSYSTEM=="input", KERNEL=="event*", ATTRS{name}=="twl4030_pwrbutton", 
TAG+="power-switch"
+SUBSYSTEM=="input", KERNEL=="event*", ATTRS{name}=="tps65217_pwr_but", 
TAG+="power-switch"
 
 LABEL="power_switch_end"
-- 
1.9.0

___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


[systemd-devel] [PATCH 2/2] logind: add support for gpio-keys Power Button

2014-09-27 Thread Koen Kooi
This might be too broad since it will listen on *all* gpio-keys based
input devices for a power button press, but such is life.

root@arietta-g25:~# udevadm info -a /dev/input/event0

Udevadm info starts with the device specified by the devpath and then
walks up the chain of parent devices. It prints for every device
found, all possible attributes in the udev rules key format.
A rule to match, can be composed by the attributes of the device
and the attributes from one single parent device.

  looking at device '/devices/keys/input/input0/event0':
KERNEL=="event0"
SUBSYSTEM=="input"
DRIVER==""

  looking at parent device '/devices/keys/input/input0':
KERNELS=="input0"
SUBSYSTEMS=="input"
DRIVERS==""
ATTRS{name}=="keys"
ATTRS{phys}=="gpio-keys/input0"
ATTRS{uniq}==""
ATTRS{properties}=="0"

  looking at parent device '/devices/keys':
KERNELS=="keys"
SUBSYSTEMS=="platform"
DRIVERS=="gpio-keys"
ATTRS{keys}=="116"
ATTRS{switches}==""
ATTRS{driver_override}=="(null)"
ATTRS{disabled_keys}==""
ATTRS{disabled_switches}==""
---
 src/login/70-power-switch.rules | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/login/70-power-switch.rules b/src/login/70-power-switch.rules
index 695d246..7bbe096 100644
--- a/src/login/70-power-switch.rules
+++ b/src/login/70-power-switch.rules
@@ -11,5 +11,6 @@ SUBSYSTEM=="input", KERNEL=="event*", SUBSYSTEMS=="acpi", 
TAG+="power-switch"
 SUBSYSTEM=="input", KERNEL=="event*", KERNELS=="thinkpad_acpi", 
TAG+="power-switch"
 SUBSYSTEM=="input", KERNEL=="event*", ATTRS{name}=="twl4030_pwrbutton", 
TAG+="power-switch"
 SUBSYSTEM=="input", KERNEL=="event*", ATTRS{name}=="tps65217_pwr_but", 
TAG+="power-switch"
+SUBSYSTEM=="input", KERNEL=="event*", ATTRS{name}=="keys", TAG+="power-switch"
 
 LABEL="power_switch_end"
-- 
1.9.0

___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel