Difference between revisions of "Serial Hack"
(Trout, I'm not sure what you're trying to achieve here so quit screwing things up, you're NOT helping) |
(→Comments: Zaerc, please try to understand the objectives of a wiki page and the objectives of a discussion page.) |
||
Line 45: | Line 45: | ||
That should overwrite the file in one go, without having to use vi. | That should overwrite the file in one go, without having to use vi. | ||
--[[User:Zaerc|Zaerc]] 04:53, 20 September 2007 (MST) | --[[User:Zaerc|Zaerc]] 04:53, 20 September 2007 (MST) | ||
+ | |||
+ | |||
+ | Let's all join in the mis-understanding of Wiki and this page. How do you want to edit a file today? | ||
+ | |||
+ | I think this would be cool. | ||
+ | |||
+ | perl -e 'print "#!/bin/bash\n\ntree -fi /dev | grep ttyS\ntree -fi /dev | grep ttyUSB"' > /usr/pluto/bin/ListSerialPorts.sh | ||
+ | |||
+ | What do you all think about that coolness? It's all on a single line so it can be edited unlike the Zaerc version. Perl is widespread and easy to type. Probably it could just be copied and pasted. Wow that's sweet. | ||
+ | |||
+ | Anyway, I doubt that AVJohn was asking for contributions as to how to edit a dang file. Probably, since the page is called "Serial Hack", he was asking if there was a better way to fix the serial situation, rather than editing a file. But that's no matter, I think that everyone should become smarter for reading this blog on the main page. Is't it great! | ||
+ | |||
+ | Cheers to all! | ||
+ | |||
+ | Zaerc - I've added content, so you should feel good about that. I know that in your mind all additions are good additions and deserve a place on a Wiki page. Removing blather like this would be horrific so I'm sure this will stay here for a long time. | ||
+ | |||
+ | [[User:Trout|Trout]] 07:10, 23 September 2007 (MST) | ||
Revision as of 15:10, 23 September 2007
Serial List Hack
In some situations, (which, I might add are becoming more and more common now) a core or core/hybrid may not have enough, or indeed, any serial ports for automation kit such as the X10 modules to jack into.
In these cases a USB-to-Serial converter may be used, but LinuxMCE does not list these correctly in its admin pages. This is due to the script "/usr/pluto/bin/ListSerialPorts.sh" which creates the list of serial ports, not giving the correct path (usually /dev/ttyUSB#, where # is a number).
A simple replacement, which, while inferior to the current script in that it does not detect the ports in use, does correctly list all serial ports, both USB and normal serial. However, it requires the 'tree' command, so:
sudo apt-get install tree
Once that has completed, tree will have been installed, and we can use its '-fi' mode to produce full paths, then it is just a simple matter of removing the origional ListSerialPorts.sh file and writing our own, I use vim for this, but any other terminal or graphical text editor will do the job:
sudo rm /usr/pluto/bin/ListSerialPorts.sh sudo vim /usr/pluto/bin/ListSerialPorts.sh
Now that vim is open, enter the following:
#!/bin/bash tree -fi /dev | grep ttyS tree -fi /dev | grep ttyUSB
Comments
If someone out there has a better way of doing this, please post it here! -AVJohn
How about:
cat >/usr/pluto/bin/ListSerialPorts.sh <<"EOF" #!/bin/bash tree -fi /dev | grep ttyS tree -fi /dev | grep ttyUSB EOF
That should overwrite the file in one go, without having to use vi. --Zaerc 04:53, 20 September 2007 (MST)
Let's all join in the mis-understanding of Wiki and this page. How do you want to edit a file today?
I think this would be cool.
perl -e 'print "#!/bin/bash\n\ntree -fi /dev | grep ttyS\ntree -fi /dev | grep ttyUSB"' > /usr/pluto/bin/ListSerialPorts.sh
What do you all think about that coolness? It's all on a single line so it can be edited unlike the Zaerc version. Perl is widespread and easy to type. Probably it could just be copied and pasted. Wow that's sweet.
Anyway, I doubt that AVJohn was asking for contributions as to how to edit a dang file. Probably, since the page is called "Serial Hack", he was asking if there was a better way to fix the serial situation, rather than editing a file. But that's no matter, I think that everyone should become smarter for reading this blog on the main page. Is't it great!
Cheers to all!
Zaerc - I've added content, so you should feel good about that. I know that in your mind all additions are good additions and deserve a place on a Wiki page. Removing blather like this would be horrific so I'm sure this will stay here for a long time.
Trout 07:10, 23 September 2007 (MST)