Page 1 of 1

Mouse driver not working

Posted: Sat Oct 17, 2020 1:17 am
by mrosdev
[post was deleted]

Re: Mouse driver not working

Posted: Sat Oct 17, 2020 9:20 am
by MichaelPetch
I didn't look at the code and logic closely but one observation is that there is 1 byte available to read per mouse interrupt. You should not be reading 3 bytes at a time the way you are doing it.

Re: Mouse driver not working

Posted: Sat Oct 17, 2020 9:58 am
by mrosdev
Ok.

Re: Mouse driver not working

Posted: Sat Oct 17, 2020 10:05 am
by BenLunt
As MichaelPetch correctly states, you should only be reading one (1) byte per interrupt. The controller will trigger an interrupt when it has a single byte ready for reading.

Your code must keep track of which byte within the packet is currently being read and update the packet accordingly.

For example, if you have a three byte packet, you start with a PACKET_INDEX of zero. Also, you should have a local (to your interrupt) buffer holding the data, and only sending a fully updated packet to your mouse driver after the last byte has been received.

1) Interrupt Fired
2) Read Byte
3a) if PACKET_INDEX == 0, update button status in local buffer (see note below)
3b) if PACKET_INDEX == 1, update X coord in local buffer
3c) if PACKET_INDEX == 2, update Y coord in local buffer
4) Increment PACKET_INDEX
5) if PACKET_INDEX == 3, send contents of local packet to mouse driver packet, and set PACKET_INDEX to zero
6) exit interrupt

Note: The first byte of the packet sent from the mouse will have a bit indicating that it is the first byte of the packet. You will need to watch for this bit.

Ben
- http://www.fysnet.net/input_and_output_devices.htm

Re: Mouse driver not working

Posted: Sat Oct 17, 2020 10:09 am
by PeterX
HyperCreeck wrote:
MichaelPetch wrote:You should not be reading 3 bytes at a time the way you are doing it.
As I mentioned at the top of the post, the mouse driver was from the basekernel project. I didn't make it and I don't know anything about mouse driver programming.
If you don't know anything about mouse driver programming, why are you trying to fix a mouse driver??? #-o

Why should we bother to help you if you don't show any interest?

Re: Mouse driver not working

Posted: Sat Oct 17, 2020 10:14 am
by iansjack
As you have based your OS on someone else's work, I wonder if it would be polite to at least acknowledge that - and provide a link to that original work - in your project. And I'm not sure you can put a copyright notice claiming the copyright for yourself, in code that you didn't write and don't understand.

Re: Mouse driver not working

Posted: Sun Oct 18, 2020 2:31 am
by mrosdev
PeterX wrote:If you don't know anything about mouse driver programming, why are you trying to fix a mouse driver??? #-o
PeterX, I need mouse driver for making GUI.

Re: Mouse driver not working

Posted: Sun Oct 18, 2020 2:32 am
by mrosdev
iansjack wrote:As you have based your OS on someone else's work, I wonder if it would be polite to at least acknowledge that - and provide a link to that original work - in your project.
Sorry, I forgot to do that. Here's the link to the original basekernel project.

Re: Mouse driver not working

Posted: Sun Oct 18, 2020 4:35 am
by PeterX
HyperCreeck wrote:
PeterX wrote:If you don't know anything about mouse driver programming, why are you trying to fix a mouse driver??? #-o
PeterX, I need mouse driver for making GUI.
OK, that's fine. But how do you expect do fix your mouse driver without learning first how to program a mouse driver? It seems impossible to me.

Greetings
Peter

Re: Mouse driver not working

Posted: Sun Oct 18, 2020 4:51 am
by iansjack
I think you miss my point.

1. You should provide a very prominent acknowledgement in your source code to the work that it is derivative of (if it is derivative rather than just a direct steal). That way anyone looking at it can see the connection.

2. Far more serious. You are claiming copyright on material that is already copyrighted by someone else. For example, your file "bitmap.c" is identical to the original "bitmap.c". The only difference is that you have removed the original copyright notice and inserted your own. That's known as plagiarism.

I haven't been through your code file by file, but I suspect that most of it is identical to the original work. You can't just claim this as your own work - that's immoral, and probably illegal.

You should read the Licence of the original work and ensure that you conform with all the conditions stated in that licence. You have failed to do so.

Re: Mouse driver not working

Posted: Sun Oct 18, 2020 8:27 am
by mrosdev
@iansjack, I understand what you said, so I deleted that project permanently (Including the repository and documentation). (BTW I changed my name to mrosdev because I like that name).