Guzunty / Pi

This repository contains resources to support the Guzunty Pi IO expansion board
110 stars 32 forks source link

Unable to update ports when running c++ complied file through PHP #26

Open kworsfold opened 10 years ago

kworsfold commented 10 years ago

Hi

I have created and complied, setting correct permissions making all users executable.

Problem is when run without line 'gz_spi_set(0x06);' it works fine through Web Interface, but when added I get... [0] => error opening /dev/spidev0.0 [1] => ERROR while sending

When run using command line runs smoothly.

I am thinking this is a permissions problem within 'gz_spi.h' as it is unable to access 'spidev'

Can you help...

campbellsan commented 10 years ago

Yes, that is a generic permissions issue. You would have the same error if you were using any SPI hardware not just Guzunty.

One possibility is to run your php daemon with root permissions, which is obviously a potential security risk, so you might not want to do this. I don't know enough about PHP to know how to make this change. You can try asking about this in your preferred generic RPi forum.

Another thing which may work would be to rebuild the gz library to use the alternative "/sys/class/spidev/spidev0.0" device. I think this approach may have performance implications, but I don't think they will be significant for most applications.

I may get a chance to try this approach over the next few days, or let me know how you get on with trying it yourself if you get there first.