Want to read descriptor from the same bootable USB stick

The intent of this forum is to discuss my DOS TSR programs (available at http://bretjohnson.us), how they work and don't work, new/missing features, status of updates, and anything else related to them that may need to be discussed.

Want to read descriptor from the same bootable USB stick

Postby sxbsy_1 » Tue Sep 01, 2009 8:37 am

I am working on a PC system diagnostic software running in DOS, the aim is to scan the motherboard and display the information about hardware and peripheral devices. I use the HP USB format tool and FreeDOS system files to make a bootable USB stick, the diagnostic software run from this bootable USB stick. I just read the descriptor from UHCI controller, below is the method I used:

1.Scan UHCI controller to find the PCI bus, dev, fun and io_address, port status for the USB stick
2. allocate 4K frame address (4K alignment), write Frame Base address register, Frame Number set to 0
3. build the QH and TDs for getting device descriptor

QH --> SetupTD (maxlen = 7, data0, endpoint 0, address 0, PID=SETUP, IOC 0)
--> TD0 (maxlen = 7, data1, endpoint 0, address 0, PID=IN, IOC 0)
--> TD1 (maxlen = 7, data0, endpoint 0, address 0, PID=IN, IOC 0)
--> TD2 (maxlen = 7, data0, endpoint 0, address 0, PID=IN, IOC 0)
--> TD3 (maxlen = 7FFh, data1, endpoint 0, address 0, PID=OUT, IOC 1) (Terminate)
4. Write the physical address of QH to frame list 0
5. enable all interrupts, set HC run
6. wait for interrupt happen,
7. mask all frame list as terminated, finsih reading USB device descriptor.

But the return descriptor is EMPTY, I want to know whether the method I used is right or not, thank you!
sxbsy_1
 
Posts: 3
Joined: Mon Aug 31, 2009 9:58 am

Re: Want to read descriptor from the same bootable USB stick

Postby Bret » Tue Sep 01, 2009 9:30 am

What you're doing is essentially correct, but you're missing a WHOLE BUNCH of steps to do things properly. You are simply disabling the original host controller driver (in the BIOS or the boot manager), and installing your own host driver. Unfortunately, you are not installing a real, complete driver, but are simply issuing a few USB packets. The disk won't work any more after you get done, and the computer will probably crash when you exit your program (if not before).

I think the reason you're not getting a response from the USB device is because it doesn't have address 0 -- it was assigned a real address during the boot process by the BIOS or boot manager driver (probably address 1). You didn't disable or reset the host or the disk like you were supposed to, so the device still remembers it's assigned address.

What you're writing is not a simple diagnostic program -- it is disabling and reconfiguring the entire USB host controller and all devices attached to the bus. A diagnostic program should NEVER do anything like that. I cannot emphasize this enough -- you are doing things that you should NOT be doing.
Bret
 
Posts: 478
Joined: Fri Oct 10, 2008 3:43 am
Location: Rio Rancho, NM


Return to Programs

Who is online

Users browsing this forum: No registered users and 3 guests

cron