Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

GSM problem

by roc (Sexton)
on Apr 23, 2010 at 11:42 UTC ( [id://836503]=perlquestion: print w/replies, xml ) Need Help??

roc has asked for the wisdom of the Perl Monks concerning the following question:

hi every one...i have a cgi script to send sms as follow...

use CGI; use Device::Gsm; my $qu = new CGI; my @num = $qu->param("num"); my @msg = $qu->param("message"); print "Content-type:text/html\n\n"; my $gsm = new Device::Gsm( port => '/dev/ttyACM0', pin => '0000' , log + => 'file,network.log', loglevel => 'debug'); if( $gsm->connect() ) { #line no.14 print "connected!\n"; } else { print "sorry, no connection with gsm phone on serial port!\n"; } $gsm->register(); $gsm->send_sms( recipient => "$num[0]", content => "$msg[0]", class => 'normal');

im using frdora 12 ....when i run the script as root(su -l root -c "/usr/bin/perl /path/to/script/script.cgi") then script giving the output as "connected" in command line.. but as user(su -l user -c "/usr/bin/perl /path/to/script/script.cgi") its giving error as "Not connected at /path/to/script/script.cgi line 14" ...

the file is under 755 permission. i tried 'su -l user -c "strace -f /usr/bin/perl /path/to/script/script.cgi"'...it's giving 'open("/dev/ttyACM0", O_RDWR|O_NOCTTY|O_NONBLOCK|O_LARGEFILE) = -1 EACCES (Permission denied)....how to fix this problem...i mean how to make the script to work under user...please give me some suggestion to fix this..

------------------------------------------------

Update

hey...thanks a lot...the problem solved...i gave 777 permission to /dev/ttyacm0......then its working fine...

Replies are listed 'Best First'.
Re: GSM problem
by choroba (Cardinal) on Apr 23, 2010 at 11:51 UTC
Re: GSM problem
by almut (Canon) on Apr 23, 2010 at 11:53 UTC
    the file is under 755 permission

    What group is it?  Often, write access to a device by an unprivileged user is achieved by making the device group-writable (775 or 664) and having the user belong to that group.  (That's usually preferred to making the device world-writable (like 777 or 666).)

      hey...thanks a lot...the problem solved...i gave 777 permission to /dev/ttyacm0......then its working fine...

Re: GSM problem
by wazoox (Prior) on Apr 23, 2010 at 11:48 UTC
    Your script obviously must have write access to /dev/ttyACM0. So 755 permission is not enough, probably should be 777.
      I fear that the permission refers to the script file, not the device.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://836503]
Approved by wazoox
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (4)
As of 2024-03-28 08:10 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found