djpohly / piuio

Custom PIUIO module for Linux
GNU General Public License v2.0
29 stars 13 forks source link

/dev block device not showing up. #8

Closed spritepr closed 9 years ago

spritepr commented 9 years ago

Hey, some time again I used this module to make my piuio work with linux mint 13 and it seemed to work fine. I am using debian wheezy (whatever the latest is as of today 3/20/2015) this time and was having an issue compiling the module which I was able to fix by using the branch mentioned here:

https://github.com/djpohly/piuio/issues/7

the problem now though is my piuio is not showing up under /dev and I have no idea why. lsmod claims no one is using the piuio module so I take that means its not recognizing the device for some reason. The device shows up correctly under lsusb (python encoder or something I believe) and I have tried changing USB ports and recompiling the module to no avail.

roothorick commented 9 years ago

To be overly dramatic: the rules have changed. /dev/piuio0 is no more.

From a quick browse of the repo, it looks like over the summer Devin rewrote the driver to connect to the Linux Event and LED interfaces, instead of its own proprietary device. This means the PIUIO driver in SM will no longer work.

HOWEVER, the driver now creates a /dev/input/eventX device, and permissions permitting (hah), SM should be able to use that to pick up inputs from the machine. If it doesn't, that's a bug in SM, and please do file.

As for lights... SM also gained a LightsDriver_PIUIO_leds to go with the driver rewrite (see: https://github.com/stepmania/stepmania/pull/276 ). Your SM needs to be new enough to have the new driver (5.0.6 should have it I think), and of course, it needs to be able to access the interface files created in /sys/class/leds.

spritepr commented 9 years ago

Hmm. Wouldn't that still show the module as in use? lsmod shows 0 devices using piuio. I'll have a look under /dev/input/eventX tonight.

djpohly commented 9 years ago

The number in lsmod (which comes from /proc/modules) is the number of active users of the device. If something had the device open for input, the number would change.

If you can start an X server, check the output from xinput to see if the device shows up there. Or look through your dmesg log to see if it mentions piuio at all. Or you can go through all of your event devices with evemu or evtest to see what they are.

As for permissions, you can configure udev to adjust those from the default root-owned files. Our cabinet here runs SM5 as a non-root user with the current PIUIO driver.

spritepr commented 9 years ago

Ok here's my dmesg output after plugging in the io:

[ 414.644026] usb 1-5: new high-speed USB device number 6 using ehci_hcd [ 414.777041] usb 1-5: New USB device found, idVendor=0547, idProduct=1002 [ 414.777048] usb 1-5: New USB device strings: Mfr=1, Product=2, SerialNumber=0 [ 414.777052] usb 1-5: Product: EZ-USB FX2 [ 414.777055] usb 1-5: Manufacturer: Cypress [ 414.778254] Registered led device: piuio::output0 [ 414.778300] Registered led device: piuio::output1 [ 414.778344] Registered led device: piuio::output2 [ 414.778385] Registered led device: piuio::output3 [ 414.778426] Registered led device: piuio::output4 [ 414.778469] Registered led device: piuio::output5 [ 414.778510] Registered led device: piuio::output6 [ 414.778553] Registered led device: piuio::output7 [ 414.778596] Registered led device: piuio::output8 [ 414.778637] Registered led device: piuio::output9 [ 414.778678] Registered led device: piuio::output10 [ 414.778721] Registered led device: piuio::output11 [ 414.778763] Registered led device: piuio::output12 [ 414.778807] Registered led device: piuio::output13 [ 414.778850] Registered led device: piuio::output14 [ 414.778894] Registered led device: piuio::output15 [ 414.778938] Registered led device: piuio::output16 [ 414.778986] Registered led device: piuio::output17 [ 414.779031] Registered led device: piuio::output18 [ 414.779075] Registered led device: piuio::output19 [ 414.779123] Registered led device: piuio::output20 [ 414.779169] Registered led device: piuio::output21 [ 414.779213] Registered led device: piuio::output22 [ 414.779257] Registered led device: piuio::output23 [ 414.779300] Registered led device: piuio::output24 [ 414.779345] Registered led device: piuio::output25 [ 414.779389] Registered led device: piuio::output26 [ 414.779434] Registered led device: piuio::output27 [ 414.779477] Registered led device: piuio::output28 [ 414.779522] Registered led device: piuio::output29 [ 414.779565] Registered led device: piuio::output30 [ 414.779611] Registered led device: piuio::output31 [ 414.779657] Registered led device: piuio::output32 [ 414.779702] Registered led device: piuio::output33 [ 414.779747] Registered led device: piuio::output34 [ 414.779793] Registered led device: piuio::output35 [ 414.779844] Registered led device: piuio::output36 [ 414.779892] Registered led device: piuio::output37 [ 414.779938] Registered led device: piuio::output38 [ 414.779985] Registered led device: piuio::output39 [ 414.782372] Registered led device: piuio::output40 [ 414.782428] Registered led device: piuio::output41 [ 414.782478] Registered led device: piuio::output42 [ 414.782525] Registered led device: piuio::output43 [ 414.782666] Registered led device: piuio::output44 [ 414.782717] Registered led device: piuio::output45 [ 414.782763] Registered led device: piuio::output46 [ 414.782810] Registered led device: piuio::output47 [ 414.782927] input: PIUIO input as /devices/pci0000:00/0000:00:1d.7/usb1/1-5/1-5:1.0/input/input10 [ 414.784052] usb 1-5: piuio resubmit(out): shutdown [ 414.784292] usb 1-5: piuio resubmit(in): shutdown [ 414.784789] usb 1-5: piuio resubmit(out): shutdown [ 414.784909] usb 1-5: piuio resubmit(in): shutdown

Ok so the event number changes on every boot. How would I make a udev rule to change permissions on it. I also see the leds under /sys/class/leds but theres 48 of em?? Do i need to change permissions on all of these?

EDIT:

Looking at the source its: 2,3,4,5,6 and 18,19,20,21,22 for the pads then 23,24,25,26,10 for the marquee and subs? The symlinks have rwx permissions on them what do I need to do for SM to see them?

djpohly commented 9 years ago

The driver changes the permissions automatically on the leds (see lines 430–440), so they should be accessible by any program. There are a lot of them because the protocol allows many bits of output, and the driver is meant to handle this card as a generic I/O board, not specific to one setup.

As for the input, you can print out a list of selectable udev attributes using the command:

# udevadm info -a /dev/input/input10

If I remember correctly, our rule would have been something like:

KERNEL=="event*", DRIVERS=="piuio", TAGS+="seat"

which would select only event devices provided by the piuio driver, and give them the "seat" tag which indicates to systemd that this device should be accessible by any user who is logged into the machine locally. (If your distro/release doesn't run systemd, you could probably use OWNER="youruser" or MODE="666" instead of the TAGS clause.)

(StepMania questions aren't really on-topic here, but I think you have to set your LightsDriver explicitly in Preferences.ini if you haven't done that already.)

spritepr commented 9 years ago

I got it all working. My issue with the LightsDriver was that I forgot to change it to PIUIO_Leds. You can close this issue now.