Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: azonenberg/openfpga
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 9ea79f243fdb
Choose a base ref
...
head repository: azonenberg/openfpga
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: d423fedde658
Choose a head ref
  • 4 commits
  • 2 files changed
  • 2 contributors

Commits on Mar 1, 2017

  1. gp4prog: Include <cstdlib>

    Some functions used here (e.g. atoi) are supposed to live in <cstdlib>.
    Fixes build on macOS.
    ArcaneNibble committed Mar 1, 2017

    Verified

    This commit was signed with the committer’s verified signature.
    woodruffw William Woodruff
    Copy the full SHA
    a230023 View commit details
  2. gp4prog: Use _getch rather than termios on Windows

    Windows doesn't have termios.
    ArcaneNibble committed Mar 1, 2017
    Copy the full SHA
    06ad0a9 View commit details
  3. gpdevboard: Don't try to detach kernel driver on Windows or macOS

    This doesn't work on those platforms. On Windows, it is unnecessary as
    libusb can go through the Windows HID layer. On macOS, you need the
    codeless kext in contrib/.
    ArcaneNibble committed Mar 1, 2017
    Copy the full SHA
    fd53445 View commit details
  4. Merge pull request #75 from rqou/minor-fixes

    Minor fixes for macOS and Windows
    whitequark authored Mar 1, 2017
    Copy the full SHA
    d423fed View commit details
Showing with 13 additions and 0 deletions.
  1. +9 −0 src/gp4prog/main.cpp
  2. +4 −0 src/gpdevboard/usb.cpp
9 changes: 9 additions & 0 deletions src/gp4prog/main.cpp
Original file line number Diff line number Diff line change
@@ -16,12 +16,17 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA *
**********************************************************************************************************************/

#include <cstdlib>
#include <cstring>
#include <cmath>
#include <unistd.h>
#include <log.h>
#include <gpdevboard.h>
#ifndef _WIN32
#include <termios.h>
#else
#include <conio.h>
#endif

using namespace std;

@@ -544,13 +549,17 @@ int main(int argc, char* argv[])
LogNotice("Holding lock on board, press any key to exit...\n");
SetStatusLED(hdev, 1);

#ifndef _WIN32
struct termios oldt, newt;
tcgetattr ( STDIN_FILENO, &oldt );
newt = oldt;
newt.c_lflag &= ~( ICANON | ECHO );
tcsetattr ( STDIN_FILENO, TCSANOW, &newt );
getchar();
tcsetattr ( STDIN_FILENO, TCSANOW, &oldt );
#else
_getch();
#endif
}

//Done
4 changes: 4 additions & 0 deletions src/gpdevboard/usb.cpp
Original file line number Diff line number Diff line change
@@ -154,13 +154,17 @@ hdevice OpenDevice(uint16_t idVendor, uint16_t idProduct, int nboard)
return NULL;
}

#if !(defined(_WIN32) || defined(__APPLE__))
//Detach the kernel driver, if any
int err = libusb_detach_kernel_driver(hdev, 0);
if( (0 != err) && (LIBUSB_ERROR_NOT_FOUND != err) )
{
LogError("Can't detach kernel driver\n");
return NULL;
}
#else
int err = 0;
#endif

//Set the device configuration
//If this fails, with LIBUSB_ERROR_BUSY, poll every 100 ms until the device is free