Jump to content

As of July 17, 2015, the LabJack forums here at forums.labjack.com are shut down. New registrations, topics, and replies are disabled. All forums are in a read-only state for archive purposes.

Please visit our current forums at labjack.com/forums to view and make new posts. To post on the current forums, use your labjack.com login account. Your old LabJack forums login credentials have been retired. There are no longer separate logins for labjack.com and LabJack forums.


Photo

OpenDevice error with a linux php5 web server controlling a U3.


  • Please log in to reply
4 replies to this topic

#1 blh3620

blh3620
  • Members
  • 3 posts

Posted 01 July 2015 - 10:26 AM

My U3-LV runs u3allio correctly when executed using the terminal command:

 

./u3allio

 

However, when I issue an execution command (shell_exec("./u3allio");) from a php script running on a linux server, u3allio executes, but I get the following error message:

 

Open error:  could not find a U3 with a local ID or a serial number of -1

 

If I understand the u3.c code, this really means that a call to OpenDevice returned a NULL.

 

I note that errno = 13 (incorrect permission).

 

I would appreciate comments and/or a solution.  Thanks in advance.  blh3620.



#2 LabJack Support

LabJack Support
  • Admin
  • 8677 posts

Posted 01 July 2015 - 12:37 PM

After running the install.sh script from the Exodriver download, LabJack device files (what OpenDevice/libusb-1.0 uses for USB device communications) become part of the adm group. Note to power cycle your U3 after running the installer so the new group takes effect.

 

If you are getting "errno = 13 (incorrect permission)" errors when opening a U3, most likely the user running the application isn't part of the adm group and will not have access to the U3 device file. Try adding the user running your php script to the adm group and see if that helps. Alternatively, you can modify the Exodriver download's 10-labjack.rules (LabJack udev rules) and change the GROUP to something your php script and its shell_exec have group permissions for. After loading this udev rules file, when LabJack devices are connected to your computer their device files will be part of the GROUP you set.

 

For details on adding users to a group and loading the 10-labjack.rules file manually, refer to the "Permissions and "Install The udev Rules" sections of the INSTALL.Linux file.



#3 blh3620

blh3620
  • Members
  • 3 posts

Posted 02 July 2015 - 09:22 AM

Since the user running my php script on the server can be anyone on the web, I don't see how to assign them a group name.  Can I modify the rules file to change the group from adm to anyone?   -blh3620



#4 LabJack Support

LabJack Support
  • Admin
  • 8677 posts

Posted 02 July 2015 - 10:50 AM

I believe there should be a default group for web content on your server which your php script would be running under, and you can set your group to that in the rules file (10-labjack.rules).

 

There isn't an "anyone" group, but you can also try setting the permissions mode in general to everyone in the rules file. Change:

ATTRS{idVendor}=="0cd5", GROUP="adm"

to:

ATTRS{idVendor}=="0cd5", MODE:="0666"

Note that 0666 gives all users (owner, group, other) write/read (6) permissions, and use ":=" to prevent other rules from overwriting these settings which was happening when I tested with just "=" in Ubuntu. After modifying and saving the rules file, either run the install.sh script again or use the manual instructions on loading the udev rules file as mentioned in my previous post. Afterwards power cycle your U3 for the new rules/permissions to take effect.



#5 blh3620

blh3620
  • Members
  • 3 posts

Posted 10 July 2015 - 10:42 AM

Thanks LabJack support.  The default server group name for my lubuntu server is www-data.  Substitution of this name for adm in the rules file, as you suggested, solved the problem.

-blh3620 




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users