问题
I have Mio A701 communicator that I would like to use as GSM modem for sending SMS from my Mac.
What I've found so far is that one just can send an AT commands directly from terminal to special ports like /dev/ttyUSB0 if modem is connected via USB port or /dev/rfcomm0 if connection is handled via bluetooth. My problem is that when I try to issue a command I get a "permission denied" response:
"AT+CMGS=test\r" > /dev/ttyUSB0
-bash: /dev/ttyUSB0: Permission denied
Also "ls /dev" shows that neither ttyUSB0 nor rfcomm0 files are present there so I can't update permissions on these files.
Any help would be greatly appreciated, thanks in advance.
Update: problem is solved.
First of all Mio A701 appears to be wrong choice since it does not support AT commands for sending SMS.
This PHP code works fine with Nokia 3310c connected via bluetooth:
$number="<phone number in international format with + sign>";
$message="Hello World\ntest"; // as far as I've tested \n successfully turns into a line break in SMS on Mio, Nokia and Alcatel phones
$port="/dev/tty.phone"; // this path was set in "Mac preferences" -> bluetooth -> "configure ports" for selected device
if($fd = fopen($port, 'a')) {
fwrite($fd, "AT+CMGF=1\r"); // text mode for SMS
sleep(2);
fwrite($fd, "AT+CMGS=\"$number\"\r");
sleep(2);
fwrite($fd, "$message\032");
sleep(2);
$fh = null;
} else
echo "Phone unreachable";
回答1:
best way to send sms and ussd messages is to install smstools3 (not smstools) and build on the sample scripts.
回答2:
Try smsd utility from smstools package, hope it will help
来源:https://stackoverflow.com/questions/2115904/how-to-send-sms-from-mac-terminal-via-gsm-modem