1

I have Ubuntu Server 12.04 LTS and on it I have installed gammu. I use it to control my "Nokia 5310 Xpress music" cell phone.

Now when I run "gammu --identify" it does not work, says I dont have the right device permissions, but it works with sudo gammu --identify

Now my Nokia device is listed as ttyACM0 in my /dev/ directory... its permissions are rw for root and dialout... I tried to change these permissions so that I can use this device with gammu without sudo ... I did sudo chmod 777 /dev/ttyACM0 and it changed the permissions, but still it did not work...

I even went and added a file in /etc/udev/rules.d/ by the name of 40-41-descriptive-name.rules which contained the following line:

SUBSYSTEM=="usb", ATTR{idVendor}=="0421", ATTR{idProduct}=="006b", MODE="0600", OWNER="MyUserName"

and then restarted udev but still no luck...

I even did sudo chown myusername /dev/ttyACM0 and gave myself the ownership of the device but still I needed to use sudo to get things done...

btw if I do lsusb I get the following info:

BUS 002 Device 003: ID 0421:006b Nokia Mobile Phones

I tried all these ways to change the device permissions so that i could use "gammu --identify" instead of sudo gammu --identify but no luck.

How can i fix this dilemma?

devav2
  • 35,738
  • 17
  • 79
  • 82
ArslanW
  • 151
  • 1
  • 2
  • 10
  • vMobile BroadBand is better than Wammu-Gammu – Naveen Nov 04 '12 at 14:45
  • I Googled the term but apparently found nothing...Weird... – ArslanW Nov 04 '12 at 17:24
  • Betavine connection manager supports sending/getting sms, reading phone book, and establishing an Internet connetion from the phone. Here is a screen shot:http://i.imgur.com/B9xXa.png If you like to give a try:https://forge.betavine.net/frs/?group_id=76 – Naveen Nov 05 '12 at 02:36

3 Answers3

2

Taking help from fellow answers I found the solution to my problem...

In my gammu configuration file I changed the port to /dev/phone

Then I went to /etc/udev/rules/ directory and in it I created a file name 99-phone.rules, then in that file I wrote the following line:

SUBSYSTEM=="usb", ATTRS{idVendor}=="0421", ATTRS{idProduct}=="006b", MODE="0666" , SYMLINK+="phone"

Then I rebooted my system and then when I connected my Nokia phone, I was able to run commands on it without using sudo!

Thanks Everyone especially @firusvg !!

ArslanW
  • 151
  • 1
  • 2
  • 10
1

To avoid potential problems with situation that phone gets recognized as /dev/ttyACM0, /dev/ttyACM1,... or /dev/ttyUSB0, /dev/ttyUSB1,... with subsequent connection/reconnection cycles, make symlink for phone to be like /dev/phone - make 99-phone.rules udev rule with:

KERNEL=="ttyUSB*", ATTRS{idVendor}=="0421", ATTRS{idProduct}=="006b", NAME="phone", MODE="0666"
KERNEL=="ttyACM*", ATTRS{idVendor}=="0421", ATTRS{idProduct}=="006b", NAME="phone", MODE="0666"

and make change for port in .gammurc to be port=/dev/phone. Now, you'll be able to issue gammu commands without sudo.

Of course, remove previous rules in your 40-41-descriptive-name.rules

Please note that two lines in 99-phone.rules are there only to ensure that all possible cases for initial phone recognition are covered (also note MODE="0666" - that will give rw for all users/groups).

This is approach I'm using for my own SMS gateway (using three phones and based on gammu-smsd) and, so far, works well.

firusvg
  • 126
  • 2
  • I used gammu, and I have now made the changes you advised, but the thing is I still have to use sudo, and the device still comes as ttyACM0 in my /dev/ directory – ArslanW Nov 04 '12 at 17:22
  • ok I understand why the device is still listed as ttyACM0 but I still have to use sudo... I even restarted my system but still no go... – ArslanW Nov 04 '12 at 18:23
  • Just to be sure - are you using (in yours gammu configuration) new port /dev/phone or still using /dev/ttyACM0 ? Does /dev/phone even exist after you plug-in phone? Look at my output, using same method I've explained (except I'm not using Nokia phone) it works - [link](http://pastebin.com/hiVZmy94) administrator, in my case, is regular user, username may be misleading. Which version of gammu are you using? Who is owner (user/group) of /usr/bin/gammu? Is yours user also member of dialout group? Can you enable logging for gammu and put log output? – firusvg Nov 05 '12 at 02:47
  • yeah I am using /dev/phone in my gammu configuration, and in my /dev/ directory my phone comes up as /dev/ttyACM0. Whn I run the command groups the dialout group does not appear (and Im also not a part of it), and the owner of /usr/bin/gammu is root... Oh I see... gammu is accessible only by root! Ill change its ownership and see if it works now... – ArslanW Nov 05 '12 at 06:59
  • I changed the permissions of gammu and made the owner my user and gave him rwx permissions but I am still unable to run gammu without sudo... and my phone still comes as ttyACM0 but I can reference it as /dev/phone, but the permissions of ttyACM0 are given to root only when i run ls -l on it... – ArslanW Nov 05 '12 at 07:04
  • My gammu version is 1.31.0 – ArslanW Nov 05 '12 at 07:05
  • Did you make yourself member of dialout group with `useradd -G developers username` (use your username)? Did you enable logging for gammu and can you post log file? Also, please post content of gammu configuration file you're using. – firusvg Nov 05 '12 at 10:57
  • After the changes I made to 99-phone.rules the group which can use /dev/ttyACM0 is root and the owner is root as well... dialout seems to be gone, and what is dialout anyway? When i run the groups command dialout does not appear.... – ArslanW Nov 05 '12 at 12:11
  • Sorry for the late reply... well I dont have gammu logs but for my config file I have the following values... port=/dev/phone and connection=dku2phonet – ArslanW Nov 06 '12 at 13:48
  • I found one thing... There is a /dev/phone and also a /dev/ttyACM0 in my dev directory... and both of them are the same phone.... – ArslanW Nov 06 '12 at 15:54
  • I have solved the problem, check out my answer for it... – ArslanW Nov 06 '12 at 18:59
0

One should also check Gammu daemon gammu-smsd and it's configuration file. The daemon itself will run as root but then the command gammu-smsd-inject will allow to send sms without root permission as far as the spool directory is writable. Also the good thing is the daemon will take care of receiving message periodically.

CedSha
  • 31
  • 4