| 125 | } |
| 126 | |
| 127 | ssize_t Read(size_t offset, size_t size, uint8_t *buffer){ |
| 128 | if(size < sizeof(MousePacket)) return 0; |
| 129 | |
| 130 | if(packetCount <= 0) return 0; // No packets |
| 131 | |
| 132 | MousePacket* pkt = (MousePacket*)buffer; |
| 133 | *pkt = packetQueue[packetQueueStart]; |
| 134 | |
| 135 | packetQueueStart++; |
| 136 | |
| 137 | if(packetQueueStart >= PACKET_QUEUE_SIZE) { |
| 138 | packetQueueStart = 0; |
| 139 | } |
| 140 | |
| 141 | packetCount--; |
| 142 | |
| 143 | return sizeof(MousePacket); |
| 144 | } |
| 145 | }; |
| 146 | |
| 147 | MouseDevice mouseDev("mouse0"); |
no outgoing calls
no test coverage detected