Thursday 17 September 2009

Wireless printing with HP Photosmart C4580

C4580 Wireless printer setup

I recently bought an HP Photosmart C4580 All-in-one printer, encouraged by HP's level of support for open source.

First step was to download and install the latest HPLIP drivers from http://hplipopensource.com  then run hp-setup to install the printer. It worked perfectly connected over USB, but I really wanted wireless to work. No joy. hp-setup wouldn't see the printer to set up wirelessly.

Finally at about 10:30 on a Saturday night I went onto the hp website and registered my problem, thinking if I got a response in the next two weeks I'd be in good shape. Next morning a reply was waiting for me. And even better, it worked! the C4580 now prints wirelessly - brilliant bit of kit. See here: https://answers.launchpad.net/hplip/+question/82615

In essence, the C4580 isn't officially supported over wireless, though I confess I'm a bit confused as I've found other posts on the web that say it is. To allow hp-setup to configure it you need to change the wireless support setting in the config for the driver..

> sudo gedit /usr/share/hplip/data/models/models.dat

Then search for the section [photosmart_c4500_series]
in that section, change wifi-config=0 to wifi-config=1

re-run hp-setup and this time the printer will be found when you select wireless setup

Haven't mastered the scanner over wireless yet, but stay tuned

Ripping better quality CDs in Ubuntu


No, I don't mean only recording classical music...

I use sound juicer to rip my CDs into Ogg Vorbis format.

> sudo apt-get install sound-juicer

However, I'm a bit fussy how I wanted to record them - the default bitrate is 160kbps and I wanted a tad more detail


To create a profile that will record at higher quality, go into Sound Juicer and select Edit..Preferences. 
At the bottom of the dialog there's an Output format. It's probably showing "CD Quality, lossy (.ogg type)". And a button marked "Edit profiles". Click that. 

Select the "CD Quality, lossy" profile and click Edit. Copy the GStreamer pipeline value, as this is what you're going to modify in your new profile. Mine was this:
audio/x-raw-float,rate=44100,channels=2 ! vorbisenc name=enc quality=0.5 ! oggmux

See the quality setting of 0.5?The quality setting is a value from 0.1 .. 1. 0.5 represents a bitrate of 160kbps. I wanted 192kbps, which is 0.6. So back in the Edit GNOME Audio Profiles dialog, cick New and enter this line for the GStreamer pipeline:
audio/x-raw-float,rate=44100,channels=2 ! vorbisenc name=enc quality=0.6 ! oggmux
and call the profile "CD Quality, better"

Tuesday 15 September 2009

Mounting a NAS drive share

I have a Maxtor NAS drive on my home network which is a convenient place to store my photos and music. After moving onto Ubuntu one of the first things I wanted to do was get this connected.

Before starting this, make sure winbind is installed and working. See my earlier ping by name post.

As an initial test I tried using the file manager, just to make sure that there weren't any other problems lurking.
Accessing my NAS drive using the file manager in gnome is convenient, but not very easy for applications to access the files, and I'd have to remember each time I logged in. I wanted to mount the NAS as part of the filesystem. I found this article on google:
http://justlinux.com/nhf/Filesystems/Mounting_smbfs_Shares_Permanently.html

Creating a mount point by hand
first of all, I create a directory in the /mnt folder to act as the mount point. You could create this anywhere, including in your home folder, but I found that actions like searching in my home area would take ages as it would also try to search the network drive. Same goes for archiving my documents - so I went for the more standard /mnt option instead
> cd /mnt
> sudo mkdir maxtor01-phil

then use smbmount to mount the share on the folder
> smbmount //maxtor01/Phil /mnt/maxtor01-phil -o username=myusername,password=mypassword

things to note:
myusername and mypassword are the username and password for the NAS share, not your ubuntu login
the comma between the parameters must have no spaces around it
If you havent set up winbind, it probably wont resolve the sharename but you could test by substituting the IP address of the drive. See my earlier
ping by name post on how to fix this.

Making the mount permanent
create a file in the home directory called .smbpasswd - this will hold the logon credentials in a secure way
> cd
> echo username=myusername > .smbpasswd
> echo password=mypassword >> .smbpasswd
> chmod 600 .smbpasswd

chmod 600 means only root will have access

next add the mount lines to /etc/fstab (obviously change the share names)
# maxtor01 NAS drive
//maxtor01/Phil /mnt/maxtor01-phil smbfs credentials=/root/.smbpasswd,uid=phil 0 0

now every time I connect to my home network, the remote shares are automatically mounted.

can't ping devices by hostname, only IP

I've got a few devices on my home network, including a Maxtor NAS drive. After installing Ubuntu and connecting to the network I found I could ping the IP address of the NAS but not its name.
To resolve devicenames on the network, you need to install winbind via package manager, which adds the winbind service allowing resolution of user and group information from Windows network devices (including my Maxtor NAS drive)

I found this article with a spot of googling, which put me on the right track.
http://forums.whirlpool.net.au/forum-replies-archive.cfm/928521.htm

to install winbind:
> sudo apt-get install winbind

next, you need to add the service to the /etc/nsswitch.conf file:
> sudo gedit /etc/nsswitch.conf

find the hosts line (mine looked like this)
hosts: files mdns4_minimal [NOTFOUND=return] dns mdns4

and I added wins. Initially I added it at the end, which didn't work.
Then I added it before the [NOTFOUND ] clause. It worked. And also stopped Firefox from accessing external websites...
Finally, this order seems to work:
hosts: files wins mdns4_minimal [NOTFOUND=return] dns mdns4

...and voila. ping device now works!

References
http://forums.whirlpool.net.au/forum-replies-archive.cfm/928521.htm
http://www.softpanorama.org/Solaris/Reference/etc/nsswitch.shtml