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

Wednesday, May 1, 2013

how to setup hp 4625 deskjet ink advantage all-in-one printer in ubuntu 13.04

straight to the point .

i have connected my hp 4625 and my lenovo thinkpad t420 running ubuntu 13.04 to a netgear router.

its an amazing printer with excellent print and scan quality.never used the fax feature though.works absolutely fine over usb and wifi.I am a hobby photographer (AmeerIrshadPhotography )  so i tried printing my pics on a photo quality/glossy paper and the results are stunning.
now lets get into the business of configuring this printer in ubuntu 13.04
for the first time you print the printer feature would just work fine in ubuntu .just go to "printer" option .click on add and click on network you will  get a dialog box something like this after clicked on find ->network printer



click on forward and it will give you an option to print a test page.and the printer just worked fine over wifi..

now i kept the test page on the scanner to configure the same.

Scanner setup :

open the terminal and type

sudo hp-setup 
and give your password

and follow the below steps.....its advised to keep your printer connected over usb though you are configuring for "over wifi scanning"


and your hp will get detected in the next step



 connection details





and its almost done here



use any scanning utility and try scanning .remember i had kept my test page in the scanning area and it scanned just fine


please dont mind the scanned image quality as i used very low dpi for a quicker scan to update this blog.



Hope you guys found it useful.comment if you have any queries or suggestions.and sorry for the short language and descriptions used.

-Ameer Irshad

Sunday, June 22, 2008

free software song

http://en.wikipedia.org/wiki/Free_Software_Song

http://www.gnu.org/music/writing-fs-song.html

Join us now and share the software;
You'll be free, hackers, you'll be free.

Hoarders may get piles of money,
That is true, hackers, that is true.
But they cannot help their neighbors;
That's not good, hackers, that's not good.

When we have enough free software
At our call, hackers, at our call,
We'll throw out those dirty licenses
Ever more, hackers, ever more.

Join us now and share the software;
You'll be free, hackers, you'll be free.

:)

Tuesday, April 8, 2008

linux kernel module

there are many tutorials on how to write a basic kernel module..
but only a part of ppl succeed in writing and running a proper module..
cos there are various reasons which may lead to failure ..like ur distribution,the path where you have placed your kernel source directories,kernel versions,etc,etc..
k..in this post am gonna present a basic kernel module which will print "hello " when inserted into the kernel and "bye " when you remove it from the kernel..
here we go!!
requisites:
kernel 2.6.*
i have checked this on redhat,fedora and debian..it never ran on a suse box :(
//file name :hello.c

#include
#include
MODULE_LICENSE("Dual BSD/GPL");

static int hello_init(void)
{
printk(KERN_ALERT "hello\n");
return 0;
}
static void hello_exit(void)
{
printk(KERN_ALERT "bye\n");
}

module_init(hello_init);
module_exit(hello_exit);

does this needs an explanation?nyways..the header files asusual..the license which the source supports..here it is dual..supporting both gpl and bsd..
two user-defined functions......hello_init and hello_exit..the names can be nything cos they r user-defined..
u can define the body as ur wish..here i have attempted to print "hello" when the function hello_init is run
and "bye" when hello_exit is run..
as we have printf library function,printk is used to print in the kernel ,i mean used in lkmp..
for kernel versions 2.4.* the syntax of printk was
printk(<1> "hello\n");
i guess..
here <1> denotes the priority..the lower the number the higher the priority.(as we all know :) )
fine..
then we provide two entry points.
1.module_init
2.module_exit
in the first one we ask the hello_init to be executed i.e., module_init(hello_init)
and the same applies for the second one too .................

and now its time to compile and run..
but how?
first write a Makefile
$ vi Makefile
obj-m := hello.o
and save the file

now you gotta compile it..
by using the make command with -C switch
here u hav to mention the path where u have compiled the kernel source(oops i forgot to tell how to compile the kernel source..k..in the next post for sure :) )
in my comp and most of the comps the path will be /usr/src/kernels/linux-*
in my comp the command is to be


$ make -C /usr/src/kernels/2.6.23.1-42.fc8-i686 M=$PWD modules

on the terminal u wil get the following:

make: Entering directory `/usr/src/kernels/2.6.23.1-42.fc8-i686'
CC [M] /home/sakthi/lkmp/hello.o
Building modules, stage 2.
MODPOST 1 modules
CC /home/sakthi/lkmp/hello.mod.o
LD [M] /home/sakthi/lkmp/hello.ko
make: Leaving directory `/usr/src/kernels/2.6.23.1-42.fc8-i686'


if u get this then its done :)
if u dont :( pls check the path name and Makefile once..
now if u see the folder where u have ur hello.c u can find the following files:
hello.o
hello.mod.c
hello.ko
hello.mod.o

and now its time to run (execute the .ko file) the module..
hey b4 that u need to change the run level yaar..sometimes if u in gui it wont run..
press ctrl+alt+f1

and now
$insmod ./hello.ko
u will get:
hello

if u check ur /proc/kallsysms file and /proc/modules file u can find ur module name man!!
$cat /proc/kallsymsgrep hello
$cat /proc/modulesgrep hello

and now its time to remove
$rmmod ./hello.ko
bye will be displayed..
to come back to gui.......ctrl+alt+f7
its done..so u have written,compiled,inserted and removed back a proper kernel module successfully :)
try this out..its good..
all the best
Ameer Irshad

Thursday, March 20, 2008

anatomy of device drivers

now that wen i have got a good response for this post on device drivers i wud love to thankyou all and share more..now let us examine the anatomy of the device driver..
i mean the major components of a driver..from my previous post we can percept that device driver is a software with a set of entry
points that can be called by the operating system.it can also contain *data structures private to the driver*references to kernel data structures external to the driver*routines private to the driver..here i dont mean entry points..instead routines..
now let me stop boring you ppl with the theory part and jump into programming.. :) :)
most drivers are written as a single source file or set a set of dependent files and
compiled usign make command..(before that we gotta write the Makefile specifying the order
of compilation of all the .o files)
the initial part of the driver source file is called as a prologue and the rest contains entry points.
the prologue contains the initialization part as most of the .c files are written.
* #include-header files * #define-all the constants used in the driver * all the variable declarations and data structures
as said before the remaining part contains the entry points
like init,exit,open,read,write,close and all
k let me continue in my next post..got some work :(

Friday, March 14, 2008

device drivers

an essential part of the operating system..

a very interesting and challenging subject for system programmers..
device drivers are the programs which allow high-level programs to interact with the hardware..
now all that am going to talk about is device drivers in unix and unix-like os.

in a programmer's point of view there are four types of drivers..
* char drivers(read/write char by char eg..floppy,mouse)
* block drivers(block by block.eg.filesystems..hard drivers)
* terminal drivers(ttys)
* stream drivers(don knw much abt these.neva worked..must be related to stream interface functions)

in unix/linux device drivers can be part of the kernel or can be loadable modules..
modules are the programs which can be loaded into the kernel during run-time..these are generally called

kernel-modules..(refer d book kernel-module programming

u can find many books on linux kernel module programming(lkmp)..but make sure that they deal with kernel 2.6 and above..
cos lkmp slightly differs from 2.4.* to 2.6.*.

after writing the kernel module we can load them into the kernel using the insmod..
if ur module name is hello.c
then u gotta load its .ko
bit4054@VITLINUX$ insmod ./hello.ko


to check whether ur module is loaded or not u can check the name of the loaded module in /proc/modules
just give
bit4054@VITLINUX$ cat /proc/modules

and also u can check for the symbol table in

bit4054@VITLINUX# cat /proc/kallsyms

the above file contains the kernel symbol table..

and to remove the module

bit4054@VITLINUX$ rmmod ./hello.ko

in this way a module is written and loaded into the kernel..

like wise u can write a device driver..
there are few basic operations which are essential in a driver programming..

open()

read()

write()

ioctl()

poll()

close()

but its a very painful task cos u gotta knw about the h/w at the bit-level

there are many APIs that wil help u in writing a driver..and u need good testing environments..
few of the APIs are:


  • Advanced Linux Sound Architecture (ALSA) - The standard modern Linux sound driver interface
  • I/O Kit - an open-source framework from Apple for developing Mac OS X device drivers
  • Installable File System (IFS) - a filesystem API for IBM OS/2 and Microsoft Windows NT
  • Network Driver Interface Specification (NDIS) - a standard network card driver API
  • Open Data-Link Interface (ODI) - a network card API similar to NDIS
  • Scanner Access Now Easy (SANE) - a public domain interface to raster image scanner hardware
  • Uniform Driver Interface (UDI) - a cross platform driver interface project
  • Windows Display Driver Model (WDDM) - the new graphic display driver architecture for Windows Vista
  • Windows Driver Foundation (WDF)
  • Windows Driver Model (WDM)



i have tried writing and running few basic kernel modules but still learning to write device drivers..

u can refer many books linux device drivers alessandro rubini 3rd edition..(note:2nd edition deals only with kernel 2.4.*)

writing unix device drivers.(don remember the author name)..

and am sure this post wil give u a very very basic knowledge on drivers..

linux on IBM's BlueGene

When i was browsing about high performance computing for a seminar i came across links on

blue gene..the fastest super computer from IBM..they announced blue gene in 1999 which was

initially developed to facilitate and speed up scientific research..like..human protein

modelling,etc..now used in various labs for various reasons one among which is nuclear

test simulations

Blue Gene is the successor of deep blue,the super computer which defeated gary kasprov in a chess competition..

• it has 65000 processors..

• speed ranging in petaflops

• one quadrillion operations per second....