which one is the best way to create a device driver?

I need to develop a device driver for a keyboard. But I need the common
keyboard to work together.
So, should I add our keyboard to existing devi-hirun, or should I create
another devi-* driver and just add our keyboard to it? On second choice, if
it will just have one type of device (our keyboard) is it possible to create
just one small code with both device and protocol together? How? Would
anyone here give me an example on how to do this?


Regards,

Ricardo K. Ashikawa

I forgot to tell what exactly I am trying to do…

I have a keyboard mapped to IO. So, I do some outp’s to each column and do
some inp’s to check which keys are pressed.
I intend to code something like a devi-hirun that would someway know that a
key was pressed and create a key event.
However, I do not have a clue on how should I do this…

I coded it way around and it is working, but I would like to know if there
is a better way to do this.
I created a thread that was awaken when a key is pressed. And this thread
create a photon key event.
Is there a way to create key event even outside photon, just like a common
keyboard? Do I need to create my own devc-con? Is it possible? Is there a
way to create my own /dev/kbd so that I can attach to devi-hirun?


Thanks,

Ricardo K. Ashikawa

If I understand you correctly, you just have to create new device level
module for devi-hirun. If you have DDK sources, just make a copy of kbddev.c
and modify its reset and input functions (maybe a little bit more, but what
else should be clear from your hardware specification). Then just add the
name of new module in main.c and you are ready to use your new driver. It’s
quite simple :slight_smile:)

Alex Chapiro

“Ricardo Kazumi Ashikawa” <ashikawa@dixtal.com.br> wrote in message
news:9odq5n$dd8$1@inn.qnx.com

I forgot to tell what exactly I am trying to do…

I have a keyboard mapped to IO. So, I do some outp’s to each column and do
some inp’s to check which keys are pressed.
I intend to code something like a devi-hirun that would someway know that
a
key was pressed and create a key event.
However, I do not have a clue on how should I do this…

I coded it way around and it is working, but I would like to know if there
is a better way to do this.
I created a thread that was awaken when a key is pressed. And this thread
create a photon key event.
Is there a way to create key event even outside photon, just like a common
keyboard? Do I need to create my own devc-con? Is it possible? Is there a
way to create my own /dev/kbd so that I can attach to devi-hirun?


Thanks,

Ricardo K. Ashikawa

Thanks for our reply!

Good news! However, if I create another kbddev with another name, how will I
be able to call this new kbddev?
I also need to check our keyboard from time to time (a 10 ms interrupt to
check each column). Is it possible?



Thanks!

Ricardo K. Ashikawa

If I understand you correctly, you just have to create new device level
module for devi-hirun. If you have DDK sources, just make a copy of
kbddev.c
and modify its reset and input functions (maybe a little bit more, but
what
else should be clear from your hardware specification). Then just add the
name of new module in main.c and you are ready to use your new driver.
It’s
quite simple > :slight_smile:> )

Alex Chapiro

I forgot to tell what exactly I am trying to do…

I have a keyboard mapped to IO. So, I do some outp’s to each column and
do
some inp’s to check which keys are pressed.
I intend to code something like a devi-hirun that would someway know
that
a
key was pressed and create a key event.
However, I do not have a clue on how should I do this…

I coded it way around and it is working, but I would like to know if
there
is a better way to do this.
I created a thread that was awaken when a key is pressed. And this
thread
create a photon key event.
Is there a way to create key event even outside photon, just like a
common
keyboard? Do I need to create my own devc-con? Is it possible? Is there
a
way to create my own /dev/kbd so that I can attach to devi-hirun?


Thanks,

Ricardo K. Ashikawa

As I mentioned before, you have insert new driver name (for instance
new-kbddev) into the table in main.c. Then you can start one or both modules
using your new devi-hirun-new resource manager:

devi-hirun-new kbd fd -d/dev/kbd kbd new-kbddev

or

devi-hirun-new kbd kbddev kbd new-kbddev

etc.

“Ricardo Kazumi Ashikawa” <ashikawa@dixtal.com.br> wrote in message
news:9og8tr$s80$1@inn.qnx.com

Thanks for our reply!

Good news! However, if I create another kbddev with another name, how will
I
be able to call this new kbddev?
I also need to check our keyboard from time to time (a 10 ms interrupt to
check each column). Is it possible?



Thanks!

Ricardo K. Ashikawa

If I understand you correctly, you just have to create new device level
module for devi-hirun. If you have DDK sources, just make a copy of
kbddev.c
and modify its reset and input functions (maybe a little bit more, but
what
else should be clear from your hardware specification). Then just add
the
name of new module in main.c and you are ready to use your new driver.
It’s
quite simple > :slight_smile:> )

Alex Chapiro

I forgot to tell what exactly I am trying to do…

I have a keyboard mapped to IO. So, I do some outp’s to each column
and
do
some inp’s to check which keys are pressed.
I intend to code something like a devi-hirun that would someway know
that
a
key was pressed and create a key event.
However, I do not have a clue on how should I do this…

I coded it way around and it is working, but I would like to know if
there
is a better way to do this.
I created a thread that was awaken when a key is pressed. And this
thread
create a photon key event.
Is there a way to create key event even outside photon, just like a
common
keyboard? Do I need to create my own devc-con? Is it possible? Is
there
a
way to create my own /dev/kbd so that I can attach to devi-hirun?


Thanks,

Ricardo K. Ashikawa