Rev 4530 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 4530 | Rev 4592 | ||
---|---|---|---|
Line 30... | Line 30... | ||
30 | 30 | ||
31 | ; This procedure is called when HID layer detects a new mouse. |
31 | ; This procedure is called when HID layer detects a new mouse. |
32 | ; in: ebx -> device_data from USB layer, edi -> collection |
32 | ; in: ebx -> device_data from USB layer, edi -> collection |
33 | ; out: eax = device-specific data or NULL on error |
33 | ; out: eax = device-specific data or NULL on error |
34 | proc mouse_driver_add_device |
- | |
35 | ; Get screen resolution so we can calculate absolute coordinates. |
- | |
36 | mov eax, 14 |
- | |
37 | int 0x40 |
- | |
38 | mov [screen_y], eax |
- | |
39 | and [screen_y], 0xffff |
- | |
40 | shr eax, 16 |
- | |
41 | mov [screen_x], eax |
34 | proc mouse_driver_add_device |
42 | ; Just allocate memory; no initialization needed. |
35 | ; Just allocate memory; no initialization needed. |
43 | movi eax, sizeof.mouse_device_data |
36 | movi eax, sizeof.mouse_device_data |
44 | call Kmalloc |
37 | call Kmalloc |
45 | ret |
38 | ret |
Line 144... | Line 137... | ||
144 | test byte [esi+report_field_group.flags], HID_FIELD_RELATIVE |
137 | test byte [esi+report_field_group.flags], HID_FIELD_RELATIVE |
145 | jz .unclaimed |
138 | jz .unclaimed |
146 | mov [edi+mouse_device_data.hwheel], edx |
139 | mov [edi+mouse_device_data.hwheel], edx |
147 | ret |
140 | ret |
148 | .absolute_x: |
141 | .absolute_x: |
149 | push ebx |
- | |
150 | mov eax, [screen_x] |
- | |
151 | mul edx |
- | |
152 | mov ebx, 0x8000 |
- | |
153 | div ebx |
- | |
154 | mov [edi+mouse_device_data.dx], eax |
142 | mov [edi+mouse_device_data.dx], edx |
155 | or [edi+mouse_device_data.buttons], 0x80000000 |
143 | or [edi+mouse_device_data.buttons], 0x80000000 |
156 | pop ebx |
- | |
157 | ret |
144 | ret |
158 | .absolute_y: |
145 | .absolute_y: |
159 | push ebx |
- | |
160 | mov eax, [screen_y] |
- | |
161 | mul edx |
- | |
162 | mov ebx, 0x8000 |
- | |
163 | div ebx |
- | |
164 | mov [edi+mouse_device_data.dy], eax |
146 | mov [edi+mouse_device_data.dy], edx |
165 | or [edi+mouse_device_data.buttons], 0x40000000 |
147 | or [edi+mouse_device_data.buttons], 0x40000000 |
166 | pop ebx |
- | |
167 | ret |
148 | ret |
168 | endp |
149 | endp |
Line 169... | Line 150... | ||
169 | 150 | ||
170 | ; This procedure is called when HID layer ends processing a new input packet |
151 | ; This procedure is called when HID layer ends processing a new input packet |