{"id":22911262,"url":"https://github.com/rust-osdev/ps2-mouse","last_synced_at":"2025-07-01T06:32:46.583Z","repository":{"id":47471249,"uuid":"260508293","full_name":"rust-osdev/ps2-mouse","owner":"rust-osdev","description":"Library to manage a PS2 mouse","archived":false,"fork":false,"pushed_at":"2021-08-30T13:57:00.000Z","size":25,"stargazers_count":11,"open_issues_count":3,"forks_count":7,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-06-15T08:50:44.103Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rust-osdev.png","metadata":{"files":{"readme":"README.md","changelog":"Changelog.md","contributing":null,"funding":null,"license":"LICENSE-APACHE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-05-01T16:38:47.000Z","updated_at":"2025-04-30T05:11:00.000Z","dependencies_parsed_at":"2022-08-29T22:30:40.502Z","dependency_job_id":null,"html_url":"https://github.com/rust-osdev/ps2-mouse","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/rust-osdev/ps2-mouse","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rust-osdev%2Fps2-mouse","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rust-osdev%2Fps2-mouse/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rust-osdev%2Fps2-mouse/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rust-osdev%2Fps2-mouse/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rust-osdev","download_url":"https://codeload.github.com/rust-osdev/ps2-mouse/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rust-osdev%2Fps2-mouse/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262912976,"owners_count":23383615,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-12-14T04:15:56.335Z","updated_at":"2025-07-01T06:32:46.545Z","avatar_url":"https://github.com/rust-osdev.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Build Status](https://github.com/rust-osdev/ps2-mouse/workflows/Build/badge.svg)](https://github.com/rust-osdev/ps2-mouse/actions?query=workflow%3ABuild) [![Docs.rs Badge](https://docs.rs/ps2-mouse/badge.svg)](https://docs.rs/ps2-mouse/)\n\n# ps2 mouse\nThis crate provides a basic interface for interacting with a ps2 mouse.\n\n## Basic Example\n```rust\nuse ps2_mouse::{Mouse, MouseState};\nuse spinning_top::Spinlock;\nuse x86_64::instructions::port::PortReadOnly;\n\npub static MOUSE: Lazy\u003cSpinlock\u003cMouse\u003e\u003e = Lazy::new(|| Spinlock::new(Mouse::new()));\n\n// Initialize the mouse and set the on complete event.\nfn init_mouse() {\n    MOUSE.lock().init().unwrap();\n    MOUSE.lock().set_on_complete(on_complete);\n}\n\n// This will be fired when a packet is finished being processed.\nfn on_complete(mouse_state: MouseState) {\n    println!(\"{:?}\", mouse_state);\n}\n\n// An example interrupt based on https://os.phil-opp.com/hardware-interrupts/. The ps2 mouse is configured to fire\n// interrupts at PIC offset 12.\nextern \"x86-interrupt\" fn mouse_interrupt_handler(_stack_frame: \u0026mut InterruptStackFrame) {\n    let mut port = PortReadOnly::new(0x60);\n    let packet = unsafe { port.read() };\n    MOUSE.lock().process_packet(packet);\n\n    unsafe {\n        PICS.lock()\n            .notify_end_of_interrupt(InterruptIndex::Mouse.into());\n    }\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frust-osdev%2Fps2-mouse","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frust-osdev%2Fps2-mouse","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frust-osdev%2Fps2-mouse/lists"}