Investigating USB
git-svn-id: https://spexeah.com:8443/svn/Asuro@260 6dbc8c32-bb84-406f-8558-d1cf31a0ab0c
This commit is contained in:
Binary file not shown.
Binary file not shown.
BIN
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -410,6 +410,11 @@ begin
|
||||
if tmp.class_code = 3 then begin
|
||||
console.writestringln('-Device is DISPLAY_CONTROLLER ');
|
||||
end;
|
||||
if tmp.class_code = $0C then begin
|
||||
if tmp.subclass_class = $03 then begin
|
||||
console.writestringln('-Device is USB Controller');
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
//psleep(300);
|
||||
|
||||
+80
-3
@@ -14,16 +14,93 @@ interface
|
||||
uses
|
||||
console,
|
||||
util,
|
||||
isr44;
|
||||
isr44,
|
||||
lmemorymanager,
|
||||
strings;
|
||||
|
||||
type
|
||||
PMousePacket = ^TMousePacket;
|
||||
TMousePacket = record
|
||||
x_movement : byte;
|
||||
y_movement : byte;
|
||||
y_overflow : boolean;
|
||||
x_overflow : boolean;
|
||||
y_sign : boolean;
|
||||
x_sign : boolean;
|
||||
MMB_Down : Boolean;
|
||||
RMB_Down : Boolean;
|
||||
LMB_Down : Boolean;
|
||||
end;
|
||||
|
||||
procedure init();
|
||||
|
||||
implementation
|
||||
|
||||
procedure callback(packet : void);
|
||||
procedure callback(raw : void);
|
||||
var
|
||||
packet : PMousePacket;
|
||||
x, y, f : byte;
|
||||
r : pchar;
|
||||
|
||||
begin
|
||||
packet:= PMousePacket(kalloc(sizeof(TMousePacket)));
|
||||
f:= (uint32(raw) AND $FF000000) SHR 24;
|
||||
x:= (uint32(raw) AND $00FF0000) SHR 16;
|
||||
y:= (uint32(raw) AND $0000FF00) SHR 8;
|
||||
packet^.x_movement:= x;
|
||||
packet^.y_movement:= y;
|
||||
packet^.y_overflow:= (f AND $80) = $80;
|
||||
packet^.x_overflow:= (f AND $40) = $40;
|
||||
packet^.y_sign:= (f AND $20) = $20;
|
||||
packet^.x_sign:= (f AND $10) = $10;
|
||||
packet^.MMB_Down:= (f AND $4) = $4;
|
||||
packet^.RMB_Down:= (f AND $2) = $2;
|
||||
packet^.LMB_Down:= (f AND $1) = $1;
|
||||
//Do Hook here
|
||||
// console.writestring('X Movement: ');
|
||||
// console.writeintln(packet^.x_movement);
|
||||
|
||||
// console.writestring('Y Movement: ');
|
||||
// console.writeintln(packet^.y_movement);
|
||||
|
||||
// console.writestring('Y Overflow: ');
|
||||
// r:= boolToString(packet^.y_overflow, true);
|
||||
// console.writestringln(r);
|
||||
// kfree(void(r));
|
||||
|
||||
// console.writestring('X Overflow: ');
|
||||
// r:= boolToString(packet^.x_overflow, true);
|
||||
// console.writestringln(r);
|
||||
// kfree(void(r));
|
||||
|
||||
// console.writestring('Y Sign: ');
|
||||
// r:= boolToString(packet^.y_sign, true);
|
||||
// console.writestringln(r);
|
||||
// kfree(void(r));
|
||||
|
||||
// console.writestring('X Sign: ');
|
||||
// r:= boolToString(packet^.x_sign, true);
|
||||
// console.writestringln(r);
|
||||
// kfree(void(r));
|
||||
|
||||
// console.writestring('Middle Button Down: ');
|
||||
// r:= boolToString(packet^.MMB_Down, true);
|
||||
// console.writestringln(r);
|
||||
// kfree(void(r));
|
||||
|
||||
// console.writestring('Right Button Down: ');
|
||||
// r:= boolToString(packet^.RMB_Down, true);
|
||||
// console.writestringln(r);
|
||||
// kfree(void(r));
|
||||
|
||||
// console.writestring('Left Button Down: ');
|
||||
// r:= boolToString(packet^.LMB_Down, true);
|
||||
// console.writestringln(r);
|
||||
// kfree(void(r));
|
||||
|
||||
kfree(void(packet));
|
||||
//console.writestring('Mouse Packet: ');
|
||||
//console.writehexln(DWORD(packet));
|
||||
//console.writehexln(DWORD(raw));
|
||||
end;
|
||||
|
||||
procedure init();
|
||||
|
||||
@@ -34,6 +34,7 @@ var
|
||||
begin
|
||||
//writechar('!'); // Bug traces all the way back to here - when the keyboard randomly doesn't work, this inturrupt isn't even called...
|
||||
// This needs further investigation... Is there something that can go wrong when setting up the PIC?
|
||||
CLI;
|
||||
b:= inb($60);
|
||||
//console.writehexln(b);
|
||||
for i:=0 to MAX_HOOKS-1 do begin
|
||||
|
||||
+18
-3
@@ -25,7 +25,7 @@ implementation
|
||||
|
||||
var
|
||||
Hooks : Array[1..MAX_HOOKS] of pp_hook_method;
|
||||
Cycle : uint8 = 0;
|
||||
Cycle : uint32 = 0;
|
||||
Mouse_Byte : Array[0..2] of uint8;
|
||||
Packet : uint32;
|
||||
|
||||
@@ -65,12 +65,27 @@ end;
|
||||
procedure Main(); interrupt;
|
||||
var
|
||||
i : integer;
|
||||
b : byte;
|
||||
|
||||
begin
|
||||
Mouse_Byte[Cycle]:= mouse_read;
|
||||
inc(Cycle);
|
||||
b:= mouse_read;
|
||||
if Cycle = 0 then begin
|
||||
if (b AND $08) = $08 then begin
|
||||
Mouse_Byte[Cycle]:= b;
|
||||
inc(Cycle);
|
||||
end;
|
||||
end else begin
|
||||
Mouse_Byte[Cycle]:= b;
|
||||
inc(Cycle);
|
||||
end;
|
||||
if Cycle > 2 then begin
|
||||
Cycle:= 0;
|
||||
// console.writestring('Packet[0]: ');
|
||||
// console.writeintln(Mouse_Byte[0]);
|
||||
// console.writestring('Packet[1]: ');
|
||||
// console.writeintln(Mouse_Byte[1]);
|
||||
// console.writestring('Packet[2]: ');
|
||||
// console.writeintln(Mouse_Byte[2]);
|
||||
Packet:= (Mouse_Byte[0] SHL 24) OR (Mouse_Byte[1] SHL 16) OR (Mouse_Byte[2] SHL 8) OR ($FF);
|
||||
for i:=0 to MAX_HOOKS-1 do begin
|
||||
if uint32(Hooks[i]) <> 0 then Hooks[i](void(Packet));
|
||||
|
||||
@@ -25,6 +25,7 @@ function stringConcat(str1, str2 : pchar) : pchar;
|
||||
function stringContains(str : pchar; sub : pchar) : boolean;
|
||||
function stringToInt(str : pchar) : uint32;
|
||||
function intToString(i : uint32) : pchar;
|
||||
function boolToString(b : boolean; ext : boolean) : pchar;
|
||||
|
||||
implementation
|
||||
|
||||
@@ -150,4 +151,26 @@ begin
|
||||
intToString:= ' ';
|
||||
end;
|
||||
|
||||
function boolToString(b : boolean; ext : boolean) : pchar;
|
||||
var
|
||||
t : pchar;
|
||||
f : pchar;
|
||||
|
||||
begin
|
||||
if ext then begin
|
||||
t:= stringCopy('true');
|
||||
f:= stringCopy('false');
|
||||
end else begin
|
||||
t:= stringCopy('1');
|
||||
f:= stringCopy('0');
|
||||
end;
|
||||
if b then begin
|
||||
kfree(void(f));
|
||||
boolToString:= t;
|
||||
end else begin
|
||||
kfree(void(t));
|
||||
boolToString:= f;
|
||||
end;
|
||||
end;
|
||||
|
||||
end.
|
||||
+2
-1
@@ -106,6 +106,7 @@ function getParam(index : uint32; params : PParamList) : pchar;
|
||||
var
|
||||
result : pchar;
|
||||
search : PParamList;
|
||||
i : uint32;
|
||||
|
||||
begin
|
||||
result:= nil;
|
||||
@@ -182,7 +183,7 @@ end;
|
||||
procedure test(params : PParamList);
|
||||
begin
|
||||
if paramCount(params) > 0 then begin
|
||||
console.writeintln(stringToInt(params^.next^.param));
|
||||
console.writeintln(stringToInt(getParam(0, params)));
|
||||
end else begin
|
||||
console.writestringln('Invalid number of params');
|
||||
end;
|
||||
|
||||
Reference in New Issue
Block a user