Merge wip-sysfs into xseg, with amendments