:: Re: [Dng] libsysdev preview
Inizio della pagina
Delete this message
Reply to this message
Autore: karl
Data:  
To: dng
Oggetto: Re: [Dng] libsysdev preview
Isaac Dunham:
> 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.)


Ok, I'll see if I do it or not, but I thought a patch agains mesa could
be a leverage for the lib.

> > > 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.


Ok, only things that has "device" then.

> 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.


No need, just naively testing the stuff, pressing random buttons and
see what happens.

...
> > > 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.


Can't help you there for the moment.

Regards,
/Karl Hammar

-----------------------------------------------------------------------
Aspö Data
Lilla Aspö 148
S-742 94 Östhammar
Sweden
+46 173 140 57