OSDev.org

The Place to Start for Operating System Developers
It is currently Wed Nov 25, 2020 10:34 pm

All times are UTC - 6 hours




Post new topic Reply to topic  [ 11 posts ] 
Author Message
 Post subject: Mouse driver not working
PostPosted: Sat Oct 17, 2020 1:17 am 
Offline
Member
Member

Joined: Mon Jun 01, 2020 8:15 am
Posts: 28
[post was deleted]


Last edited by mrosdev on Sun Oct 18, 2020 7:20 am, edited 1 time in total.

Top
 Profile  
 
 Post subject: Re: Mouse driver not working
PostPosted: Sat Oct 17, 2020 9:20 am 
Offline
Member
Member

Joined: Fri Aug 26, 2016 1:41 pm
Posts: 589
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.


Top
 Profile  
 
 Post subject: Re: Mouse driver not working
PostPosted: Sat Oct 17, 2020 9:58 am 
Offline
Member
Member

Joined: Mon Jun 01, 2020 8:15 am
Posts: 28
Ok.


Last edited by mrosdev on Sun Oct 18, 2020 7:41 am, edited 2 times in total.

Top
 Profile  
 
 Post subject: Re: Mouse driver not working
PostPosted: Sat Oct 17, 2020 10:05 am 
Offline
Member
Member
User avatar

Joined: Sat Nov 22, 2014 6:33 pm
Posts: 744
Location: USA
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


Top
 Profile  
 
 Post subject: Re: Mouse driver not working
PostPosted: Sat Oct 17, 2020 10:09 am 
Offline
Member
Member
User avatar

Joined: Fri Nov 22, 2019 5:46 am
Posts: 432
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?

_________________
https://wiki.osdev.org/User:PeterX


Top
 Profile  
 
 Post subject: Re: Mouse driver not working
PostPosted: Sat Oct 17, 2020 10:14 am 
Offline
Member
Member
User avatar

Joined: Sat Mar 31, 2012 3:07 am
Posts: 3994
Location: Chichester, UK
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.


Top
 Profile  
 
 Post subject: Re: Mouse driver not working
PostPosted: Sun Oct 18, 2020 2:31 am 
Offline
Member
Member

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


Top
 Profile  
 
 Post subject: Re: Mouse driver not working
PostPosted: Sun Oct 18, 2020 2:32 am 
Offline
Member
Member

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


Top
 Profile  
 
 Post subject: Re: Mouse driver not working
PostPosted: Sun Oct 18, 2020 4:35 am 
Offline
Member
Member
User avatar

Joined: Fri Nov 22, 2019 5:46 am
Posts: 432
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

_________________
https://wiki.osdev.org/User:PeterX


Top
 Profile  
 
 Post subject: Re: Mouse driver not working
PostPosted: Sun Oct 18, 2020 4:51 am 
Offline
Member
Member
User avatar

Joined: Sat Mar 31, 2012 3:07 am
Posts: 3994
Location: Chichester, UK
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.


Top
 Profile  
 
 Post subject: Re: Mouse driver not working
PostPosted: Sun Oct 18, 2020 8:27 am 
Offline
Member
Member

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


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 11 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: Bing [Bot], Google [Bot] and 10 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group