void PrefsRunProgramWidget::setupUi(Util::Settings::RunProgramConfig const &cfg) { Q_D(PrefsRunProgramWidget); // Setup UI controls. d->ui->setupUi(this); setupTypeControl(cfg); d->flagsByCheckbox[d->ui->cbAfterJobQueueStopped] = Util::Settings::RunAfterJobQueueFinishes; d->flagsByCheckbox[d->ui->cbAfterJobSuccessful] = Util::Settings::RunAfterJobCompletesSuccessfully; d->flagsByCheckbox[d->ui->cbAfterJobError] = Util::Settings::RunAfterJobCompletesWithErrors; d->ui->cbConfigurationActive->setChecked(cfg.m_active); d->executable = Util::replaceApplicationDirectoryWithMtxVariable(cfg.m_commandLine.value(0)); d->ui->leName->setText(cfg.m_name); d->ui->leCommandLine->setText(Util::escape(cfg.m_commandLine, Util::EscapeShellUnix).join(" ")); d->ui->leAudioFile->setText(QDir::toNativeSeparators(Util::replaceApplicationDirectoryWithMtxVariable(cfg.m_audioFile))); d->ui->sbVolume->setValue(cfg.m_volume); for (auto const &checkBox : d->flagsByCheckbox.keys()) if (cfg.m_forEvents & d->flagsByCheckbox[checkBox]) checkBox->setChecked(true); auto html = QStringList{}; html << Q("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\" \"http://www.w3.org/TR/REC-html40/strict.dtd\">" "<html><head><meta name=\"qrichtext\" content=\"1\" />" "<style type=\"text/css\">" "p, li { white-space: pre-wrap; }\n" "</style>" "</head><body>" "<h3>") << QYH("Usage and examples") << Q("</h3><ul><li>") << QYH("The command line here uses Unix-style shell escaping via the backslash character even on Windows.") << QYH("This means that either backslashes must be doubled or the whole argument must be enclosed in single quotes.") #if defined(SYS_WINDOWS) << QYH("Note that on Windows forward slashes can be used instead of backslashes in path names, too.") #endif << QYH("See below for examples.") << Q("</li>") << Q("<li>") << QYH("Always use full path names even if the application is located in the same directory as the GUI.") << Q("</li>") #if !defined(SYS_APPLE) << Q("<li>") # if defined(SYS_WINDOWS) << QYH("Start file types other than executable files via cmd.exe.") # else << QYH("Start file types other than executable files via xdg-open.") # endif << QYH("See below for examples.") << Q("</li>") #endif << Q("</ul><h3>") << QYH("Examples") << Q("</h3><ul><li>") << QYH("Play a WAV file with the default application:") #if defined(SYS_WINDOWS) << Q("<code>") << QH("C:\\\\windows\\\\system32\\\\cmd.exe /c C:\\\\temp\\\\signal.wav") << Q("</code>") << QYH("or") << Q("<code>") << QH("C:/windows/system32/cmd.exe /c C:/temp/signal.wav") << Q("</code>") << QYH("or") << Q("<code>") << QH("'C:\\windows\\system32\\cmd.exe' /c 'C:\\temp\\signal.wav'") << Q("</code>") #elif defined(SYS_APPLE) << Q("<code>") << QH("/usr/bin/afplay /Users/janedoe/Audio/signal.wav") << Q("</code>") #else << Q("<code>") << QH("/usr/bin/xdg-open /home/janedoe/Audio/signal.wav") << Q("</code>") #endif << Q("</li><li>") << QYH("Shut down the system in one minute:") #if defined(SYS_WINDOWS) << Q("<code>") << QH("'c:\\windows\\system32\\shutdown.exe' /s /t 60") << Q("</code>") #elif defined(SYS_APPLE) << Q("<code>") << QH("/usr/bin/sudo /sbin/shutdown -h +1") << Q("</code>") #else << Q("<code>") << QH("/usr/bin/sudo /sbin/shutdown --poweroff +1") << Q("</code>") #endif << Q("</li>") << Q("</li><li>") << QYH("Open the multiplexed file with a player:") << Q("</li>") #if defined(SYS_WINDOWS) << Q("<code>") << QH("'C:\\Program Files (x86)\\VideoLAN\\VLC\\vlc.exe' '<MTX_DESTINATION_FILE_NAME>'") << Q("</code>") #elif defined(SYS_APPLE) << Q("<code>") << QH("/usr/bin/vlc '<MTX_DESTINATION_FILE_NAME>'") << Q("</code>") #else << Q("<code>") << QH("/usr/bin/vlc '<MTX_DESTINATION_FILE_NAME>'") << Q("</code>") #endif << Q("</ul></body></html>"); d->ui->tbUsageNotes->setHtml(html.join(Q(" "))); enableControls(); }
/** Debug function, checks consistency of memory structures. * * @param[in] arg UHCI structure to use. * @return EOK (should never return) */ int hc_debug_checker(void *arg) { hc_t *instance = arg; assert(instance); #define QH(queue) \ instance->transfers_##queue.queue_head while (1) { const uint16_t cmd = pio_read_16(&instance->registers->usbcmd); const uint16_t sts = pio_read_16(&instance->registers->usbsts); const uint16_t intr = pio_read_16(&instance->registers->usbintr); if (((cmd & UHCI_CMD_RUN_STOP) != 1) || (sts != 0)) { usb_log_debug2("Command: %X Status: %X Intr: %x\n", cmd, sts, intr); } const uintptr_t frame_list = pio_read_32(&instance->registers->flbaseadd) & ~0xfff; if (frame_list != addr_to_phys(instance->frame_list)) { usb_log_debug("Framelist address: %p vs. %p.\n", (void *) frame_list, (void *) addr_to_phys(instance->frame_list)); } int frnum = pio_read_16(&instance->registers->frnum) & 0x3ff; uintptr_t expected_pa = instance->frame_list[frnum] & LINK_POINTER_ADDRESS_MASK; uintptr_t real_pa = addr_to_phys(QH(interrupt)); if (expected_pa != real_pa) { usb_log_debug("Interrupt QH: %p (frame %d) vs. %p.\n", (void *) expected_pa, frnum, (void *) real_pa); } expected_pa = QH(interrupt)->next & LINK_POINTER_ADDRESS_MASK; real_pa = addr_to_phys(QH(control_slow)); if (expected_pa != real_pa) { usb_log_debug("Control Slow QH: %p vs. %p.\n", (void *) expected_pa, (void *) real_pa); } expected_pa = QH(control_slow)->next & LINK_POINTER_ADDRESS_MASK; real_pa = addr_to_phys(QH(control_full)); if (expected_pa != real_pa) { usb_log_debug("Control Full QH: %p vs. %p.\n", (void *) expected_pa, (void *) real_pa); } expected_pa = QH(control_full)->next & LINK_POINTER_ADDRESS_MASK; real_pa = addr_to_phys(QH(bulk_full)); if (expected_pa != real_pa ) { usb_log_debug("Bulk QH: %p vs. %p.\n", (void *) expected_pa, (void *) real_pa); } async_usleep(UHCI_DEBUGER_TIMEOUT); } return EOK; #undef QH }