Re: [PATCH igt 1/2] lib: Add simple sysfs accessors

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, May 26, 2016 at 05:36:09PM +0300, Ville Syrjälä wrote:
> > +
> > +	for (int n = 0; n < 16; n++) {
> > +		int len = sprintf(path, "/sys/class/drm/card%d", n);
> > +		sprintf(path + len, "/error");
> 
> That's goint to limit this to i915. I was thinking we could pass
> the drm_fd here to find the correct minor for it.

Hah, I was rewriting it to avoid the i915 presumption. Using fstat and
comparing sysfs/cardN/dev is what I went with. Pretty much equivalent to
drmGetDeviceNameFromFd(), yes.

> > +bool igt_sysfs_set(const char *filename, const char *value)
> > +{
> > +	int sysfs = __igt_sysfs_singleton();
> > +	int fd, len, ret;
> > +
> > +	if (sysfs < 0)
> > +		return false;
> > +
> > +	fd = openat(sysfs, filename, O_WRONLY);
> > +	if (fd < 0)
> > +		return false;
> > +
> > +	len = strlen(value);
> > +	ret = write(fd, value, len);
> 
> EINTR?

Pesky signals.
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre
_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/intel-gfx




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux