NetBSD-Users archive

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

Correct/safe way to set ugen*/USB device permissions



Hello all,

Currently, I'm testing out NetBSD 7 as my primary OS on my 2011 Thinkpad. So far, the experience has been relatively smooth as I try to get back to normal business after setup.

One of these "orders of business" was to get my FPGA toolchain back up and running. A bit surprisingly, Xilinx ISE 14.7 works just fine with Linux emulation. My FPGA board uses an FTDI chip to talk to a PC; a usermode program needs to bitbang an SPI interface to talk to the nonvolatile flash storage.

I'm writing a usermode program to bitbang the SPI interface using libftdi. I had to recompile my kernel to get my dev board to be compatible with libusb, as discussed here: https://mail-index.netbsd.org/netbsd-users/2009/04/27/msg003552.html

For various reasons, I would like to have my usermode program be usable by a normal user, and to be portable between Win32/Linux/BSD/etc) On Windows/Linux, this is not a problem; USB devices are accesible by default on Windows, and Linux has udev rules. However on NetBSD, libftdi/usb will not detect my device in my recompiled kernel usless I'm the superuser.

According to IRC chats, and the following thread: http://mail-index.netbsd.org/netbsd-users/2011/11/14/msg009552.html, one way to accomplish what I want is to simply change the device group and permissions and add myself to that group (and give instructions to other users).

However, considering this is a USB device (i.e. "dynamic"), I have three concerns with this:
1. I'd like to keep the number of device files whose permissions I modify to a minimum, just in case something goes very wrong due to programming error. Unfortunately, ugen* generates a device file for every single USB endpoint for every single device.
2. I'm not sure if my FPGA board will always show up on the same device nodes, which means that I have to change permissions for even more devices in anticipation!
3. My default installation seems to have generated device nodes only for up to 4 generic devices, and I have the potential to exhaust all of them (I suppose running MAKEDEV will fix this)?

That said, is this the "canonical"/correct way to allow USB devices to be accessible by normal users? Or since the above post was written, has there been a different kernel framework that allows normal users to access USB devices.

More generally, is adding users to device-specific groups, changing device ownership to these groups and adding entries to/running MAKEDEV.local still the canonical way to customize device permissions, a la the equivalent functionality in Linux?

As always, thanks for the help!

Sincerely,

-- 
William D. Jones <thor0505%comcast.net@localhost>


Home | Main Index | Thread Index | Old Index