Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

jamesapp

macrumors 6502a
Original poster
Mar 7, 2008
544
0
The command would be:

Code:
echo "text" > /dev/ttyUSB0
[code]

I am trying to run the above command to test a speech synthesizer. I bought a USB to serial adaptor cable, I have the synthesizer plugged into the adaptor and the adaptor plugged into a USB port on my computer. I was given the above command as a means of testing a speech synthesizer connected through a USB port on my MacBook pro laptop. When I run the command my computer says permission denied. I have read on google about sudo and su. My question is how can I run this command?
 
The command would be:

Code:
echo "text" > /dev/ttyUSB0
[code]

I am trying to run the above command to test a speech synthesizer. I bought a USB to serial adaptor cable, I have the synthesizer plugged into the adaptor and the adaptor plugged into a USB port on my computer. I was given the above command as a means of testing a speech synthesizer connected through a USB port on my MacBook pro laptop. When I run the command my computer says permission denied. I have read on google about sudo and su. My question is how can I run this command?[/QUOTE]

Do you really need a hardware speech synthesizer?  Mac OS X comes with a software speech synthesizer and there are other better ones you can get for free from CMU.   I hate to see peole spend money on this because every one of them is just the free CMU package, re-packaged and sold.

Direct answer to your question: (1) Simply add five characters before the "e" in echo, that would be "sudo " or (2)  Look at the write permission on the file /dev/ttyUSB and decide if you want to change it to allow "normal", users to be able to write to that device.  Changing it so the "sudo" is no longer required.   You can change it either in the finder or in the terminal using "chmod" command.  

One more thing.   If you need to look up how a command works first read the man page in the terminal for example for look up how sudo works type "man sudo" (no quotes) or "man chmod" or even "man man".
 
I tried typing

sudo echo "text" > /dev/ttyUSB0

still getting permission denied, I think the problem is with the file /dev/ttyUSB0 because I ran a similar command

echo "text" > /dev/ttyS0

and I was able to run it, should I put sudo somwhere else in the command? Or should I try to change the permissions using the chmod command? Not really sure how to do this, I am pretty sure the file I want to change is hidden from the GUI. Any help would be appreciated.
 
I do have tinker tool on my mac, I just opened it there is an option to show hidden and system files. I wondered if /dev/ttyUSB0 would show up? If it did could I highlight the file and click get info and change the permissions from there? How would I change permissions from get info? Do I click the little plus button and then my name?
 
Are you sure you should be using /dev/ttyUSB0? Are these directions for Mac or for Linux?

Try running the following command in the Terminal, with the device connected:
Code:
ls /dev/ttyUSB0
If you get a "No such file or directory" error, then the directions are incorrect. OS X uses a different naming scheme for USB-to-serial adaptors. It might be called "/dev/cu.usbmodem" or something like that. Try this command in the terminal:
Code:
ls /dev/cu.*
If you see something like "/dev/cu.usbmodemXXXX" listed, you might want to try that.

The problem has nothing to do with permissions. If you try to write to a device that doesn't exist, you get a "permission denied" error, even if the device file doesn't exist.
 
Tried

ls /dev/ttyUSB0

got no such file or directory. Tried

ls /dev/cu.*

all I got back were Bluetooth listings. One thing I just did was disconnect the device and ran

ls /dev/cu.*

again and I still get Bluetooth listings. I wonder where is my speech synthesizer when it is pluged into the USB port?
 
I was told by the company that made the USB to serial adaptor cable that I don't need a driver. They said that since I am running mac os x 10.5.7 that I don't need to install a driver, I am going to call them back and double check.
 
10-to-1 it's based off either the FT232R or PL-2303 series chips. Neither of these are supported out of the box by MacOS X. There are mac drivers available, however. You can find them on the FTDI or Prolific websites (respectively).
 
I was told by the company that made the USB to serial adaptor cable that I don't need a driver. They said that since I am running mac os x 10.5.7 that I don't need to install a driver, I am going to call them back and double check.

I downloaded a driver from the prolific website. It downloaded to my downloads folder. In the read me file it talks about
installer script:

1. Go to terminal
2. cd /system/library/Extension
3. kextunload ProlificUSBSerial.kext
4. rm -r ProlificUSBSerial.kext

a couple of things about the above I have a folder called /system/library/Extensions I went into this folder and typed the command from step 3 from above got the following from terminal

no such bundle file exists
can't add kext (file access/permissions).

There is a Extensions.mkext folder in /system/library is this where I want to run the command from step 3. From the installer script? Also there is a .dmg file when I downloaded the driver, can I just double click this to install the driver? I looked up on google how to install a .dmg and they talked about applications. I downloaded a driver, can I just double click the .dmg and follow the directions? Also is it hard to uninstall a driver? I am getting a 2.0 USB to serial adaptor and it is coming with a driver, and if I wanted to use I think they might want me to uninstall any USB to serial adaptor driver first. I don't know if I should wait to get the new cable? And/or how hard it would be to uninstall the driver I am currently trying to install? This is probally easier than I am making it but I don't want to screw something up. Any help would be appreciated.
 
Before you go installing the Prolific drivers, did you get confirmation that the chipset is the Prolific one? If it isn't, installing the PL-2303 drivers won't do jack. If it is a Prolific chipset then download this file, unzip it then double click the DMG to mount it. Once the disk image appears on the desktop open it up, double click the installer package and follow the instructions.
 
Are you sure you should be using /dev/ttyUSB0? Are these directions for Mac or for Linux?

Try running the following command in the Terminal, with the device connected:
Code:
ls /dev/ttyUSB0
If you get a "No such file or directory" error, then the directions are incorrect. OS X uses a different naming scheme for USB-to-serial adaptors. It might be called "/dev/cu.usbmodem" or something like that. Try this command in the terminal:
Code:
ls /dev/cu.*
If you see something like "/dev/cu.usbmodemXXXX" listed, you might want to try that.

The problem has nothing to do with permissions. If you try to write to a device that doesn't exist, you get a "permission denied" error, even if the device file doesn't exist.

just an update to this post I got a USB to serial adaptor and installed an ftdi driver. Ftdi makes the chipsets for my adaptor. I looked in /dev and found cu.usbserial-FTKVMAFF I just wondered if this is the port representing my USB to serial adaptor? I am a little confused about the difference between the serial port and the USB to serial adaptor?
 
just an update to this post I got a USB to serial adaptor and installed an ftdi driver. Ftdi makes the chipsets for my adaptor. I looked in /dev and found cu.usbserial-FTKVMAFF I just wondered if this is the port representing my USB to serial adaptor? I am a little confused about the difference between the serial port and the USB to serial adaptor?

Yes, this is most likely it.

There's no difference between "serial port" and "USB to serial adaptor." The USB to serial adaptor is emulating a serial port, so when you plug it into your Mac, it's as if it had a good old serial connector on the motherboard.
 
I tried typing

sudo echo "text" > /dev/ttyUSB0

still getting permission denied, I think the problem is with the file /dev/ttyUSB0 because I ran a similar command

echo "text" > /dev/ttyS0

and I was able to run it, should I put sudo somwhere else in the command? Or should I try to change the permissions using the chmod command? Not really sure how to do this, I am pretty sure the file I want to change is hidden from the GUI. Any help would be appreciated.

Try doing a "sudo -s" first and then doing the echo afterwards in a separate command.

Code:
$ sudo -s <ENTER>
$ echo "text" > /dev/ttyS0

Or try
Code:
echo "text" | sudo tee -a /dev/ttyUSB0

sudo echo > /system/file never works because the /system/file is opened as the USER not ROOT or something.

Of course this all makes sense only if your device is recognized by the OS and you are writing to the write /dev entry for that device.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.