writing usb and mouse device driver.

I am writing usb device driver and i want some help.
OS that i am using is suse10.2. If i write down complete usb driver what are the extra things that i need to do apart from inserting that module in to kernel (insmod).If i insert my usb driver module in to kernel how can we stop kernel from using previous usb driver and now kernel should use the driver(module) that i have inserted.
Similarly i have also written mouse device driver for ps2 mouse.But i faced the simiar problem.How we should tell to kernel that dont use previous driver for mouse use that i have inserted.
Please Help Me.If i could get way for this i will be able to run both the drivers.

openSUSE 10.2 is no longer supported…you should install the current
version…

anyway, this sounds like school homework to me…

otherwise why would be writing device drivers AND asking those kinds
of questions?

imo the best way to learn is to do/read, not ask…

if i’m wrong, say so…


palladium

Me too, I have my doubts. How can you write a driver if you don’t know how to use it? Part of the job. So, ‘man insmod’, ‘man modprobe’. If you want the system to say “Hello World” on login, merely writing a C program that says “Hello World” is not enough; you’d have to learn how to execute the program at the right moment. i.e. learn about the OS it’s running on. No other way.

ok you told me openSUSE 10.2 is no longer supported. i will use suse11.2. and another thing if writing drivers is school
assignment then answer my question.and that must be easy for you.and asuume that i am in 1st standard and answer accordingly.
To learn reading is best way i know but i stucked at point from where i can not proceed so thats why i am asking

This is a good start:
Writing device drivers in Linux: A brief tutorial

And one of the consequences would be, that you finish your assignment, without knowing why it works. The blame for it not working would evidently be on the openSUSE community.
You wrote the code on 10.2, say you’ll switch to 11.2 just like that?

What I’m trying to point out, is that these forums are for support, not for doing your work. You cannot write linux drivers without knowing a bit of linux. If that’s what’s lacking, tell your teachers you need that first.

I am not asking for writing the complete driver.i just need to know what i could do so that i can make sure insted of using original kernel driver the kernel should use my driver.Because i have written mouse driver.But its not working by doing insmod.I also recompiled kernel by removing original ps2 mouse driver and inserted my driver but still its not working if it is possible what should i do so that my mouse driver will work please help me.
Please anybody tell me how to go for it i will again start from scratch.Also tell which os i should use.And here i will be regularly updating if i stucked any where.But i want my driver to be working.

shinde amit001 wrote:

>
> I am not asking for writing the complete driver.i just need to know what
> i could do so that i can make sure insted of using original kernel
> driver the kernel should use my driver.Because i have written mouse
> driver.But its not working by doing insmod.I also recompiled kernel by
> removing original ps2 mouse driver and inserted my driver but still its
> not working if it is possible what should i do so that my mouse driver
> will work please help me.
> Please anybody tell me how to go for it i will again start from
> scratch.Also tell which os i should use.And here i will be regularly
> updating if i stucked any where.But i want my driver to be working.
>
>
I am myself a software engineer and it is more or less impossible to say why
your driver has problems with insmod without knowing your source code and
what you did step by step. (I do not volunteer to look at it in detail, but
what about discussing it with a colleague or another student? - a code
review).

Knurpht gave you a very nice link to an article (I had a glance at it) which
describes from scratch how to do it - step by step - with comprehensible
examples.

Did you read it - if so, what in detail is unclear if you compare it to what
you did.

Can you really be sure that you have no basic programming errors which make
it impossible to use what you wrote as a driver/kernel module? It is of
course not enough that it compiles without syntax errors.

You have to find out the root cause yourself this is important when trying
to be able to program something (independent what it is).
And if you get stuck at a certain point you need to be able to describe
precisely what goes wrong at which point - your description as rather vague
and general - completely unspecific.