Showing posts with label ubuntu. Show all posts
Showing posts with label ubuntu. Show all posts

Monday, March 01, 2010

The endless abyss of LIRC

I built a home made Tivo out of a computer running MythBuntu (a flavor of MythTV). It installs very easily and quickly if you buy decently supported hardware. If you are using hardware with questionable Linux support, or you want it to do something a little bit custom, it can be an endless time sink to set up. I marginally justify it by thinking I am learning Linux in general along the way.

There are several ways to use a remote control with MythTV, the most common uses LIRC. LIRC is a trashy little pain in the ass program, with outdated and incomplete documentation, that generally can be forced to work if you know what you are doing, or are willing to spend tens of hours trying. I appreciate the author's time in making this program. But honestly if it wasn't free, it wouldn't be worth my time and frustration to use. LIRC needs an IR dongle to receive the remote signals. I use the serial dongle from Iguanaworks.

Set up the receiver
This assumes LIRC is installed and runs by default on your Myth distribution. This is true for most of them. Shut down the computer, plug in the serial dongle, restart the computer.

Test the receiver is working
mode2 can be used to test that the receiver is recognized and passing a remote signals to the computer
sudo mode2 -d /dev/lirc0
Now use any old remote and press some buttons, while pointing it at the receiver. You should get a bunch of pulse/pause gibberish. If you do, all is good, press ctrl+c to break out of it. If you get nothing, you need to figure out why the computer can't see the receiver, or the receiver isn't picking up any signal.

Pick and record the remote codeset
Select a set of codes on the universal remote you want to use. I'd suggest using the highest DVR codeset number, of the same brand as the universal remote, so all keys are likely to be usable. I'm going to use Sony DVR component code 3210 on their RM-VL600 remote.

If lirc is running and you want to reconfigure it, first you have to kill it
sudo killall lircd
Now let's record a new remote control configuration, first change into the recording directory.
cd /etc/lirc
Now start the recorder.
sudo irrecord -n -d /dev/lirc0 lircd.conf.new
Follow the directions onscreen. After you are done, archive your old lircd.conf and make the newly recorded conf current.
sudo mv /etc/lirc/lircd.conf /etc/lirc/lircd.conf.old
sudo mv /etc/lirc/lircd.conf.new /etc/lirc/lircd.conf

Verify the remote is being recognized
Use irw to test Lirc's interpretation of the remote keys. First restart lirc to load the new conf file.
To restart Lirc on Ubuntu 9.10 and up
sudo service lirc start|stop|restart
On older Ubuntu versions
sudo /ect/init.d/lirc start|stop|restart
Now type irw. Press buttons on the remote. You should get the name of the key, and the name of the remote echoed in the terminal. After you are satisfied, press ctrl+c to break out of irw. If you got nothing, lirc can't see the receiver, or wasn't able to load the new configuration file.

Map button names to a lirc event
Open up the lircrc file to see what remote keys are mapped to MythTV keyboard shortcuts.
nano /home/(username)/.lircrc
You should see an include statement for
/home/(username)/.lirc/mythtv
You need to open this file,
sudo nano /home/(username)/.lirc/mythtv
Verify the remote name and button names in lircd.conf are mapped to the correct MythTV keyboard shortcuts in this file. Edit lircrc as necessary. After you get done doing this, you need to restart lirc and restart MythTV frontend. Your remote should work now. MythTV no longer requires irexec or irxevent anymore, contrary to a lot of docs you will find on the intrawebs.


Other random notes
Check /etc/lirc/hardware.conf that DEVICE=/dev/lirc0

To see if lirc or irw is in the process list (ignore grep x in list)
ps aux | grep (lirc or irw)

Monday, August 24, 2009

The madness of Windows Vista and printers

My printer is connected to a Linux / Ubuntu computer running CUPS, which is software to offer a printer to other computers for easy setup. I haven't had a problem setting up printing from Ubuntu and Windows XP computers. When I set up printing from a Windows Vista computer, it was initially frustrating. But I eventually figured out how to do it, and it worked fine for several weeks. All of a sudden the printer quit working on only the Vista computer. I initially suspected I mis-configured something in CUPS that Vista just wasn't as tolerant of. But after lots of fiddling and googling for answers, in desperation I finally decided to delete the Vista printer and reinstall it.

There are 3 ways in Vista to install a printer, and a 4th way if you are printing to a printer connected to a Mac or Linux computer.
  • You can use the default auto-detect feature.
  • You can click on "my printer wasn't listed," and add the correct port (in this case an IP port), then manually install the printer.
  • You can click on "my printer wasn't listed," and specify the printer location by IP address.
Be warned, in my experience, though Vista will act like it correctly installed a CUPS printer using the first 2 methods, the printer will never work. You have to specify the printer location by IP address initially, and then for good measure, go into printer options and disable "advanced printer features."

The fourth way I haven't tried, but I have heard good things about, is to install Bonjour for Windows from Apple. It is Apple's implementation of auto-discovery for devices and peripherals. Bonjour will then automatically find the printer on the other computer and set it up to print from in Vista.

By the way, this isn't the first time I have had trouble with the Vista printer applet forgetting how to print to a printer. I've even had it randomly delete a printer from the control panel. So much for Vista being a better and easier to use computing experience. Of course we knew better already, didn't we.

Sunday, June 14, 2009

Setting up mt-daapd with Avahi on Xubuntu and Ubuntu

I have all of my music on my media server, and it is being shared by Firefly and Avahi so I can easily listen to it on any computer with Rythmbox or iTunes. Firefly is the media server. Avahi is also called Bonjour by Apple or Zeroconf or Autodiscover. It is the service that advertises Firefly to iTunes. It also advertises printers to Mac computers.

There are some pretty good explanations on the internet how to initially set up Firefly, but most of them miss an important part at the end so the next time you reboot, iTunes can still autodiscover the shared music library. I'll briefly go over the first steps in case they disappear off the net


Avahi is probably already installed and autostarts on your Ubuntu machine
Install firefly
sudo apt-get install mt-daapd

Install ID3 tag reading package
sudo apt-get install libid3tag0

Start firefly
sudo /etc/init.d/mt-daapd start

Update startup scripts so firefly restarts
sudo update-rc.d mt-daapd defaults

Go to firefly config page (or config file) and tell it your music directory
http://localhost:3689 or sudo nano /etc/mt-daapd.conf

Restart firefly
sudo /etc/init.d/mt-daapd restart

Now we need to configure Avahi to serve Firefly correctly after reboots. For some reason it will work right after installation without this. But the next reboot it would quit working.

sudo nano /etc/avahi/services/mt-daapd.service

Paste into that file

I give up, posting code into Blogger with less than symbols is broken and a huge pain in the butt. Check the link above for the code.

Restart Avahi
# /etc/init.d/avahi-daemon restart

That's it. You should now be able to see your shared music library on iTunes. And it should survive a reboot.

Tuesday, June 02, 2009

ASUS is acting bizarre - what the heck is going on there?

I used to prefer ASUS motherboards price permitting, and I'd generally only buy their graphics cards. They seemed to make more reliable hardware, with better documentation, and decent support (compared to the other Taiwanese manufacturers.) I was looking forward to buying an eeePC in the not distant future. But something bizarre is happening inside ASUS corporate, and I don't want to facilitate their bizarre behavior.

At Computex Taipei, chairman of Asustek, Jonney Shih apologizes Qualcomm chose to show an Asus derived product. ""I think you may have seen the devices on Qualcomm's booth but actually, I think this is a company decision so far we would not like to show this device. That's what I can tell you so far. I would like to apologize for that."

It was an eeePC running a Qualcomm ARM processor and Google's Android operating system. Reports were that it looked great, really polished and ready for production. Yet Jonathan Tsang, vice chairman of Asustek, said the Eee PC with Android is not ready yet because the technology is "not mature."

http://www.computerworld.com/action/article.do?command=viewArticleBasic&articleId=9133813


From what I have heard, the only thing "not mature" was the Asus customized version of Xandros Linux they tried putting on eeePCs. I've read reports people had to dump it because updates would kill the operating system. Some people put XP on it and were reasonably satisfied, but it slowed the machine down and ate a lot of disk space. Those who put the Linux distribution eeebuntu on it have been happy and said it really lets the machine shine.

Gordon Kerr Asus Austrailian Consumer Market Product Manager told a reporter Linux is likely to be phased out of the Asus eeePC product line, and “If you want the full functionality of a notebook you are going to go with Windows.”

http://www.computerworld.com.au/article/304693/has_asus_all_given_up_linux


That's a pretty amazing claim, and about 180 degrees from the historical perception of Linux, and the realities of what netbooks are purchased for. Netbooks don't have all that much "functionality" to start with. They are meant to surf the web and open/edit Office documents during travel, both of which Linux on netbooks does quite well without the licensing fees and bloat of Windows. Linux is much more flexible than Windows, but you need to be more computer savvy to get that better functionality out of Linux. A lot of this has to do with the multiple types of better support companies provide Windows. Windows, while resourse intensive, and being occasionally known to eat itself, is more familiar to the basic computer user, given it is on 88% of consumer and personal business computers.

Is Microsoft putting the screws to Asus behind the curtains? Or is Asus not sophisticated enough to recognize good business and technical opportunities and plan well enough to capitalize on them? With all this going down, I'm not sure I want to support Asus in their strange and disappointing behavior towards Linux.

Saturday, May 30, 2009

Setting up a network scanner using SANE

SANE is scanning software for Linux. It stands for Scanning Access Now Easy. It can act as a server with Linux package (x)inetd, so a computer can use the scanner connected to a different computer. And it is INsaneLY tedious and time consuming to set up.

I have my HP 4180 printer/scanner connected to my desktop/Mythbuntu machine, and my laptop can use the scanner. To set this up, first ensure your desktop connected to the scanner can in fact scan. If it can't the first thing to check is SANE is installed. This will install it if not already there -
#apt-get install sane-utils

Now ordinary users must be able to scan, so go to System-Administration-Users and Groups be sure your user name is a member of the scanners group.

There are multiple versions of (x)inetd. It is a software package that spawns a program or process when a request comes in from the network. It is probably not installed, so I would recommend using xinetd not inetd. To install -
#apt-get install xinetd

Now to open the configuration file of xinetd
# sudo nano /etc/xinetd.conf

Copy and paste the following into it -
service sane-port
{
port = 6566
socket_type = stream
wait = no
user = (your user name, or check the user name in the group saned)
group = saned
server = /usr/sbin/saned
}

Now open /etc/sane.d/saned.conf and put in the computer names, IP addresses, or IP address ranges that may access the scanner. My favorite is to do it like so if you would like to allow any computer with the IP address 192.168.1.0 to 192.168.1.254 to access the printer -
192.168.1.0/24

Finally restart xinetd
# /etc/init.d/xinetd restart

On the laptop, open /etc/sane.d/net.conf and type the name or IP address of your desktop with the scanner.

You should now be able to open SANE on the laptop and it will find, and be able to scan from your scanner connected to your desktop. This was compiled from a lot of sources, but the most helpful was

Friday, May 29, 2009

MythTV MythBuntu tweaking

Here are some tweaks I made to my MythBuntu install, which is a distribution of MythTV


MythTV is similar to TiVo, but it is free to use, and free to change, and is much more powerful. It is usually easy to set up a basic install, but depending on your hardware, and the distribution you chose, and your special requirements, it can be fiendishly complex to get running to your satisfaction.



MythTV Volume Too Low


There are 4 places to look if the volume is too low when watching TV. First check in your distribution's volume control in the regular menus. This assumes you have the line out connected to your TV, rather than your headphone out. I suggest being sure your master volume and PCM are set to at least 90%. Then look in your MythTV menus (frontend setup>setup>general) and ensure both volume controls are at 90%. Next, SSH into your Myth computer and run


# alsamixer




Again set the master volume and PCM to at least 90%. So the volume change sticks on reboot, run


# sudo alsactl store




Finally while watching TV or a recording, try pressing F10 and F11 to change the frontend in-viewer volume control. Between this and the TV volume control, you should be able to get it loud enough, and equal to the live TV volume when watching through the TV tuner






Run The Schedule Grabber

The job that fills the TV listing is called mythfilldatabase. It initially grabs 14 days of listings, but if the listings are present, it only grabs tomorrows listings and the listings for the 14th day from now. This is to catch schedule changes at the last minute, and limit the amount of data required.

For some asenine reason, MythBuntu isn't set up to automatically run mythfilldatabase daily. So if you don't set it up, every day you will notice you have one less day of listings available. To set it up, go to

Utilities/Setup -> Setup -> TV Settings -> General -> 7th screen, enable "Automatically run mythfilldatabase". For "Log Path" I used "/tmp/mythfilldatabase.log".


Power Saving

Reduced power mode for the advanced audio output isn't enabled by default
# sudo -i

# echo 60 > /sys/module/snd_hda_intel/parameters/power_save
Gives a timeout of 60 seconds
# echo Y > /sys/module/snd_hda_intel/parameters/power_save_controller
Disables the controller, but will click on wakeup
# exit
You can cat these settings to see what they are, the first one 0 is disabled


Folding At Home

Even though it shouldn't be able to do this, FoldingAtHome can sometimes steal enough CPU cycles to make Flash videos in Firefox choppy. To start and stop it pre Ubuntu 9.10 run -
sudo /etc/init.d/foldingathome [stop|start|restart|status]
To start and stop it on Ubuntu 9.10 and after, run -
sudo service foldingathome [stop|start|restart|status]


Live TV Idle Timeout

If you forget to turn off live TV viewing, it can run for days with the television off. This increases your power consumption and decreases your hard drive life due to the way MythTV works, to be able to record a TV show from the beginning when you are in the middle of watching it. If you'd like live TV to stop after a period of inactivity, you'll need to add a database record.
First you need to find your mysql password
myth@myth:~$ nano /etc/mythtv/mysql.txt
Now sign into mysql
myth@myth:~$ mysql -u mythtv -p mythconverg
Enter Password:
Enter the initial settings (this will shut down the live TV front end on a box called 'myth' after 2 hours)

mysql> INSERT INTO `mythconverg`.`settings` (`value`, `data`, `hostname`) VALUES ('LiveTVIdleTimeout', '240', 'myth');
If you'd like to change it so all live TV frontends shut down after an hour, then you do an update
mysql> UPDATE `mythconverg`.`settings` SET `settings`.`hostname` = null, `settings`.`data` = '120'  WHERE `settings`.`value` = 'LiveTVIdleTimeout';
To see what you have set, do a 
mysql> SELECT * FROM `mythconverg`.`settings` WHERE `settings`.`value` = 'LiveTVIdleTimeout';
Exit when you are happy
mysql> exit
myth@myth:~$

Wednesday, May 20, 2009

Configuring xorg.conf on Linux

If the X server (graphical and video display) doesn't automatically configure on your Ubuntu distro, you have my sympathies. VESA is the backup display method, and while it generally works, it is painfully slow. Don't expect to be able to do any quality multimedia viewing in VESA.

Despite tens of hours trying to install and configure a binary accelerated driver for Sis 671 integrated graphics, I have never got it to work. While people are down on Nvidia for not open-sourcing their drivers, they do generally at least work well. Intel graphics are open-source and work decently, but Intel doesn't offer any graphics systems with real horsepower.

In this blog post, I will continue to add notes and hints for resolving problems with the configuration file of the X server, called xorg.conf.

To get information on your monitor
$ sudo apt-get install xresprobe
$ ddcprobe
Other options are read-edid, `get-edid | parse-edid`

Thursday, May 14, 2009

Setting up HP printer and CUPS on Xubuntu or Mythbuntu

My NSLU2 Unslung install quit booting for the 2nd time. Initially several hours of research, trial, and error, got the Slug recognizing the hard drive and booting again. This time the same steps didn't work. I decided the Slug isn't worth the trouble since my Mythbuntu machine is always running too. Now the Slug services (file/print/itunes server) will go on the Myth machine. Hopefully that will be more stable. Mythbuntu is a Ubuntu distribution of MythTv, a TiVo like software package.

Unless you are a masochist, only buy a HP, or maybe an Epson printer to use with Linux. Fully postcript compliant network printers are also "easy" to set up. Anything else, and you are asking for a visit to the nut house.

The docos for Ubuntu are some of the better around, but at times they leave much to be desired. Mythbuntu is really a Xubuntu distro with a lot of the desktop based packages yanked out and the media player added in. Xubuntu docos are like the red-headed step-child of the Ubuntu world.

It took me a while to figure out due to incomplete and some inaccurate info, but Mythbuntu doesn't come with a subsystem to recognize printers and try to set them up. With a HP printer, you need to install (using Synaptic) "hplip" and "hplip-gui". Your printer may not be recognized without restarting. Supposedly hotplugging is sufficient, but it didn't work for me. You should now have a HP icon in the top right corner; you can click on it, go to settings, print test page and the printer should work.

Now I want to print from other computers. CUPS is what I use, and it is installed as a dependency of hplip, but it is not set up correctly by default unless you are only printing from the computer it is attached to. And why the hell would you use CUPS for that? To get CUPS set up correctly for printing from any computer on your network, you need to
sudo nano /etc/cups/cupsd.conf
And edit the following lines

Where it says...
# Only listen for connections from the local machine.
IF the IP address of your Myth machine the printer plugs into is 192.168.1.100, then add...
Listen 192.168.1.100:631

Where it says...
# Restrict access to the server... Order allow,deny
If all your computers have ip addresses 192.168.1.xxx then add
Allow from 192.168.1.0/24
And add the same "Allow from" directives again under the headers
# Restrict access to the admin pages...
# Restrict access to configuration files...

Now you must restart CUPS by running the command
sudo /etc/init.d/cups restart

You should now be able to view and edit the CUPS server information on the Myth computer, or any other computer by going to http://192.168.1.100:631 in your browser. You should get no 403 Forbidden! errors.

To add the printer on another Ubuntu machine, go to http://localhost:631. Choose "Add printer," answer some of the BS questions, and use the printer location http://192.168.1.100:631/printers/nameofyourprinter

You can add the printer on a Windows computer similarly by going to "Add a network printer" and giving the above address.

I'll post how to add SAMBA file sharing features and iTunes mt-daapd song sharing features to a Mythbuntu install later. This is also so I'll remember how to repair my install when it inevitably craters in the future.