Conversation
TI-OS reuses the battery comparator configuration after a normal battery-level read,
then selects a high threshold through control ports 0 and 9 before checking USB power safety.
Model that continuous comparator behavior even when port 7 is not rewritten.
Without this update, a successful TI-Innovator bulk write is followed by TI-OS event 0xBD,
which surfaces as ERROR: BREAK. With it, Send("VERSION") and Get(Str0) complete correctly.
Schedule USB frames at the controller's 12 MHz clock rate: 1 ms for full/low speed and 125 us for high speed. It was around 1500 times too quickly before. Budgets were swapped for full vs high.
- Make device-mode DMA START self-clear when a response completes, including zero-length status stages - Only enable a host port after reset has actually completed.
A physical libusb request may remain submitted across multiple emulated frames. Advancing its iTD, siTD, or queue-head state before the response arrives loses the original transaction and can stall the async schedule or complete the wrong descriptor. Let backends mark a request pending, snapshot each schedule object before dispatch, and restore it while still charging the frame budget. The next frame retries the same transaction without monopolizing the rest of the schedule, and the response advances it exactly once.
Drive VBUS, session-valid, port connection, and enable state from A_BUSREQ/A_BUSDROP instead of treating the port as permanently present. Fix A-side unplugging so both connection and enable changes are reported and the B side is actually removed. Introduce explicit session start/end/request events so controller state can be propagated without advancing backend protocol machines. MSD and physical devices accept the notifications, while DUSB returns its session-start response directly.
usb_plug_device: do checks before a teardown and use usb_disconnected_device more correctly. Track claimed and detached interfaces explicitly, so teardown releases only interfaces CEmu owns and reattaches kernel drivers even after the device no longer has an active configuration descriptor. Defer DEVICE_LEFT cleanup until libusb event dispatch returns, tear down children before parents, and identify reset replacements by bus plus port path. Rebuild hub descendants parent-first, discard stale pending entries, restore hotplug registration after replacement, and stop retrying permanent open failures.
Keep OTG identity, role, VBUS/session, line state, and host-port state synchronized without injecting duplicate edge interrupts. Reset external connector state after image restore and avoid destroying an already-disconnected backend during no-op detach requests. Complete successful queue-head transfers with the updated qTD page, offset, remaining length, and data toggle. Traverse schedules only while the port is enabled.
Avoid blocking the emulation thread while a physical USB reset re-enumerates a device. Poll replacement handles from the backend timer, ignore the reset hotplug pair, and keep teardown outside libusb hotplug callbacks. Treat synchronous libusb submission failures as failed transfers instead of tearing down the entire physical backend, so one inaccessible interface does not disconnect an otherwise usable composite device.
Open HID interfaces unavailable to libusb through IOHID while libusb continues to own the remaining interfaces. Keep HID waits separate from libusb transfers and clean them up during reset and detach. Correlate each IOHID device with its USB interface number, maintain one bridge per interface, and route interrupt-IN endpoints to the correct bridge. Link CoreFoundation and IOKit in both Qt build systems.
Member
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

So I wanted to check if Codex was able to fix/improve the situation regarding USB Host support in CEmu, so that plugging devices into the emulated calc would stop freezing everything - and if possible, actually work.
After hours of looping (and many of manual testing/reporting on my side), it turns out that yes, it was able to fix and improve the situation a whole lot 🎉
Tested and works:
(tested from the Hub app and a sample TI-Basic program)
(tested from the SetDash app for robot scanning/pairing)
(tested in EasyData)
(tested some specific keys that aren't normally mapped)
(tested on a 84+CSE and another CE, as variable receivers)
What still works with all these modifications (regression tests basically):
(tested listing, transfers)
(variables, OS, apps)
Tested and does NOT work:
Please test the CI artifacts on Windows and Linux 🤷♂️
To feast your eyes...
CRB2.mp4