Sections
You are here: Home Forum Bugs, Known Issues, & Requests working on linux mchelper(v25) and OSC over USB

working on linux mchelper(v25) and OSC over USB

Up to Bugs, Known Issues, & Requests

working on linux mchelper(v25) and OSC over USB

Posted by John (EBo) David at August 14. 2008
Liam, I started another thread to focus on getting v25 working on Linux and have a number of questions and comments. Please note that I am just getting back to looking into this and have to reorient my self to the changes in v25... For starters I hacked out the Qt4.4'isms. This only required changing QPlainTextEdit to QTextEdit calls in about a half dozen places, and removing some stuff dealing with block counts. Appended is a "diff" (which is a list of the differences). One interesting problem is that g++ (ver-4.1.2) has a problem with how you generate the version string, so for now I hard coded it. The behavior with the above hack is interesting. It reports that device -> "No Make Controller Found..." when at91_0 is autoloaded, and mchelper v1.1 sees it and can program the device. When I click on device and tell it to upload new firmware it pops up a little dialog box titled "uploading" and then splats the following to the command console from which I started mchelper-v2.5 sam7: >N# < 0A 0D sam7: >wFFFFF240,4# sam7: < 40 09 5B 27 sam7: Chip Version: 0 Embedded Processor: ARM7TDMI NVRAM Region 1 Size: 256 K NVRAM Region 2 Size: 0 K SRAM Size: 64 K Series: AT91SAM7Xxx Page Size: 256 bytes Lock Regions: 16 and then it hangs... Like I mentioned above, I went back to a known working mchelper version (v1.1) and was able to recognize and upload a program. It may be that when I broke something with my simplistic hack, but it is not readily apparent to me. Any suggestions on what might be going on (to help orient me with the new code)? appended is the diff... EBo -- ps: another nit-pick with the code is that many of the files are not terminated with a newline. While this does not cause an error with the compiler it does spawn a LOT of warning messages. Is it possible that someone go through and add newlines to all these files to quiet down the warning messages? As a note, I have seen some compilers choke on the last line of a program/file being terminated with an EOF... ============== diff -ruN v25/layouts/mainwindow.ui v25.hack3/layouts/mainwindow.ui --- v25/layouts/mainwindow.ui 2008-07-11 08:56:20.000000000 -0600 +++ v25.hack3/layouts/mainwindow.ui 2008-08-14 03:11:48.000000000 -0600 @@ -52,7 +52,7 @@ - + false diff -ruN v25/src/About.cpp v25.hack3/src/About.cpp --- v25/src/About.cpp 2008-07-11 08:56:40.000000000 -0600 +++ v25.hack3/src/About.cpp 2008-08-14 02:36:13.000000000 -0600 @@ -25,7 +25,9 @@ title.setText( "Make Controller Helper" ); title.setAlignment( Qt::AlignHCenter ); - version.setText( QString( "Version %1" ).arg( MCHELPER_VERSION ) ); + // EBo -- problem parsing versioning -- version.setText( QString( "Version %1" ).arg( MCHELPER_VERSION ) ); + version.setText( QString( "Version %1" ).arg( "2.5.0" ) ); + version.setAlignment( Qt::AlignHCenter ); description = new QLabel( "
mchelper (Make Controller Helper) is part of the Make Controller Kit project - an \ open source hardware platform for everybody. mchelper can upload new firmware to your Make \ diff -ruN v25/src/MainWindow.cpp v25.hack3/src/MainWindow.cpp --- v25/src/MainWindow.cpp 2008-07-11 08:56:40.000000000 -0600 +++ v25.hack3/src/MainWindow.cpp 2008-08-14 02:34:49.000000000 -0600 @@ -75,7 +75,8 @@ void MainWindow::setMaxMessages(int msgs) { - outputConsole->setMaximumBlockCount(msgs); + // EBo -- no such functionality in Qt 4.3 + // outputConsole->setMaximumBlockCount(msgs); } void MainWindow::writeSettings() @@ -285,7 +286,7 @@ // because the format will be the same for all lines added via insertPlainText() // we need to add a blank line to set our format, then insert the message outputConsole->moveCursor(QTextCursor::End); - if(outputConsole->blockCount()) + // EBo -- if(outputConsole->blockCount()) outputConsole->insertPlainText("\n"); outputConsole->textCursor().setBlockFormat(format); outputConsole->insertPlainText(post.join("\n")); @@ -309,7 +310,9 @@ msg.prepend(QTime::currentTime().toString() + " "); // todo - maybe make the time text gray msg += QString(" %1 %2").arg(tofrom).arg(from); - outputConsole->appendPlainText(msg); // insert the message + // EBo -- outputConsole->appendPlainText(msg); // insert the message + outputConsole->append(msg); // insert the message + outputConsole->moveCursor(QTextCursor::End); // move the cursor to the end outputConsole->textCursor().setBlockFormat(format); // so that when we set the color, it colors the right block outputConsole->ensureCursorVisible();

Re: working on linux mchelper(v25) and OSC over USB

Posted by Liam Staskawicz at August 14. 2008
Cool - great to have you in there hacking! For the uploading stuff, I am ultimately planning on moving away from the current code towards something more like the mcbuilder code. This basically requires a sam7 binary, and then calls it from within mcbuilder as opposed to duplicating all the sam7 code within the mcbuilder/mchelper code base. The sam7utils author has started working on a libsam7 that we'd just be able to link against, but that is not available yet. No prob about the line endings - I usually get warnings and remove those too, so I'm a little surprised they were still in there. I haven't touched that code for a little moment, so it's possible there are a few silly things like that going on. I'll go through and add them in before too long. I can't recall offhand what kind of shape the USB discovery mechanism might be in at the moment, so it's reasonable it might not be listing boards in the list on the left. You might have a look at the UsbMonitor stuff to see what's happening there.

Re: working on linux mchelper(v25) and OSC over USB

Posted by John (EBo) David at August 14. 2008
I'll make a point of checking into this tonight.

Re: working on linux mchelper(v25) and OSC over USB

Posted by John (EBo) David at August 15. 2008
Ok... here is a start... The idVenor=1003, ifProduct=24868 which happens to be 3'rd on my list. The in src/qextserialport/qextserialenumerator.cpp that read: if(usb_set_configuration( io_handle, 1 ) < 0) always returns < 0, and fails here. I tried changing the config number to 0 (just in case it was zero offset), and there was no joy... I then tried to hack in the following line around the problem just to see if I hard coded it that it would work: if (usbdev->descriptor.idVendor==1003 && usbdev->descriptor.idProduct==24868) { // printf ("WE GOT IT!!!\n"); } else { usb_close(io_handle); continue; } This worked so far... Moving on I added the following stuff to the end of the subroutine to instantiate the info variable (following after what was set with the scanPortsOSX: QextPortInfo info; // set port info... char path[PATH_MAX]; har productName[PATH_MAX]; strcpy (path,"/dev/bus/usb/"); strcat (path,usbdev->bus->dirname); strcat (path,"/"); strcat (path,usbdev->filename); strcpy (productName,"Make Controller Ki"); // FIXME: should get from device (at91) info.friendName = productName; info.portName = path; infoList.append(info); The product name should probably be read from the device, but I have not been able to figure out how to do this yet. My driver does not read "Make Controller Ki", but "at91", so we may need to update one, the other, or both. .... moving on... Now the devices window recognizes the MC and deals with it appropriately when it is unplugged... Hurray, the first step. I have noticed a problem with the "Upload New Firmware" menu item not being reset when the MC is unplugged and plugged back in. Also it would make sence for the option to be off if mchelper starts without the MC being plugged in... Now when I continue with loading the firmware it hangs on the "Uploading..." dialog box. As far as I can tell, none of the the program handshaking lines are read or written past the initial sequence: sam7: Chip Version: 0 Embedded Processor: ARM7TDMI NVRAM Region 1 Size: 256 K NVRAM Region 2 Size: 0 K SRAM Size: 64 K Series: AT91SAM7Xxx Page Size: 256 bytes Lock Regions: 16 *** any idea why it is hanging? My best guess is that it is not reading the handshake stuff from sam7. What version of sam7 are you calling from you working version of v25? I'm currently running 0.1.0. The folks over at sam7util have never patched their Makefiles for the kernel driver and it will take me a little effort to upgrade to ver-0.2.1+... Well that's it for the night. Let me know if you have any insight into the hanging problems. EBo -- ps: sorry for the log winded stuff; I was writing it as I was debugging...

Re: working on linux mchelper(v25) and OSC over USB

Posted by John (EBo) David at August 15. 2008
Well... it does not look like I can edit a bunch of the above out. It turns out that some of the problem was caused by incompatible versions of linusb with Sam7utils -- checking usb_set_configuration and usb_claim_interface with libusb is blocked from opening the device because at the time I was running a version of the at91 Linux kernal driver. I remember reading in the sam7util changelog that the kernal driver is no longer needed. But it should be added that mchelper-v25 appears to REQUIRE sam7utils-0.2.*+. The progress meter still freezes and the "Upload New Firmware" menu is still misbehaving. more later, EBo --

Re: working on linux mchelper(v25) and OSC over USB

Posted by Liam Staskawicz at August 15. 2008
Cool - I basically copied over the libusb enumeration code from sam7utils, so if you find any mods that work for you, that's great. Is it possible the board is in SAM-BA mode when you're reading back at91? I don't think that should be in the descriptors anywhere when the board is actually running its firmware. And yeah - there are some changes in the latest trunk of sam7utils that are required, unfortunately, so I bet that will explain most of your problems. Are you able to build from the sam7 svn trunk? Hopefully Erik will make a release before too long, but who knows. I think some of the flags passed to sam7 from mchelper25 as it stands in SVN at the moment are not quite right. The appropriate flags can be found in the mcbuilder code. I think a combination of updated sam7utils code and the appropriate flags will get you closer...

Re: working on linux mchelper(v25) and OSC over USB

Posted by John (EBo) David at August 15. 2008
Hmmm... I downloaded the latest sam7-0.2.1 and not the SVN. I'll try that first. regarding the differences in the mcbuilder/mchelper thing is going to be a a real pain. What we need to do is break all of the comon functions out into an independant library (let's say libmc or some such. Maybe even a little finer like libmc_osc, libmc_usb, libmc_samba, etc. That way when it is fixed on one place it is fixed in all places. I've just checked out sam7utils from the svn, built it and will now look again at the qt4.4 issues. More later, EBo --

Re: working on linux mchelper(v25) and OSC over USB

Posted by John (EBo) David at August 15. 2008
Liam, Here is a diff of the initial changes to v25 *after* getting Qt-4.4.1 integrated into the machine. Most of the these initial changes are adding newlines to the end of various files (to silence the warnings), but there was one change which was a little bit of a show stopper. The versioning number specified in mchelper.pro ad to have a couple of extra \\ added to it. Without them, the version number was interpreted as a number, and About.cpp's compilation failed because there were to many decimal points... Hope this helps... EBo -- ========== diff to follow. diff -ruN v25/ v25.hack4/ diff -ruN v25/include/About.h v25.hack4/include/About.h --- v25/include/About.h 2008-07-11 08:56:21.000000000 -0600 +++ v25.hack4/include/About.h 2008-08-15 19:41:06.000000000 -0600 @@ -21,4 +21,4 @@ QHBoxLayout *buttonLayout; }; -#endif // ABOUT_H \ No newline at end of file +#endif // ABOUT_H diff -ruN v25/include/Inspector.h v25.hack4/include/Inspector.h --- v25/include/Inspector.h 2008-07-11 08:56:21.000000000 -0600 +++ v25.hack4/include/Inspector.h 2008-08-15 19:42:07.000000000 -0600 @@ -32,4 +32,5 @@ void setLabelsRole(QPalette::ColorRole role); }; -#endif // INSPECTOR_H \ No newline at end of file +#endif // INSPECTOR_H + diff -ruN v25/include/Preferences.h v25.hack4/include/Preferences.h --- v25/include/Preferences.h 2008-07-11 08:56:21.000000000 -0600 +++ v25.hack4/include/Preferences.h 2008-08-15 19:41:34.000000000 -0600 @@ -40,4 +40,5 @@ void restoreDefaults( ); }; -#endif // PREFERENCES_H \ No newline at end of file +#endif // PREFERENCES_H + diff -ruN v25/include/Uploader.h v25.hack4/include/Uploader.h --- v25/include/Uploader.h 2008-07-11 08:56:21.000000000 -0600 +++ v25.hack4/include/Uploader.h 2008-08-15 19:41:38.000000000 -0600 @@ -26,4 +26,5 @@ void uploadFinished(int exitCode, QProcess::ExitStatus exitStatus); }; -#endif // UPLOADER_H \ No newline at end of file +#endif // UPLOADER_H + diff -ruN v25/mchelper.pro v25.hack4/mchelper.pro --- v25/mchelper.pro 2008-07-11 09:03:15.000000000 -0600 +++ v25.hack4/mchelper.pro 2008-08-15 19:50:49.000000000 -0600 @@ -46,7 +46,7 @@ src/PacketUsbSerial.cpp QT += network xml -DEFINES += MCHELPER_VERSION=\"$${MCHELPER_VERSION}\" +DEFINES += MCHELPER_VERSION=\\\"$${MCHELPER_VERSION}\\\" RESOURCES += resources/mchelper.qrc INCLUDEPATH += include OBJECTS_DIR = tmp diff -ruN v25/src/main.cpp v25.hack4/src/main.cpp --- v25/src/main.cpp 2008-07-11 08:56:40.000000000 -0600 +++ v25.hack4/src/main.cpp 2008-08-15 19:41:52.000000000 -0600 @@ -12,4 +12,5 @@ if(!no_ui) window.show(); return app.exec(); -} \ No newline at end of file +} + diff -ruN v25/src/qextserialport/posix_qextserialport.h v25.hack4/src/qextserialport/posix_qextserialport.h --- v25/src/qextserialport/posix_qextserialport.h 2008-07-11 08:56:38.000000000 -0600 +++ v25.hack4/src/qextserialport/posix_qextserialport.h 2008-08-15 19:42:34.000000000 -0600 @@ -71,4 +71,5 @@ }; -#endif \ No newline at end of file +#endif +
Powered by Ploneboard
Document Actions