Author: Isaac Dunham Date: To: karl CC: dng Subject: Re: [Dng] libsysdev preview
On Fri, Jan 23, 2015 at 10:57:39PM +0100, karl@??? wrote: > Isaac Dunham:
> > On Sun, Jan 18, 2015 at 01:11:15PM +0100, karl@??? wrote:
> ...
> > > Mesa uses the name sysfs, which might be better than sysdev.
> > > The following two might be a good start:
> > >
> > > $ grep ^sysfs src/loader/loader.c
> > > sysfs_get_pci_id_for_fd(int fd, int *vendor_id, int *chip_id)
> > > sysfs_get_device_name_for_fd(int fd)
> > >
> > > and
> > >
> > > dev_node_from_fd(int fd, unsigned int *maj, unsigned int *min)
> ...
> > Optimally, the API will be simple enough that developers then say
> > "And why aren't we using this *instead* of libudev?"
>
> If I get some time over I'd like to try replacing mesa's routines with
> libsysdev.
Mesa's internal --enable-sysfs is essentially equivalent to libsysdev.
(It was actually the inspiration for what I've written.)
> > There's a basic example at util/devinfo.c, and the header has comments
> > tersely explaining what inputs each function takes.
>
> devinfo doesn't handle partitions ?
>
> $ devinfo /dev/sda
> /sys//devices/pci0000:00/0000:00:13.1/0000:03:06.0/ata1/host0/target0:0:0/0:0:0:0/block/sda/device
> $ devinfo /dev/sda1
> $
A partition has no "device" link; there's nothing you get from sysfs
besides "this is partition 'n', here's the alignment, here's where it
starts and ends, and by the way here's a bunch of stats about how much
use it's seen this boot".
The device link contains information like the driver in use, modalias,
model, vendor, and a whole bunch of other things; and everything I was
after was in the device link.
If it's meaningful, I can change this behavior; but that *will*
break the trick I mention -
cat `devinfo /dev/input/<node>`/name
depends on going into .../device
Or I could add an option to just get the DEVPATH.
> > It builds with "make" (no ./configure).
> > It will build and install into /usr/{bin,lib,include} by default.
>
> You can use:
>
> PREFIX=/usr/local make
> PREFIX=/usr/local make install
>
> or similar to make it install in your preferred dir.
For what it's worth, I went to a bit of effort to ensure that PREFIX,
DESTDIR, LIBDIR, and so forth do not change anything before
"make install".
> > On debian, devuan, and related distros, you will need to install with:
> > make LIBDIR="/usr/lib/$TRIPLET" install
> > On non-pure64 64-bit installs of other distros, you will need to set
> > LIBDIR to point to the appropriate directory (lib32 or lib64).
>
> Works fine on a pure 32-bit debian.
Installing directly in /usr/lib will work, but for packaging multiarch
is important.