USBDDOS not working on a Mac Mini 2011 (Intel Sandy Bridge CPU)
Unfortunately, USBDDOS hangs on the Mac Mini 2011 as well. Albeit in a different way than on the AMD system I was testing with the other day. This time, it doesn't even get to the error about the C: drive no longer being accessible. But it still hangs.
I tried it twice: the first time I had a USB keyboard, a USB mouse, the USB drive that I was booting FreeDOS and USBDDOS on attached, as well as a USB wifi dongle.
The second time I tried it without the USB wifi donge plugged in. So at that point, there were two HID devices connected (the keyboard and the mouse), as well as a USB Mass Storage device (the USB drive that I was booting the system with).
In both attempts, the result appeared the same.
Attaching the video below. Note that the debug logging scrolls by pretty quickly, so you'll probably have to analyze it frame by frame if you need the earlier log lines at the beginning. Towards the end of the video, you can hear me mashing on the keyboard again, and as you can see, the system remains frozen.
Hopefully, this is information is useful to you.
https://github.com/crazii/USBDDOS/assets/518023/beb8fa20-d01d-4b22-813a-9660a3010b18
It doesn't find any USB devices this time (weird), and also crashed on program exiting, I probably need to test it on FreeDOS to check if it crahes.
Perhaps it has something to do with the fact that the on-board UHCI controller is not a companion controller of the EHCI controller and all the external USB ports on this Mac Mini are routed only to the EHCI controller?
Here is an output from lsusb -t in Linux on this same machine:
/: Bus 04.Port 1: Dev 1, Class=root_hub, Driver=uhci_hcd/2p, 12M
/: Bus 03.Port 1: Dev 1, Class=root_hub, Driver=ehci-pci/6p, 480M
|__ Port 1: Dev 2, If 0, Class=Hub, Driver=hub/3p, 480M
|__ Port 1: Dev 3, If 0, Class=Hub, Driver=hub/3p, 12M
|__ Port 3: Dev 8, If 0, Class=Vendor Specific Class, Driver=btusb, 12M
|__ Port 3: Dev 8, If 1, Class=Wireless, Driver=btusb, 12M
|__ Port 3: Dev 8, If 2, Class=Vendor Specific Class, Driver=btusb, 12M
|__ Port 3: Dev 8, If 3, Class=Application Specific Interface, Driver=, 12M
|__ Port 2: Dev 4, If 0, Class=Mass Storage, Driver=usb-storage, 480M
|__ Port 3: Dev 9, If 0, Class=Vendor Specific Class, Driver=rtl8821au, 480M
/: Bus 02.Port 1: Dev 1, Class=root_hub, Driver=ehci-pci/8p, 480M
|__ Port 1: Dev 2, If 0, Class=Hub, Driver=hub/3p, 480M
|__ Port 1: Dev 3, If 0, Class=Human Interface Device, Driver=usbhid, 1.5M
|__ Port 2: Dev 4, If 0, Class=Human Interface Device, Driver=usbhid, 12M
|__ Port 2: Dev 4, If 1, Class=Human Interface Device, Driver=usbhid, 12M
|__ Port 2: Dev 4, If 2, Class=Human Interface Device, Driver=usbhid, 12M
|__ Port 3: Dev 5, If 0, Class=Human Interface Device, Driver=usbhid, 1.5M
|__ Port 3: Dev 5, If 1, Class=Human Interface Device, Driver=usbhid, 1.5M
/: Bus 01.Port 1: Dev 1, Class=root_hub, Driver=uhci_hcd/2p, 12M
This is with every of the 4 physical USB ports on the Mac Mini having something connected to it. And as you can see, neither of the two internal UHCI controller buses (Bus 01.Port 1 and Bus 04.Port 1) have any devices linked to them, whereas both internal EHCI controller buses (Bus 02.Port 1 and Bus 03.Port 1) do have all the devices connected, even the lower speed ones (1.5M and 12M).
I guess in the Sandy Bridge chipset, Intel still offered a UHCI companion controller for legacy (Windows) compatibility besides the EHCI controller, but Apple never bothered to wire up the UHCI controller, since it didn't care about supporting any OSes older than the Mac OS X version that this model shipped with. (Let alone really old OSes that didn't even support USB 2.0.)
Perhaps it has something to do with the fact that the on-board UHCI controller is not a companion controller of the EHCI controller and all the external USB ports on this Mac Mini are routed only to the EHCI controller?
It doesn't matter they are companion or not.
The log shows that the UHCI are companions N_CC(number of companion controllers) is 4, but it's possible that Apple doesn't wire them to the ports. Still doesn't matter.
Anyways ECHI should detect the connected high speed hubs, you may change ehci.c:177, that line from delay(2) to delay(50) to see what happens.
Thanks for the suggestion. I just tried a debug build that had the EHCI delay set to 50ms, and below are the results, first with a wifi dongle also plugged in, and then a repeat of the same test, but without the wifi dongle plugged in. As you can see, increasing the EHCI reset delay didn't help, unfortunately.
https://github.com/crazii/USBDDOS/assets/518023/c610f7c4-98a8-454a-b5bc-f6a35231ea3d
https://github.com/crazii/USBDDOS/assets/518023/e16eeee1-79e4-422d-9f1e-011577ca8b44
I'm debugging use a USB boot disk with FreeDOS setup, but it still works on my T540p. I've fixed some bugs but I doubt those bugs are related to the one on your machine.
The new video shows that there's device attached to UHCI, but the driver failed on initializing it (set address), the log shows an assertion failure on usb.c:851, there might be problem of the UHCI driver.
In addition to the output of lsusb -t that I shared earlier, perhaps the USB-specific parts of the output of dmesg from this machine might provide clues as well.
I'm pasting the output of the command sudo dmesg | grep -i 'usb\|hci' | grep -vi 'bluetooth\|ahci\|sdhci' | grep -vi 'SerialNumber:' below:
[ 0.292069] pci 0000:00:1a.0: calling quirk_usb_early_handoff+0x0/0x7c0 @ 1
[ 0.292307] pci 0000:00:1a.0: quirk_usb_early_handoff+0x0/0x7c0 took 226 usecs
[ 0.292317] pci 0000:00:1a.7: calling quirk_usb_early_handoff+0x0/0x7c0 @ 1
[ 0.292474] pci 0000:00:1a.7: quirk_usb_early_handoff+0x0/0x7c0 took 149 usecs
[ 0.292495] pci 0000:00:1d.0: calling quirk_usb_early_handoff+0x0/0x7c0 @ 1
[ 0.292638] pci 0000:00:1d.0: quirk_usb_early_handoff+0x0/0x7c0 took 135 usecs
[ 0.292646] pci 0000:00:1d.7: calling quirk_usb_early_handoff+0x0/0x7c0 @ 1
[ 0.292792] pci 0000:00:1d.7: quirk_usb_early_handoff+0x0/0x7c0 took 138 usecs
[ 0.352562] calling ehci_hcd_init+0x0/0x140 @ 1
[ 0.352571] initcall ehci_hcd_init+0x0/0x140 returned 0 after 3 usecs
[ 0.352575] calling ehci_pci_init+0x0/0x80 @ 1
[ 0.352594] initcall ehci_pci_init+0x0/0x80 returned 0 after 14 usecs
[ 0.352599] calling ohci_hcd_mod_init+0x0/0x80 @ 1
[ 0.352610] initcall ohci_hcd_mod_init+0x0/0x80 returned 0 after 6 usecs
[ 0.352615] calling ohci_pci_init+0x0/0x80 @ 1
[ 0.352635] initcall ohci_pci_init+0x0/0x80 returned 0 after 15 usecs
[ 0.352641] calling uhci_hcd_init+0x0/0x140 @ 1
[ 0.352980] ehci-pci 0000:00:1a.7: EHCI Host Controller
[ 0.352992] ehci-pci 0000:00:1a.7: new USB bus registered, assigned bus number 1
[ 0.353010] ehci-pci 0000:00:1a.7: debug port 2
[ 0.356953] ehci-pci 0000:00:1a.7: irq 23, io mem 0xa8906c00
[ 0.363260] ehci-pci 0000:00:1a.7: USB 2.0 started, EHCI 1.00
[ 0.363374] usb usb1: New USB device found, idVendor=1d6b, idProduct=0002, bcdDevice= 6.06
[ 0.363378] usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[ 0.363380] usb usb1: Product: EHCI Host Controller
[ 0.363382] usb usb1: Manufacturer: Linux 6.6.10-1398.native ehci_hcd
[ 0.363536] hub 1-0:1.0: USB hub found
[ 0.363766] probe of usb1 returned 0 after 276 usecs
[ 0.363799] uhci_hcd 0000:00:1a.0: UHCI Host Controller
[ 0.363810] uhci_hcd 0000:00:1a.0: new USB bus registered, assigned bus number 2
[ 0.363820] uhci_hcd 0000:00:1a.0: detected 2 ports
[ 0.363866] uhci_hcd 0000:00:1a.0: irq 21, io port 0x00003120
[ 0.363940] usb usb2: New USB device found, idVendor=1d6b, idProduct=0001, bcdDevice= 6.06
[ 0.363943] usb usb2: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[ 0.363945] usb usb2: Product: UHCI Host Controller
[ 0.363946] usb usb2: Manufacturer: Linux 6.6.10-1398.native uhci_hcd
[ 0.364055] hub 2-0:1.0: USB hub found
[ 0.364129] probe of usb2 returned 0 after 102 usecs
[ 0.364168] ehci-pci 0000:00:1d.7: EHCI Host Controller
[ 0.364177] ehci-pci 0000:00:1d.7: new USB bus registered, assigned bus number 3
[ 0.364193] ehci-pci 0000:00:1d.7: debug port 2
[ 0.368122] ehci-pci 0000:00:1d.7: irq 22, io mem 0xa8906800
[ 0.374260] ehci-pci 0000:00:1d.7: USB 2.0 started, EHCI 1.00
[ 0.374319] usb usb3: New USB device found, idVendor=1d6b, idProduct=0002, bcdDevice= 6.06
[ 0.374323] usb usb3: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[ 0.374325] usb usb3: Product: EHCI Host Controller
[ 0.374326] usb usb3: Manufacturer: Linux 6.6.10-1398.native ehci_hcd
[ 0.374518] hub 3-0:1.0: USB hub found
[ 0.374728] probe of usb3 returned 0 after 258 usecs
[ 0.374761] uhci_hcd 0000:00:1d.0: UHCI Host Controller
[ 0.374772] uhci_hcd 0000:00:1d.0: new USB bus registered, assigned bus number 4
[ 0.374781] uhci_hcd 0000:00:1d.0: detected 2 ports
[ 0.374821] uhci_hcd 0000:00:1d.0: irq 19, io port 0x000030c0
[ 0.374986] usb usb4: New USB device found, idVendor=1d6b, idProduct=0001, bcdDevice= 6.06
[ 0.374992] usb usb4: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[ 0.374996] usb usb4: Product: UHCI Host Controller
[ 0.374999] usb usb4: Manufacturer: Linux 6.6.10-1398.native uhci_hcd
[ 0.375220] hub 4-0:1.0: USB hub found
[ 0.375375] probe of usb4 returned 0 after 243 usecs
[ 0.375466] initcall uhci_hcd_init+0x0/0x140 returned 0 after 22819 usecs
[ 0.375475] calling xhci_hcd_init+0x0/0x40 @ 1
[ 0.375484] initcall xhci_hcd_init+0x0/0x40 returned 0 after 3 usecs
[ 0.375489] calling xhci_pci_init+0x0/0x80 @ 1
[ 0.375511] initcall xhci_pci_init+0x0/0x80 returned 0 after 17 usecs
[ 0.375517] calling xhci_plat_init+0x0/0x40 @ 1
[ 0.375539] initcall xhci_plat_init+0x0/0x40 returned 0 after 16 usecs
[ 0.375622] usbcore: registered new interface driver uas
[ 0.375630] calling usb_storage_driver_init+0x0/0x40 @ 1
[ 0.375649] usbcore: registered new interface driver usb-storage
[ 0.375651] initcall usb_storage_driver_init+0x0/0x40 returned 0 after 16 usecs
[ 0.375673] usbcore: registered new interface driver ums-realtek
[ 0.378554] usbcore: registered new interface driver usbhid
[ 0.378556] usbhid: USB HID core driver
[ 0.606264] usb 1-1: new high-speed USB device number 2 using ehci-pci
[ 0.614265] usb 3-1: new high-speed USB device number 2 using ehci-pci
[ 0.734795] usb 1-1: New USB device found, idVendor=0424, idProduct=2513, bcdDevice= b.b3
[ 0.734812] usb 1-1: New USB device strings: Mfr=0, Product=0, SerialNumber=0
[ 0.735332] hub 1-1:1.0: USB hub found
[ 0.742799] usb 3-1: New USB device found, idVendor=0424, idProduct=2513, bcdDevice= b.b3
[ 0.742816] usb 3-1: New USB device strings: Mfr=0, Product=0, SerialNumber=0
[ 0.743339] hub 3-1:1.0: USB hub found
[ 1.024527] usb 1-1.1: new full-speed USB device number 3 using ehci-pci
[ 1.039261] usb 3-1.1: new low-speed USB device number 3 using ehci-pci
[ 1.116543] usb 1-1.1: New USB device found, idVendor=0a5c, idProduct=4500, bcdDevice= 1.00
[ 1.116560] usb 1-1.1: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[ 1.116568] usb 1-1.1: Product: BRCM20702 Hub
[ 1.116576] usb 1-1.1: Manufacturer: Apple Inc.
[ 1.117345] hub 1-1.1:1.0: USB hub found
[ 1.136282] usb 3-1.1: New USB device found, idVendor=05ac, idProduct=8242, bcdDevice= 0.16
[ 1.136295] usb 3-1.1: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[ 1.136304] usb 3-1.1: Product: IR Receiver
[ 1.136310] usb 3-1.1: Manufacturer: Apple Computer, Inc.
[ 1.194255] usb 1-1.2: new high-speed USB device number 4 using ehci-pci
[ 1.216266] usb 3-1.2: new full-speed USB device number 4 using ehci-pci
[ 1.286159] usb 1-1.2: New USB device found, idVendor=154b, idProduct=005b, bcdDevice=11.00
[ 1.286173] usb 1-1.2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 1.286182] usb 1-1.2: Product: USB 2.0 FD
[ 1.286189] usb 1-1.2: Manufacturer: PNY Technologies
[ 1.286825] usb-storage 1-1.2:1.0: USB Mass Storage device detected
[ 1.287113] scsi host6: usb-storage 1-1.2:1.0
[ 1.293264] usb 3-1.2: device descriptor read/64, error -32
[ 1.363280] usb 1-1.3: new high-speed USB device number 5 using ehci-pci
[ 1.457410] usb 1-1.3: New USB device found, idVendor=2001, idProduct=3314, bcdDevice= 2.00
[ 1.457427] usb 1-1.3: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 1.457437] usb 1-1.3: Product: 802.11n WLAN Adapter
[ 1.457444] usb 1-1.3: Manufacturer: Realtek
[ 1.488397] usb 3-1.2: New USB device found, idVendor=1532, idProduct=0034, bcdDevice= 2.00
[ 1.488408] usb 3-1.2: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[ 1.488417] usb 3-1.2: Product: Razer Taipan
[ 1.488424] usb 3-1.2: Manufacturer: Razer
[ 1.490156] input: Razer Razer Taipan as /devices/pci0000:00/0000:00:1d.7/usb3/3-1/3-1.2/3-1.2:1.0/0003:1532:0034.0002/input/input3
[ 1.490426] hid-generic 0003:1532:0034.0002: input,hidraw0: USB HID v1.11 Mouse [Razer Razer Taipan] on usb-0000:00:1d.7-1.2/input0
[ 1.492519] input: Razer Razer Taipan Keyboard as /devices/pci0000:00/0000:00:1d.7/usb3/3-1/3-1.2/3-1.2:1.1/0003:1532:0034.0003/input/input4
[ 1.520264] usb 1-1.1.1: new full-speed USB device number 6 using ehci-pci
[ 1.544506] input: Razer Razer Taipan as /devices/pci0000:00/0000:00:1d.7/usb3/3-1/3-1.2/3-1.2:1.1/0003:1532:0034.0003/input/input5
[ 1.544774] hid-generic 0003:1532:0034.0003: input,hidraw1: USB HID v1.11 Keyboard [Razer Razer Taipan] on usb-0000:00:1d.7-1.2/input1
[ 1.546245] input: Razer Razer Taipan as /devices/pci0000:00/0000:00:1d.7/usb3/3-1/3-1.2/3-1.2:1.2/0003:1532:0034.0004/input/input6
[ 1.598549] hid-generic 0003:1532:0034.0004: input,hidraw2: USB HID v1.11 Keyboard [Razer Razer Taipan] on usb-0000:00:1d.7-1.2/input2
[ 1.600657] usb 1-1.1.1: New USB device found, idVendor=05ac, idProduct=820a, bcdDevice= 1.00
[ 1.600668] usb 1-1.1.1: New USB device strings: Mfr=0, Product=0, SerialNumber=0
[ 1.602550] input: HID 05ac:820a as /devices/pci0000:00/0000:00:1a.7/usb1/1-1/1-1.1/1-1.1.1/1-1.1.1:1.0/0003:05AC:820A.0005/input/input7
[ 1.654516] hid-generic 0003:05AC:820A.0005: input,hidraw3: USB HID v1.11 Keyboard [HID 05ac:820a] on usb-0000:00:1a.7-1.1.1/input0
[ 1.674257] usb 3-1.3: new low-speed USB device number 5 using ehci-pci
[ 1.718256] usb 1-1.1.2: new full-speed USB device number 7 using ehci-pci
[ 1.767899] usb 3-1.3: New USB device found, idVendor=13ba, idProduct=0017, bcdDevice= 0.01
[ 1.767910] usb 3-1.3: New USB device strings: Mfr=0, Product=1, SerialNumber=0
[ 1.767918] usb 3-1.3: Product: Generic USB K/B
[ 1.771043] input: Generic USB K/B as /devices/pci0000:00/0000:00:1d.7/usb3/3-1/3-1.3/3-1.3:1.0/0003:13BA:0017.0006/input/input8
[ 1.798408] usb 1-1.1.2: New USB device found, idVendor=05ac, idProduct=820b, bcdDevice= 1.00
[ 1.798418] usb 1-1.1.2: New USB device strings: Mfr=0, Product=0, SerialNumber=0
[ 1.800143] input: HID 05ac:820b as /devices/pci0000:00/0000:00:1a.7/usb1/1-1/1-1.1/1-1.1.2/1-1.1.2:1.0/0003:05AC:820B.0007/input/input9
[ 1.822504] hid-generic 0003:13BA:0017.0006: input,hidraw4: USB HID v1.10 Keyboard [Generic USB K/B] on usb-0000:00:1d.7-1.3/input0
[ 1.823067] hid-generic 0003:05AC:820B.0007: input,hidraw5: USB HID v1.11 Mouse [HID 05ac:820b] on usb-0000:00:1a.7-1.1.2/input0
[ 1.825435] input: Generic USB K/B Mouse as /devices/pci0000:00/0000:00:1d.7/usb3/3-1/3-1.3/3-1.3:1.1/0003:13BA:0017.0008/input/input10
[ 1.825678] input: Generic USB K/B System Control as /devices/pci0000:00/0000:00:1d.7/usb3/3-1/3-1.3/3-1.3:1.1/0003:13BA:0017.0008/input/input11
[ 1.877522] hid-generic 0003:13BA:0017.0008: input,hidraw6: USB HID v1.10 Mouse [Generic USB K/B] on usb-0000:00:1d.7-1.3/input1
[ 1.887259] usb 1-1.1.3: new full-speed USB device number 8 using ehci-pci
[ 1.968284] usb 1-1.1.3: New USB device found, idVendor=05ac, idProduct=8281, bcdDevice= 1.56
[ 1.968296] usb 1-1.1.3: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[ 1.968312] usb 1-1.1.3: Manufacturer: Apple Inc.
[ 2.567690] scsi 6:0:0:0: Direct-Access PNY USB 2.0 FD 1100 PQ: 0 ANSI: 4
[ 4.211128] usbcore: registered new device driver apple-mfi-fastcharge
[ 4.779677] input: Apple Computer, Inc. IR Receiver as /devices/pci0000:00/0000:00:1d.7/usb3/3-1/3-1.1/3-1.1:1.0/0003:05AC:8242.0001/input/input12
[ 4.787782] calling btusb_driver_init+0x0/0xfc0 [btusb] @ 314
[ 4.788008] usbcore: registered new interface driver btusb
[ 4.788010] initcall btusb_driver_init+0x0/0xfc0 [btusb] returned 0 after 214 usecs
[ 4.839498] usb 1-1.1.1: USB disconnect, device number 6
[ 4.842524] appleir 0003:05AC:8242.0001: input,hiddev96,hidraw7: USB HID v1.11 Device [Apple Computer, Inc. IR Receiver] on usb-0000:00:1d.7-1.1/input0
[ 5.097626] usb 1-1.1.2: USB disconnect, device number 7
[ 6.631768] usbcore: registered new interface driver rtl8821au
Just found a bug on detection order, it might help with the problem on you Mac Mini, but I'm not so sure.
https://github.com/crazii/USBDDOS/commit/4d0697fd7f7d82b3b495bf81a411d48c07e635b2
EDIT: the EHCI hc didn't find any devices because it's not its turn yet, but EHCI hc should detect its devices before 1.x hc, the bug is fixed above. The assertion failure on uhci also indicates that the 2.0 devices might be passed to the uhci hc, which identifies another bug and I fixed it too.
You can get the latest code and test again, but recording videos is too inconvenient and you can skip it. I'm gonna add a logfile today. Pasting a txt file is much easier. But some logs in the IRQ handler will be missed because it's not practical to do system calls(opening/writing log file) in interrupt.
I suddenly realized that it's not possible to generate log file on a USB boot disk since the drive is temporarily not accessible.
Is this the spec of your Mac mini? https://everymac.com/systems/apple/mac_mini/specs/mac-mini-core-i7-2.7-mid-2011-specs.html
I'm gonna get one to debug.
The one I have been testing with is the i5 variant, also with the same integrated ATI Radeon graphics. It would indeed seem that this is the i7 variant of otherwise the exact same model and generation.
But are you sure you want to go through the trouble of purchasing old systems for debugging purposes? You could end up having to purchase a lot of different devices from various generations. Perhaps I can look into setting mine up as a remote development/test machine for you? Or set up some kind of auto-deploy through a CI/CD test pipeline in GitHub Actions?
I've already got too many machines. You can test with the latest code, it has more logs and bugfixes. Is remote on DOS possible? Auto deploy might help, but I'm not sure how much.
BTW is there any virtual screen utility that makes a wide screen to be 4:3? That's a flaw for modern laptop, mine does have a 4:3 switch, I had a monitor many years ago with that switch.
The monitor I've been testing this Mac Mini with indeed allows me to switch between displaying a 4:3 signal "pillarboxed" and having it stretched out. Since I hate stretched out 4:3 videos, I'm glad I'm able to switch between these modes on this screen. The setting does nothing for video that is natively 16:9.
Remote access and testing on DOS might work, but it would require some kind of hardware that would allow you to operate and monitor it locally. I guess some kind of KVM that can be accessed from the internet. It would have to include some kind of watchdog or remotely operable power cycle trigger as well. Let me do some searching on-line.
Something like the Pi-KVM might work. Fairly cheap too. :slightly_smiling_face:
More challenging might be the fact that the Mac Mini is not a regularly assembled PC, so it doesn't have an ATX power supply. It also doesn't have any built-in IPMI functionality. Apparently, there is a way to configure it to automatically power on after power loss. But even then I would need some kind of power strip that could be remotely switched off and on.
So it's not trivial, but not impossible and not necessarily very expensive either.
Btw It costs about $/€70 for a Mac mini 2011 here.
You're right. That's probably cheaper and a lot less complicated. :sweat_smile:
Yes, I haven't buy it yet, I'll figure out another time to test it.