Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Linux Programming
  4. help me to understand "rfcomm" symbol "->"

help me to understand "rfcomm" symbol "->"

Scheduled Pinned Locked Moved Linux Programming
helpquestion
10 Posts 5 Posters 21 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    jana_hus
    wrote on last edited by
    #1

    I do not get the symbol "->" . I am trying to have serial port "ttyUSB0 " linked with rfcomm0. Which command is correct ?

    nov25-1@nov251-desktop:~$ sudo ln -s -v /dev/ttyUSB0 /dev/rfcomm0
    [sudo] password for nov25-1:
    '/dev/rfcomm0' -> '/dev/ttyUSB0'
    nov25-1@nov251-desktop:~$ sudo ln -s -v /dev/rfcomm0 /dev/ttyUSB0
    '/dev/ttyUSB0' -> '/dev/rfcomm0'
    nov25-1@nov251-desktop:~$

    L 1 Reply Last reply
    0
    • J jana_hus

      I do not get the symbol "->" . I am trying to have serial port "ttyUSB0 " linked with rfcomm0. Which command is correct ?

      nov25-1@nov251-desktop:~$ sudo ln -s -v /dev/ttyUSB0 /dev/rfcomm0
      [sudo] password for nov25-1:
      '/dev/rfcomm0' -> '/dev/ttyUSB0'
      nov25-1@nov251-desktop:~$ sudo ln -s -v /dev/rfcomm0 /dev/ttyUSB0
      '/dev/ttyUSB0' -> '/dev/rfcomm0'
      nov25-1@nov251-desktop:~$

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      It shows that the device name on the left is a link to the actual device named on the right. So when you send any data to /dev/rfcomm0 it will actually go to the device at /dev/ttyUSB0.

      J 1 Reply Last reply
      0
      • L Lost User

        It shows that the device name on the left is a link to the actual device named on the right. So when you send any data to /dev/rfcomm0 it will actually go to the device at /dev/ttyUSB0.

        J Offline
        J Offline
        jana_hus
        wrote on last edited by
        #3

        Thanks, would it make more sense , more generic, to say "data sent to device on the LEFT will get passed to device on the RIGHT" of the "->" (symbol ) ? Now for the follow-up question - more (confusing_) Linux terminology. physical, hard , symbolic ?? hence " which way's up " ? what would be the purpose of "symbolic" link ? if there is no -s option , is the link "hard" ? is "hard" == "physical" ?

           -P, --physical
                  make hard links directly to symbolic links
        
        
           -s, --symbolic
                  make symbolic links instead of hard links
        

        Cheers

        R K 2 Replies Last reply
        0
        • J jana_hus

          Thanks, would it make more sense , more generic, to say "data sent to device on the LEFT will get passed to device on the RIGHT" of the "->" (symbol ) ? Now for the follow-up question - more (confusing_) Linux terminology. physical, hard , symbolic ?? hence " which way's up " ? what would be the purpose of "symbolic" link ? if there is no -s option , is the link "hard" ? is "hard" == "physical" ?

             -P, --physical
                    make hard links directly to symbolic links
          
          
             -s, --symbolic
                    make symbolic links instead of hard links
          

          Cheers

          R Offline
          R Offline
          RichardM
          wrote on last edited by
          #4

          jana_hus wrote:

          would it make more sense , more generic, to say "data sent to device on the LEFT will get passed to device on the RIGHT" of the "->" (symbol ) ?

          Not really as the name on the left is just a node in the /dev directory tree, not an actual device. The link just associates one name with another. I have not looked at this for some time, but I think they are hard links. They are actually set up by the kernel when the system is initialised at boot time, based on the connected devices.

          1 Reply Last reply
          0
          • J jana_hus

            Thanks, would it make more sense , more generic, to say "data sent to device on the LEFT will get passed to device on the RIGHT" of the "->" (symbol ) ? Now for the follow-up question - more (confusing_) Linux terminology. physical, hard , symbolic ?? hence " which way's up " ? what would be the purpose of "symbolic" link ? if there is no -s option , is the link "hard" ? is "hard" == "physical" ?

               -P, --physical
                      make hard links directly to symbolic links
            
            
               -s, --symbolic
                      make symbolic links instead of hard links
            

            Cheers

            K Offline
            K Offline
            k5054
            wrote on last edited by
            #5

            Way back, the UNIX filesystem only supported a physical link. So a directory entry might have been

            struct dirent {
            unsigned long d_ino;
            char d_name[30];
            };

            So if your directory contained

            8539501 foo
            8539502 bar
            8539503 baz
            8539502 paw

            Then it should be clear that the files bar, inode=8539502 and paw inode=8539502 are the same file, i.e a Physical (or hard) link. If you list the directory you'll see something like

            [k5054@azure foo]$ ls -li
            total 0
            8539502 -rw-r--r-- 2 k5054 k5064 0 Oct 13 06:31 bar
            8539503 -rw-r--r-- 1 k5054 k5064 0 Oct 13 06:31 baz
            8539501-rw-r--r-- 1 k5054 k5064 0 Oct 13 06:31 foo
            8530502 -rw-r--r-- 2 k5054 k5064 0 Oct 13 06:31 paw

            The -i flag to ls add the inode, and so we can see bar and paw have the same inode (8359502). Also, column 3 shows the number of physical links to the inode, which for bar and paw are 2, but foo and baz are only one. Note that a hard link doesn't need to reside in the same directory, you can for example do something like

            ln foo/bar/baz ping/pong/paw

            , which will create the physical link. There are 2 restrictions to hard links: 1) you can't create a hard link between directories, and 2) you can't create hard links across file systems. Symbolic (soft) links solve both these problems. In the case of a soft link, the link can be thought of as a reference. If we take the above directory and create a soft link between foo and bang via ln -s foo bang we now get: k5054@azure foo]$ ls -li total 4 8539536 lrwxrwxrwx 1 k5054 k5064 3 Oct 13 06:48 bang -> foo 8539502 -rw-r--r-- 2 k5054 k5064 0 Oct 13 06:31 bar 8539503 -rw-r--r-- 1 k5054 k5064 0 Oct 13 06:31 baz 8539501 -rw-r--r-- 1 k5054 k5064 0 Oct 13 06:31 foo 8539502 -rw-r--r-- 2 k5054 k5064 0 Oct 13 06:31 paw This shows that the file `bang` is a symbolic link (file type "l") which points to "foo". Now "bang" acts as a pointer or an indirection. In order to get to the contents of , the OS has to open bang, read its contents and then open the file pointed to by the contents. Also, note that the size of bang is 3, ie "foo". Since we now have this indirection, we can link to files in other filesystems, and we can also create links to other directories. You're also not limited to only one indirection. A soft link can point to another soft link, to another soft link, etc. "A little song, a little dance, a little seltzer down your pants" Chuckles t

            J 1 Reply Last reply
            0
            • K k5054

              Way back, the UNIX filesystem only supported a physical link. So a directory entry might have been

              struct dirent {
              unsigned long d_ino;
              char d_name[30];
              };

              So if your directory contained

              8539501 foo
              8539502 bar
              8539503 baz
              8539502 paw

              Then it should be clear that the files bar, inode=8539502 and paw inode=8539502 are the same file, i.e a Physical (or hard) link. If you list the directory you'll see something like

              [k5054@azure foo]$ ls -li
              total 0
              8539502 -rw-r--r-- 2 k5054 k5064 0 Oct 13 06:31 bar
              8539503 -rw-r--r-- 1 k5054 k5064 0 Oct 13 06:31 baz
              8539501-rw-r--r-- 1 k5054 k5064 0 Oct 13 06:31 foo
              8530502 -rw-r--r-- 2 k5054 k5064 0 Oct 13 06:31 paw

              The -i flag to ls add the inode, and so we can see bar and paw have the same inode (8359502). Also, column 3 shows the number of physical links to the inode, which for bar and paw are 2, but foo and baz are only one. Note that a hard link doesn't need to reside in the same directory, you can for example do something like

              ln foo/bar/baz ping/pong/paw

              , which will create the physical link. There are 2 restrictions to hard links: 1) you can't create a hard link between directories, and 2) you can't create hard links across file systems. Symbolic (soft) links solve both these problems. In the case of a soft link, the link can be thought of as a reference. If we take the above directory and create a soft link between foo and bang via ln -s foo bang we now get: k5054@azure foo]$ ls -li total 4 8539536 lrwxrwxrwx 1 k5054 k5064 3 Oct 13 06:48 bang -> foo 8539502 -rw-r--r-- 2 k5054 k5064 0 Oct 13 06:31 bar 8539503 -rw-r--r-- 1 k5054 k5064 0 Oct 13 06:31 baz 8539501 -rw-r--r-- 1 k5054 k5064 0 Oct 13 06:31 foo 8539502 -rw-r--r-- 2 k5054 k5064 0 Oct 13 06:31 paw This shows that the file `bang` is a symbolic link (file type "l") which points to "foo". Now "bang" acts as a pointer or an indirection. In order to get to the contents of , the OS has to open bang, read its contents and then open the file pointed to by the contents. Also, note that the size of bang is 3, ie "foo". Since we now have this indirection, we can link to files in other filesystems, and we can also create links to other directories. You're also not limited to only one indirection. A soft link can point to another soft link, to another soft link, etc. "A little song, a little dance, a little seltzer down your pants" Chuckles t

              J Offline
              J Offline
              jana_hus
              wrote on last edited by
              #6

              Thanks, it is getting more "convoluted"... Allow me to start over. The task is to "send (serial) data to /dev/ttyUSB0 and pass the same data to /dev/rfcomm0 ". Calling "/dev/ttyUSB0 " a node or device SHOULD be "technicality" - the task is still the same. However, the "link" option - "symbolic" or "hard /[physical " SHOULD make a difference as far as the task goes. My , probably incorrect, interpretation is: "symbolic" still accomplishes the task, but introduces another "intermediate process" - "pointer" etc. "hard / physical " accomplishes the task directly I do appreciate this discussion, very much, thank you.

              M 1 Reply Last reply
              0
              • J jana_hus

                Thanks, it is getting more "convoluted"... Allow me to start over. The task is to "send (serial) data to /dev/ttyUSB0 and pass the same data to /dev/rfcomm0 ". Calling "/dev/ttyUSB0 " a node or device SHOULD be "technicality" - the task is still the same. However, the "link" option - "symbolic" or "hard /[physical " SHOULD make a difference as far as the task goes. My , probably incorrect, interpretation is: "symbolic" still accomplishes the task, but introduces another "intermediate process" - "pointer" etc. "hard / physical " accomplishes the task directly I do appreciate this discussion, very much, thank you.

                M Offline
                M Offline
                markkuk
                wrote on last edited by
                #7

                jana_hus wrote:

                The task is to "send (serial) data to /dev/ttyUSB0 and pass the same data to /dev/rfcomm0 ".

                In that case, the whole preceding discussion about links has been just a waste of time. You can't do that task with links. A link means a single object (file, device, directory, etc) can be accessed using multiple different names. If you create a link from /dev/ttyUSB0 to /dev/rfcomm0, then anything written to either ttyUSB0 or rfcomm0 will end up in rfcomm0. If there was a physical device associated with the name /dev/ttyUSB0 before creating the link, it will be bypassed by the new link.

                J 1 Reply Last reply
                0
                • M markkuk

                  jana_hus wrote:

                  The task is to "send (serial) data to /dev/ttyUSB0 and pass the same data to /dev/rfcomm0 ".

                  In that case, the whole preceding discussion about links has been just a waste of time. You can't do that task with links. A link means a single object (file, device, directory, etc) can be accessed using multiple different names. If you create a link from /dev/ttyUSB0 to /dev/rfcomm0, then anything written to either ttyUSB0 or rfcomm0 will end up in rfcomm0. If there was a physical device associated with the name /dev/ttyUSB0 before creating the link, it will be bypassed by the new link.

                  J Offline
                  J Offline
                  jana_hus
                  wrote on last edited by
                  #8

                  PLEASE suggest alternative approach.

                  R M 2 Replies Last reply
                  0
                  • J jana_hus

                    PLEASE suggest alternative approach.

                    R Offline
                    R Offline
                    RichardM
                    wrote on last edited by
                    #9

                    There is no alternative. You cannot link two nodes together and expect the system to send data to them as separate entities. Linking A to B means that A is B and vice versa.

                    1 Reply Last reply
                    0
                    • J jana_hus

                      PLEASE suggest alternative approach.

                      M Offline
                      M Offline
                      markkuk
                      wrote on last edited by
                      #10

                      If you want to send your data to two different destinations, you need to send it twice.

                      1 Reply Last reply
                      0
                      Reply
                      • Reply as topic
                      Log in to reply
                      • Oldest to Newest
                      • Newest to Oldest
                      • Most Votes


                      • Login

                      • Don't have an account? Register

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • World
                      • Users
                      • Groups