Showing posts with label linux. Show all posts
Showing posts with label linux. Show all posts

Friday, March 6, 2015

Canon PIXMA MG5250 installation in Linux

The installation was checked with Kubuntu. It is quite simple. Download the software here from the CANON site. Then select linux and download the Linux IJ Printer Driver and the Linux IJ Scanner Driver.

Select operating system and language

The drivers to download

You must accept the 'License Agreement' & 'Disclaimer'

You have the two files MG5200series-printer_driver.tar MG5200series-scanner_driver.tar

Extract the printer driver with ark into a directory. There you will find a manual, a deb and a rpm. From there extract the deb (for Kubuntu) cnijfilter-mg5200series-3.40-1-deb.tar.gz and inside there you will see a script file install.sh. Guess what, just run it and follow the instructions. Example:

user@linux: sudo ./install.sh 
==================================================

Canon Inkjet Printer Driver Ver.3.40-1 for Linux
Copyright CANON INC. 2001-2010
All Rights Reserved.

==================================================
Command executed = sudo dpkg -iG ./packages/cnijfilter-common_3.40-1_amd64.deb
(Reading database ... 123150 files and directories currently installed.)
Preparing to replace cnijfilter-common 3.40-1 (using .../cnijfilter-common_3.40-1_amd64.deb) ...
Unpacking replacement cnijfilter-common ...
Setting up cnijfilter-common (3.40-1) ...
Processing triggers for libc-bin ...
ldconfig deferred processing now taking place
Command executed = sudo dpkg -iG ./packages/cnijfilter-mg5200series_3.40-1_amd64.deb
(Reading database ... 123150 files and directories currently installed.)
Preparing to replace cnijfilter-mg5200series 3.40-1 (using .../cnijfilter-mg5200series_3.40-1_amd64.deb) ...
Unpacking replacement cnijfilter-mg5200series ...
Setting up cnijfilter-mg5200series (3.40-1) ...
Processing triggers for libc-bin ...
ldconfig deferred processing now taking place

#=========================================================#
#  Register Printer
#=========================================================#
Next, register the printer to the computer.
Connect the printer, and then turn on the power.
To use the printer on the network, connect the printer to the network.
When the printer is ready, press the Enter key.
> 

#=========================================================#
#  Connection Method
#=========================================================#
 1) USB
 2) Network
Select the connection method.[1]2

Searching for printers...

                                                                                
#=========================================================#                     
#  Select Printer                                                               
#=========================================================#                     
Select the printer.                                                             
If the printer you want to use is not listed, select Update [0] to search again.
To cancel the process, enter [Q].                                               
-----------------------------------------------------------                     
 0) Update                                                                      
-----------------------------------------------------------                     
Target printers detected (MAC address  IP address)                              
1) Canon MG5200 series (88-87-17-8D-43-09 192.168.1.106)                        
-----------------------------------------------------------                     
Currently selected:[1] Canon MG5200 series (88-87-17-8D-43-09 192.168.1.106)    
Enter the value. [1]                                                            
                                                                                
#=========================================================#
#  Register Printer
#=========================================================#
Enter the printer name.[MG5200LAN]
Command executed = sudo /usr/sbin/lpadmin -p MG5200LAN -m canonmg5200.ppd -v cnijnet:/88-87-17-8D-43-09 -E

#=========================================================#
#  Set as Default Printer
#=========================================================#
Do you want to set this printer as the default printer?
Enter [y] for Yes or [n] for No.[y]y

#=========================================================#
Installation has been completed.
Printer Name : MG5200LAN
Select this printer name for printing.
#=========================================================#
user@linux: 

Easy! Tested and working fine!

Saturday, January 18, 2014

Useful recipes

  • Change encoding of files
    The following example uses iconv to change the encoding of all the .php files in a folder tree from ISO-88592 to UTF8.

    find . -name "*.php" -exec sh -c "( \
    iconv -f ISO88591 -t UTF8 {} -o {}.iconv ; \
    mv {}.iconv {} ; echo {}; \
    )" \;

    Remember to backup your data just in case. This will recursively find the appropriately named files and re-encode them (the temporary file is necessary, as iconv otherwise destroys the input). You might also want to convert other files (.html).
    See also this link

  • Match and delete files recursively
    The following example deletes files ending in tilde (~), which usually are temporary or backup files

    find . -type f -name '*~' -exec rm -f '{}' \;

  • List all files in $PATH

    for i in `echo $PATH | tr ':' '\n'`; do echo $i; ls $i; done

Thursday, January 5, 2012

Network Manager hangs "waiting for authorisation"

The symptoms: a wireless network connection that normally connects without problems sometimes, maybe after suspension, hangs with the status "waiting for authorisation". There is no window asking for a password anywhere (the network manager should anyway have the password). This seems like a bug. Two home made solutions:

  • Reboot your router
    It just works.

  •  

  • New Connection
    This seems to be a working permanent solution. It involves re-creating the connection as public connection. Maybe not all steps are necessary. In Network manager:
    Manage Connections: Delete the existing broken connection. Really delete it, do not just edit it.
    Manage Connections: Add ("Add..." button) and then fill in a new connection name and the correct SSID and password as required;
    Select "Connect automatically" and "System connection";
    Restart the router (it was necessary here!).
    In a terminal use the following command:
    sudo iwlist wlan0 scanning essid
    (where SSID is the SSID of your network and wlan0 is the interface for the scan. See this post)
    The wireless network is found and connected automatically.

Note: using Kubuntu with kernel 3.0.0 but according to google's world there are people using other distros (SuSe, Ubuntu) reporting the same problem.

List devices in local network (IP range)

A not so frequent task is to list all active devices in a local network (to find their IP addresses). Typically this is done by writing anew a tiny shell script to ping all IP addresses in the network range or a list.

A command that can be used for this purpose with advantages is nmap (a port scanner). Type nmap to see the list of options.

Examples:

Ping every host in a range of IPs (in this case from 192.168.1.1 to 192.168.1.200):

nmap -sP 10.1.1.1-200

Scan available ports/services in a range of IPs:

nmap 192.168.1.1-255

Option -O helps identifying the brand of each active device. It looks up which OS could be running on each IP and in addition looks up the vendor of that network interface, which could be the most useful information if you are looking for the IP of a specific device:

sudo nmap -O 192.168.1.1-255

[...]
MAC Address: 00:21:29:C6:27:24 (Cisco-Linksys)
Device type: general purpose
Running: Linux 2.4.X
OS details: Linux 2.4.18 - 2.4.37 (likely embedded)
Network Distance: 1 hop
[...]

Hope this post saves time.

Wednesday, November 2, 2011

Problem connecting to hidden networks

A laptop running kubuntu was unable to connect to wireless hidden networks after an upgrade. After a search for solutions to overcome this bug I found a simple one here. In the network management go to Manage Connections and in the wireless tab add a connection with the details of your hidden network (use the opportunity to delete all the other or cleanup), apply and close. In a terminal call iwlist as root:
sudo iwlist wlan0 scanning essid BITOQUE
Where in this example BITOQUE was the SSID of the network I wanted to connect to. After that you just click network manager and tell it to use the connection just created.

Sunday, August 8, 2010

How to recover lost photos from a memory card (CF) - linux

This post describes a straightforward way to recover lost or deleted files from hard drives or memory cards using photorec in linux (SuSE 11.2). Photorec is one of many programs that can be used for this purpose and is available for Linux, Windows or Mac. PhotoRec ignores the filesystem and goes after the underlying data, so it'll work even if your media's filesystem is severely damaged or formatted. Experienced users should just install the program and use it.
This post describes the recovery of photos from a compact flash card.

A photo easily salvaged from the CF card

The Problem

Before the holidays I bought two 16 GB compact flash cards: one Adata (533x), which worked flawlessly; and one takeMS (120x), which failed.

The problematic compact flash card

After some photos with a Canon Rebel XTi (Canon 400D), the camera displayed something like "CF card error" and suggested replacing the card. I removed and re-inserted the card, and turned the Canon back on. The result was the apparent disappearance of all the photos (the message "NO IMAGES"). To avoid losing data the card was no longer used. I later tried to mount it on a PC but no files were found. The camera continued working fine with other cards.

The Preparation

  • Installing PhotoRec
    Use YaST -> software management to search for and install package "photorec".

  •  

  • Making a disk image (optional)
    To be on the (very) safe side, an image of the card was made. With photorec you can, in principle, bypass this step since it will never attempt to write to the drive or memory support from which lost data is recovered.
    Make a copy of the whole drive and not of a partition. Check that enough space is available to save the image file (in this case 16GB) and note that the operation can take quite a long time, depending on your drive and system (increase bs for speed, e.g. bs=64k or bs=1M). Using command dd:

    user@linux:~> sudo dd if=/dev/sdc of=takeMS_cf.img bs=512
    29818656+0 records in 29818656+0 records out 15267151872 bytes (15 GB) copied, 13988.5 s, 1.1 MB/s

    In linux once a drive has been partitioned, the partitions will be represented as numbers at the end of the drive names. To determine which device name your drive or card has you might be able to use mount. In my case the output of mount included the following line:
    /dev/sdc1 on /media/EOS_DIGITAL type vfat (rw,nosuid,nodev,uid=1000,utf8,shortname=mixed,flush)
    So the card's device name would be /dev/sdc.
    An alternative using SuSE linux is to check the hardware information in YaST->Hardware Information, check the "CF reader" in the Disk section.

The Recovery (step by step)

To recover the lost files just run photorec on the image or mounted drive.

user@linux:~> /usr/sbin/photorec /log takeMS_cf.img

PhotoRec leads you through a number of screens that are straightforward as shown below (see here another example).

Select the image file as media
(run the command as superuser if you did not create an image)

Select the partition table type (INTEL here)

Select here what will be searched.

In my case, searching both the single partition or the whole disk resulted in exactly the same files being recovered.
You can also change options or disable identification of some file types in this screen (which you probably do not want to do: In this example cr2 files were correctly recovered even if the extension was not exactly the one in the list: crw).

Here you are asked how the files were originally stored.

Next PhotoRec asks for a location to save the recovered files. I had created a new folder named "recover".

Press Y to confirm the location and the search starts

Snapshot during the search (includes estimated time)

The final report

In the end PhotoRec tells you how many files of each of the recognised types were recovered (although it reports tiff for cr2 files). The original names are not recovered but PhotoRec correctly recovered the correct file extensions in my photos (cr2 and jpg). Thanks PhotoRec!

Wednesday, August 12, 2009

Accessing the Freecom MusicPal (telnet)

This is the first post dealing with (hacking) the Freecom MusicPal - an internet radio which runs Linux. The MusicPal is so nice that it soon got popular with friends and my radio has now a number of cousins. It is light, looks good, and is busy either with live radio or podcast/RSS. The sound quality can be fully appreciated when connected to a stereo.

Freecom MusicPal

Freecom MusicPal

A great place to learn is MyMusicPal (thanks!). Some of the documents there are in German. Whatever is used here will be translated.

Starting the telnet daemon

My MusicPal currently runs version 1.59d of the firmware. Since version 1.58 there is the possibility to start the telnetd program (telnet daemon). This only possible from an address that exists for the purposes of debugging.

Start by logging into the web interface and in your browser window replace the address following the IP address (or the hostname used for musicpal) with /admin/cgi-bin/debug.cgi. In my case:

http://192.168.1.6/admin/cgi-bin/debug.cgi

The right frame of the interface will give you an idea of the system status. The top part will look somewhat like this:

Scrolling down you will find the option to start telnetd.

tick box so that telnetd can be started

Connecting to the MusicPal

Everything should be in place to telnet to the MusicPal with whatever telnet client you have. If you run Linux or Mac OS X, just use the telnet in a terminal. As you can see form the next image, the root account is not protected by a password (even if there was a password telnet offers no protection anyway), so you should not start the telnetd of your radio in an insecure network.

telnet session in the MusicPal internet radio.

Comfortable shell access in the MusicPal! Thank you Freecom.

Friday, August 7, 2009

Skype with the Logitech Quickcam Pro 5000

Some owners of this webcam face problems and report that it does not work with Skype for Linux. It does work. It is a problem with Skype and the solution in this post applies to many other cameras.

A previous post shows how to install the camera under Linux (openSUSE 10.3 and 11.0).

The latest Skype for Linux (version 2.0.0.72) dates from June 2008. Skype did not release any updates. A post in January 2009 announced that Skype for Linux is definitely not dead [...] Stay tuned for more developments. The next post on 31st of July 2009 says: can’t make any promises about when it’ll be released, but watch this blog for further updates. How many popular open source projects get no updates during an entire year? Skype is not open source and no one can fix even simple bugs. That's why.

[Update: Also works under SuSe 11.2 and the new skype version 2.1.0.47. For microphone issues see here]

How to solve it

The solution only takes one command but a detailed explanation could be useful for beginers:

  1. Install or test the webcam (see the previous post).

  2. Close skype if it is running (CTRL-Q)

  3. Open konsole, xterm or any terminal (e.g. from the menu under System->Terminal).

  4. Start skype from the terminal (so that any error messages appear there)

    user@host:~> skype
  5. In Skype select Options -> Video Devices.

     
  6. Confirm that your webcam is selected. If you have several devices select the webcam.

  7. Press "Test"

    If you see the image from the camera, great. Most likely you see only black, green, white or something else that you do not regard as a success. The terminal might also show errors such as:

    Skype V4L2: Could not find a suitable capture format

    Skype Xv: No suitable overlay format found

  8. Quit skype (or simply use CTRL-C in the terminal)

    What is the problem?

    The newer Linux kernels support many webcam drivers but the legacy Video4Linux API has been dropped and only Video4Linux version 2 is supported. Since skype 2.0.0.72 uses Video4Linux version 1, there is an incompatibility.

    What is the solution?

    The solution is to dynamically load a shared library that provides compatibility between version 1 and 2. Theses libraries are now in your system but the paths depend on the distribution (try "locate v4l2convert.so" or use a find utility to locate v4l2convert.so and v4l1compat.so). If you run a 64bit system use the 32bit version of the library with skype.

  9. Start skype from the terminal with one of the following commands (these are paths for SuSE. Both worked.):

    me@host:~> LD_PRELOAD=/usr/lib/libv4l/v4l1compat.so skype

    me@host:~> LD_PRELOAD=/usr/lib/libv4l/v4l2convert.so skype

    Repeat steps 5-7 and it should work.

Increase your confort

Here are three possibilities to avoid having to type the command. The first method is the favorite and incidentally the only one which works in any normal circumstance (the others fail if you leave to your window manager to restore the last session on login).

  • Add the following line to either one of .bashrc or .xinitrc in your home directory (if there is no .xinitrc, you can make a copy of .xinitrc.template and edit the section "# Add your own lines here...").

    export LD_PRELOAD=/usr/lib/libv4l/v4l2convert.so

    Or if your LD_PRELOAD variable is already set:

    export LD_PRELOAD="/usr/lib/libv4l/v4l2convert.so $LD_PRELOAD"

    Since either with .bashrc or .xinitrc the variable will be set before the session is restored, Skype will start with the compatibility library in place :-).

  • If you start skype from a shell, an alias can be crated by adding a line such as the following to .bashrc.

    alias skype='LD_PRELOAD=/usr/lib/libv4l/v4l2convert.so skype'

    Next type you type skype the alias will be used.

  • If you launch Skype from the KDE menu, locate the icon in the application menu and right click on it. Choose "Edit Item" and replace "skype" with:

    LD_PRELOAD=/usr/lib/libv4l/v4l2convert.so skype

    Do not forget to save the change. If there is a Skype button in the Pannel, just edit it and also replace the command there.

Wednesday, August 5, 2009

Logitech Quickcam Pro 5000 on SuSE Linux

To replace a Phillips ToUcam Pro which broke after being squeezed too hard into its "egg case" we got an unidentified second-hand webcam. With a flexible mount, it fits easily any screen but did not work out-of-the box either under Linux or XP.

This post describes the steps to install the camera under Linux and the next post explains a trick to make it work with the "latest" skype video (version 2.0.0.72).

Logitech Quickcam Pro 5000

We use openSUSE (tested on 10.3 and 11.0) but it is trivial to make it work with other popular distributions (e.g. Ubuntu, etc) by using their package installation tools.

[Update: Tested also on SuSE 11.2]

1. Does the device connect to a USB bus?

USB devices may be listed with the command lsusb. After the webcam is connected to a usb port the result of lsusb should include one more line. In my case:
Bus 003 Device 005: ID 046d:08c5 Logitech, Inc.
So, this webcam identifies itself as 046d:08c5. From this it was possible to identify the model of the our webcam. Many people have a version of the Quickcam Pro 5000 reporting another ID:
Bus 001 Device 003: ID 046d:08ce Logitech, Inc. QuickCam Pro 5000
Anyway, if you see one of these your webcam is connected.

2. Installing the UVC drivers

As can be seen from the devices page from the Quickcam Team, the Quickcam Pro 5000 is a USB Video Class (UVC) compatible camera device (there are compatibility issues with some USB controllers).

[You might need to select a repository of drivers for webcams. In YaST->Community Repositories, select "openSUSE BuildService - Drivers for webcams"]

To install the driver in SuSE open YaST->Software Management (search with "uvc" for convenience) and install packages uvcvideo (choose the one for your kernel, usually uvcvideo-kmp-default) and luvciew (useful to test the camera). You will also need packages related to Video4linux. We have libv4l and v4l-conf installed (in YaST search "v4L" and install if necessary):

3. Testing

After rebooting, connect the webcam and run luvcview from a terminal. You should see a window such as this (after removing the lens cap and pointing the webcam to a postcard from London :-)

Photo of the luvcview window (not true image quality).

That's it! The Logitech Quickcam Pro 5000 is now working.