Mouse driver not working

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
mrosdev
Member
Member
Posts: 28
Joined: Mon Jun 01, 2020 8:15 am

Mouse driver not working

Post by mrosdev »

[post was deleted]
Last edited by mrosdev on Sun Oct 18, 2020 7:20 am, edited 1 time in total.
MichaelPetch
Member
Member
Posts: 797
Joined: Fri Aug 26, 2016 1:41 pm
Libera.chat IRC: mpetch

Re: Mouse driver not working

Post 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.
mrosdev
Member
Member
Posts: 28
Joined: Mon Jun 01, 2020 8:15 am

Re: Mouse driver not working

Post by mrosdev »

Ok.
Last edited by mrosdev on Sun Oct 18, 2020 7:41 am, edited 2 times in total.
User avatar
BenLunt
Member
Member
Posts: 941
Joined: Sat Nov 22, 2014 6:33 pm
Location: USA
Contact:

Re: Mouse driver not working

Post 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
PeterX
Member
Member
Posts: 590
Joined: Fri Nov 22, 2019 5:46 am

Re: Mouse driver not working

Post 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?
User avatar
iansjack
Member
Member
Posts: 4703
Joined: Sat Mar 31, 2012 3:07 am
Location: Chichester, UK

Re: Mouse driver not working

Post 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.
mrosdev
Member
Member
Posts: 28
Joined: Mon Jun 01, 2020 8:15 am

Re: Mouse driver not working

Post 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.
mrosdev
Member
Member
Posts: 28
Joined: Mon Jun 01, 2020 8:15 am

Re: Mouse driver not working

Post 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.
PeterX
Member
Member
Posts: 590
Joined: Fri Nov 22, 2019 5:46 am

Re: Mouse driver not working

Post 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
User avatar
iansjack
Member
Member
Posts: 4703
Joined: Sat Mar 31, 2012 3:07 am
Location: Chichester, UK

Re: Mouse driver not working

Post 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.
mrosdev
Member
Member
Posts: 28
Joined: Mon Jun 01, 2020 8:15 am

Re: Mouse driver not working

Post 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).
Post Reply