Permission denied

Discussion in 'Mac Programming' started by jamesapp, Aug 12, 2009.

  1. jamesapp macrumors 6502a

    Joined:
    Mar 7, 2008
    #1
    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?
     
  2. iShater macrumors 604

    iShater

    Joined:
    Aug 13, 2002
    Location:
    Chicagoland
  3. ChrisA macrumors G4

    Joined:
    Jan 5, 2006
    Location:
    Redondo Beach, California
    #3
     
  4. jamesapp thread starter macrumors 6502a

    Joined:
    Mar 7, 2008
    #4
    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.
     
  5. jamesapp thread starter macrumors 6502a

    Joined:
    Mar 7, 2008
    #5
    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?
     
  6. autorelease macrumors regular

    Joined:
    Oct 13, 2008
    Location:
    Achewood, CA
    #6
    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.
     
  7. jamesapp thread starter macrumors 6502a

    Joined:
    Mar 7, 2008
    #7
    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?
     
  8. Guiyon macrumors 6502a

    Joined:
    Mar 19, 2008
    Location:
    North Shore, MA
    #8
    Have you installed the drivers for the USB->Serial adaptor?
     
  9. jamesapp thread starter macrumors 6502a

    Joined:
    Mar 7, 2008
    #9
    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. Guiyon macrumors 6502a

    Joined:
    Mar 19, 2008
    Location:
    North Shore, MA
    #10
    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).
     
  11. jamesapp thread starter macrumors 6502a

    Joined:
    Mar 7, 2008
    #11
    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.
     
  12. Guiyon macrumors 6502a

    Joined:
    Mar 19, 2008
    Location:
    North Shore, MA
    #12
    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.
     
  13. jamesapp thread starter macrumors 6502a

    Joined:
    Mar 7, 2008
    #13
    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?
     
  14. autorelease macrumors regular

    Joined:
    Oct 13, 2008
    Location:
    Achewood, CA
    #14
    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.
     
  15. parapup macrumors 65816

    parapup

    Joined:
    Oct 31, 2006
    #15
    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.
     

Share This Page