View | Details | Raw Unified | Return to bug 251882
Collapse All | Expand All

(-)Makefile (-2 / +1 lines)
Lines 1-8 Link Here
1
# $FreeBSD$
1
# $FreeBSD$
2
2
3
PORTNAME=	bossa
3
PORTNAME=	bossa
4
PORTVERSION=	1.7.0
4
PORTVERSION=	1.9.1
5
PORTREVISION=	9
6
CATEGORIES=	devel
5
CATEGORIES=	devel
7
6
8
MAINTAINER=	kevans@FreeBSD.org
7
MAINTAINER=	kevans@FreeBSD.org
(-)distinfo (-3 / +3 lines)
Lines 1-3 Link Here
1
TIMESTAMP = 1475463215
1
TIMESTAMP = 1608087319
2
SHA256 (shumatech-BOSSA-1.7.0_GH0.tar.gz) = 758ddaa70163561de9877d2f0f61dd64b51616273ac8709278d7e67ab90a6af3
2
SHA256 (shumatech-BOSSA-1.9.1_GH0.tar.gz) = ca650455dfa36cbd029010167347525bea424717a71a691381c0811591c93e72
3
SIZE (shumatech-BOSSA-1.7.0_GH0.tar.gz) = 539347
3
SIZE (shumatech-BOSSA-1.9.1_GH0.tar.gz) = 544082
(-)files/patch-src_Command.cpp (-20 lines)
Lines 1-20 Link Here
1
--- src/Command.cpp.orig	2018-01-15 20:28:09 UTC
2
+++ src/Command.cpp
3
@@ -674,7 +674,7 @@ CommandMwb::invoke(char* argv[], int argc)
4
             char* input = readline("? ");
5
             if (!input)
6
                 return;
7
-            if (input == '\0' ||
8
+            if (*input == '\0' ||
9
                 !argUint32(input, &value))
10
             {
11
                 free(input);
12
@@ -777,7 +777,7 @@ CommandMww::invoke(char* argv[], int argc)
13
             char* input = readline("? ");
14
             if (!input)
15
                 return;
16
-            if (input == '\0' ||
17
+            if (*input == '\0' ||
18
                 !argUint32(input, &value))
19
             {
20
                 free(input);
(-)files/patch-src_PosixSerialPort.cpp (-47 lines)
Lines 1-47 Link Here
1
--- src/PosixSerialPort.cpp.orig	2017-03-31 15:31:35 UTC
2
+++ src/PosixSerialPort.cpp
3
@@ -85,6 +85,9 @@ PosixSerialPort::open(int baud,
4
 
5
     switch (baud)
6
     {
7
+    case 1200:
8
+        speed = B1200;
9
+        break;
10
     case 9600:
11
         speed = B9600;
12
         break;
13
@@ -297,6 +300,34 @@ PosixSerialPort::timeout(int millisecs)
14
 {
15
     _timeout = millisecs;
16
     return true;
17
+}
18
+
19
+void
20
+PosixSerialPort::setDTR(bool dtr)
21
+{
22
+    if (_devfd == -1)
23
+        return;
24
+
25
+    int iFlags = TIOCM_DTR;
26
+
27
+    if (dtr)
28
+        ioctl(_devfd, TIOCMBIS, &iFlags);
29
+    else
30
+        ioctl(_devfd, TIOCMBIC, &iFlags);
31
+}
32
+
33
+void
34
+PosixSerialPort::setRTS(bool rts)
35
+{
36
+    if (_devfd == -1)
37
+        return;
38
+
39
+    int iFlags = TIOCM_RTS;
40
+
41
+    if (rts)
42
+        ioctl(_devfd, TIOCMBIS, &iFlags);
43
+    else
44
+        ioctl(_devfd, TIOCMBIC, &iFlags);
45
 }
46
 
47
 void
(-)files/patch-src_PosixSerialPort.h (-11 lines)
Lines 1-11 Link Here
1
--- src/PosixSerialPort.h.orig	2017-03-31 15:31:35 UTC
2
+++ src/PosixSerialPort.h
3
@@ -52,6 +52,8 @@ class PosixSerialPort : public SerialPort (public)
4
 
5
     bool timeout(int millisecs);
6
     void flush();
7
+    void setDTR(bool dtr);
8
+    void setRTS(bool rts);
9
     void setAutoFlush(bool autoflush);
10
 
11
 private:
(-)files/patch-src_SerialPort.h (-11 lines)
Lines 1-11 Link Here
1
--- src/SerialPort.h.orig	2017-03-31 15:31:35 UTC
2
+++ src/SerialPort.h
3
@@ -68,6 +68,8 @@ class SerialPort (public)
4
 
5
     virtual bool timeout(int millisecs) = 0;
6
     virtual void flush() = 0;
7
+    virtual void setDTR(bool dtr) = 0;
8
+    virtual void setRTS(bool rts) = 0;
9
 
10
     virtual std::string name() const { return _name; }
11
 
(-)files/patch-src_WinSerialPort.cpp (-18 lines)
Lines 1-18 Link Here
1
--- src/WinSerialPort.cpp.orig	2017-03-31 15:31:35 UTC
2
+++ src/WinSerialPort.cpp
3
@@ -251,3 +251,15 @@ WinSerialPort::flush()
4
 {
5
     Sleep(1);
6
 }
7
+
8
+void
9
+WinSerialPort::setDTR(bool dtr)
10
+{
11
+    Sleep(1);
12
+}
13
+
14
+void
15
+WinSerialPort::setRTS(bool rts)
16
+{
17
+    Sleep(1);
18
+}
(-)files/patch-src_WinSerialPort.h (-11 lines)
Lines 1-11 Link Here
1
--- src/WinSerialPort.h.orig	2017-03-31 15:31:35 UTC
2
+++ src/WinSerialPort.h
3
@@ -55,6 +55,8 @@ class WinSerialPort : public SerialPort (public)
4
 
5
     bool timeout(int millisecs);
6
     void flush();
7
+    void setDTR(bool dtr);
8
+    void setRTS(bool rts);
9
 
10
 private:
11
     HANDLE _handle;
(-)files/patch-src_bossac.cpp (-69 lines)
Lines 1-69 Link Here
1
--- src/bossac.cpp.orig	2017-03-31 15:31:35 UTC
2
+++ src/bossac.cpp
3
@@ -64,6 +64,7 @@ class BossaConfig (public)
4
     bool help;
5
     bool forceUsb;
6
     string forceUsbArg;
7
+    bool arduinoErase;
8
 
9
     int readArg;
10
     string portArg;
11
@@ -89,6 +90,7 @@ BossaConfig::BossaConfig()
12
     info = false;
13
     help = false;
14
     forceUsb = false;
15
+    arduinoErase = false;
16
 
17
     readArg = 0;
18
     bootArg = 1;
19
@@ -189,6 +191,11 @@ static Option opts[] =
20
       'R', "reset", &config.reset,
21
       { ArgNone },
22
       "reset CPU (if supported)"
23
+    },
24
+    {
25
+      'a', "arduino_erase", &config.arduinoErase,
26
+      { ArgNone },
27
+      "erase and reset via Arduino 1200 baud hack (cannot be used with port autodetection)"
28
     }
29
 };
30
 
31
@@ -257,6 +264,12 @@ main(int argc, char* argv[])
32
         return help(argv[0]);
33
     }
34
 
35
+    if (config.arduinoErase && !config.port)
36
+    {
37
+        fprintf(stderr, "%s: port must be specified for Arduino 1200bps erase hack\n", argv[0]);
38
+        return help(argv[0]);
39
+    }
40
+
41
     if (config.read || config.write || config.verify)
42
     {
43
         if (args == argc)
44
@@ -311,6 +324,25 @@ main(int argc, char* argv[])
45
                 fprintf(stderr, "Invalid USB value: %s\n", config.forceUsbArg.c_str());
46
                 return 1;
47
             }
48
+        }
49
+
50
+        if (config.arduinoErase)
51
+        {
52
+            SerialPort::Ptr port;
53
+            if (config.forceUsb)
54
+                port = portFactory.create(config.portArg, isUsb);
55
+            else
56
+                port = portFactory.create(config.portArg);
57
+
58
+            if(!port->open(1200))
59
+            {
60
+                fprintf(stderr, "Failed to open port at 1200bps\n");
61
+                return 1;
62
+            }
63
+
64
+            port->setRTS(true);
65
+            port->setDTR(false);
66
+            port->close();
67
         }
68
 
69
         if (config.port)

Return to bug 251882