Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
smdev ebuilds and guide for switching from udev
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks
View previous topic :: View next topic  
Author Message
defer-
Tux's lil' helper
Tux's lil' helper


Joined: 11 Jun 2007
Posts: 132
Location: Finland

PostPosted: Mon Aug 11, 2014 3:22 pm    Post subject: smdev ebuilds and guide for switching from udev Reply with quote

smdev
smdev[0] is new device manager for linux. I maintain ebuilds[1] for smdev in my overlay[2]. The ebuilds contains initscript for gentoo and supports savedconfig. It should be quite straightforward to switch from udev.

I have working sound, wlan, touchpad, trackpoint, keyboard and opengl with default smdev config.

[0] http://git.suckless.org/smdev/
[1] https://github.com/defer-/deferlay/tree/master/sys-fs/smdev
[2] https://github.com/defer-/deferlay/


Migrate from udev

Make sure you use openrc
You should be using sys-apps/openrc, not sys-apps/systemd for service management. openrc is the default for new gentoo installations.

Disable udev dependent features
evdev depends to udev so you should use mouse and keyboard/kbd drivers instead.

Disable udev USE flag and evdev x.org driver.
/etc/portage/make.conf
Code:
USE="-udev"
INPUT_DEVICES="synaptics keyboard mouse"


Rebuild world.
Code:
emerge -uavDN @world


Configure x.org to use mouse and keyboard/kbd drivers instead of evdev
You have to change configs to use mouse/kbd instead of evdev and "InputDevice" instead of "InputClass".

Example x.org configs for smdev.
/etc/X11/xorg.conf.d/10-keyboard.conf
Code:
Section "InputDevice"
        identifier      "keyboard0"
        driver          "kbd"
        option          "AutoServerLayout" "on"
        option          "XkbRules" "xorg"
        option          "XkbModel" "pc105"
        option          "XkbLayout" "fi"
EndSection


/etc/X11/xorg.conf.d/20-synaptics.conf
Code:
Section "InputDevice"
        identifier      "touchpad0"
        driver          "synaptics"
        option          "AutoServerLayout" "on"

        # custom options
        Option "HorizTwoFingerScroll" "1"
        Option "HorizHysteresis" "50"
        Option "VertHysteresis" "50"
EndSection


/etc/X11/xorg.conf.d/30-mouse.conf
Code:
Section "InputDevice"
        identifier      "Mouse0"
        driver          "mouse"
        option          "AutoServerLayout"      "on"

        option  "device"        "/dev/input/mice"

        # To config fancy stuff like disable acceleration,
        # put into your .xinitrc something like 'xset m 1 1 &'
EndSection


add users to tty group
Code:
gpasswd -a <USER> tty


add smdev to sysinit runlevel
Code:
rc-update del udev sysinit
rc-update del udev-mount sysinit
rc-update add smdev sysinit


reboot
Now you are ready to reboot. After checking everything is working you can unmerge udev if you want. :-)


Acknowledgements
I got much help for configuring x.org from slashbeast's repository[0].

[0] https://github.com/slashbeast/mdev-like-a-boss
_________________
https://github.com/defer-
Back to top
View user's profile Send private message
krinn
Advocate
Advocate


Joined: 02 May 2003
Posts: 4237

PostPosted: Mon Aug 11, 2014 6:49 pm    Post subject: Reply with quote

Is there a real reason to block users from using xorg with udev flag and prevent evdev presence?
Back to top
View user's profile Send private message
khayyam
Advocate
Advocate


Joined: 07 Jun 2012
Posts: 2244

PostPosted: Mon Aug 11, 2014 7:49 pm    Post subject: Reply with quote

defer- ... good work. I'm currently using mdev (in conjunction with mdev-like-a-boss) so probably no reason to switch. Some feedback and a question, you should probably add virtual/dev-manager to the overlay and add sys-fs/smdev as a provider. Does smdev support /etc/mactab?

krinn wrote:
Is there a real reason to block users from using xorg with udev flag and prevent evdev presence?

evdev doesn't work unless {,e}udev is running, so if you want to use {,s}mdev then obviously you loose that functionality.

best ... khay
Back to top
View user's profile Send private message
krinn
Advocate
Advocate


Joined: 02 May 2003
Posts: 4237

PostPosted: Mon Aug 11, 2014 8:49 pm    Post subject: Reply with quote

My point is :
If there are incompatibilities to have them both, then i understand the block.
But if the block is just there, because you cannot use evdev with smdev that's limiting people for no reason.

Remove the block, add a message to explicitly tell people to not use evdev with smdev.
But this will allow anyone to have both install and start/stop the one it wish with or without evdev depending on the one in use.

It only said evdev depend on udev, it's different than "evdev will prevent smdev working".
You can have evdev and keyboard/mouse and use the one you need.
Back to top
View user's profile Send private message
khayyam
Advocate
Advocate


Joined: 07 Jun 2012
Posts: 2244

PostPosted: Tue Aug 12, 2014 3:21 am    Post subject: Reply with quote

krinn wrote:
It only said evdev depend on udev, it's different than "evdev will prevent smdev working".
You can have evdev and keyboard/mouse and use the one you need.

krinn ... perhaps I wasn't clear, if the udev useflag is enabled on xorg-server then it will expect udev to be running, if {,s}mdev is running as device-manager then X11 will fail. evdev is needed for udev, but it serves no purpose when using {,s}mdev, and as there is no way to switch (at least not without re-compilation) then obviously the choice is such that one or other device-manager need be configured, and so the udev useflag disabled, evdev removed from INPUT_DEVICES, etc. {,e}udev can be installed if need be, but those things which expect udev to be running won't work, and so the useflag needs to be disabled.

best ... khay
Back to top
View user's profile Send private message
krinn
Advocate
Advocate


Joined: 02 May 2003
Posts: 4237

PostPosted: Tue Aug 12, 2014 10:11 am    Post subject: Reply with quote

That's not what i see here :
I have /etc/init.d/udev stop and restart xdm and it just works, evdev is happy running (of course udev is stopped but it has create the devices already and the devtmpfs is mount with them).
The only problem : if i unplug the mouse and replug the mouse... nothing

So without udev, evdev manage to still works when xorg is starting if the devs entries are there.

To me, evdev runtime dependency on udev is for unplug/plug devices while running xorg, but it doesn't need it at all to just start it.
And everyone knows already xorg will works without evdev but keyboard/mouse, something anyone can select with a proper xorg.conf

So i don't see any problem with someone using xorg[udev] flag and switching its xorg.conf with evdev and keyboard/mouse depending if it run udev or smdev.
I'm not really in mood to actually test, but if smdev create the needed devices for evdev to detect the devices attach to it, i'm "sure" evdev will also happy works and people might just use smdev with evdev (while of course lacking the plug/unplug devices in xorg).

I'm not really feeling that good, because generally if you say something and other something else ; is a good hint you are wrong :)
But in this case, i think you both assume something that doesn't exist...
Back to top
View user's profile Send private message
khayyam
Advocate
Advocate


Joined: 07 Jun 2012
Posts: 2244

PostPosted: Tue Aug 12, 2014 11:40 am    Post subject: Reply with quote

krinn ...

at the time of my switching to mdev I did test if the udev useflag could be enabled, it failed. I forget the exact circumstances, and the error, and perhaps it was due to something else but in my case xorg failed to start. Anyhow, if you say it works then fine, but I'm not really seeing the need for switching between the two if {,s}mdev can function with 10-keyboard.conf, and in my case I didn't want/need udev installed. Is there a "real reason"? Well, I don't really see the use case where there would be a need to switch back and forth.

best ... khay
Back to top
View user's profile Send private message
defer-
Tux's lil' helper
Tux's lil' helper


Joined: 11 Jun 2007
Posts: 132
Location: Finland

PostPosted: Tue Aug 12, 2014 11:54 am    Post subject: Reply with quote

I removed unnecessary dependencies and added sys-fs/smdev to virtual/dev-manager.

khayyam wrote:
Does smdev support /etc/mactab?

I think smdev does not support nameif/mactab but one could use something like this:
/etc/conf.d/net
Code:
preup() {
        [ "${IFACE}" = "lo" ] && return 0

        [ ! -d /dev/.udev -a -n "$( echo "${IFACE}" | grep -v "^br[0-9]\+$" )" ] && {
                einfo "Calling 'nameif' to set interface names"
                /sbin/nameif
        }

        return 0
} # preup

source: http://blog.stuart.shelton.me/archives/891
_________________
https://github.com/defer-
Back to top
View user's profile Send private message
krinn
Advocate
Advocate


Joined: 02 May 2003
Posts: 4237

PostPosted: Tue Aug 12, 2014 1:55 pm    Post subject: Reply with quote

khayyam wrote:
Is there a "real reason"? Well, I don't really see the use case where there would be a need to switch back and forth.

Just to allow to test smdev without need to remove udev and change too many things. It won't kill anyone if unnecessary blockers are removed anyway.
Back to top
View user's profile Send private message
steveL
Advocate
Advocate


Joined: 13 Sep 2006
Posts: 2449
Location: The Peanut Gallery

PostPosted: Thu Aug 14, 2014 1:46 pm    Post subject: Reply with quote

defer: I'd write that like this:
Code:
preup() {
   case $IFACE in
   br[0-9]*|*/br[0-9]*) [ -d /dev/.udev ]
   esac && return
   einfo "Calling 'nameif' to set interface names"
   /sbin/nameif
}

'case' exits true if nothing matches, same as 'if' does when no branch is taken (and no 'else'); otherwise they exit with the return status of whatever was last executed. There's no excuse to be calling out to grep. To be equivalent to the grep, you would lose the second option: and just test for: br[0-9]*) -- that may be preferable. I assumed we'd occasionally get /dev/br0 or whatever.
Could also use br[0-9]*|/dev/br[0-9]*) unless we always get the device name in that format?

By default I'd go for generality in the script, and leave it up to the admin to use what they like.

Sorry if this is bleary, just woke up..

edit to add: I agree with krinn about the blockers; unless something truly breaks when something else is installed, leave it up to the admin to install a working selection: that's their job.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum