This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2013-03-05 03:36:46

mikhirev
New Scratcher
Registered: 2013-03-05
Posts: 2

Scratch does not display serial ports on Linux

Hi!
Scratch is unable to display serial ports other than /dev/ttyUSB*. So it is unable to communicate with modern Arduino boards connected via USB that appears as /dev/ttyACM* and with boards connected via Bluetooth (/dev/rfcomm*) of COM port (/dev/ttyS*).
The following patch fixes this issue:

Code:

--- scratch-1.4.0.7.src/src/plugins/scratch/unixSeriaPort2Ops.c.orig    2013-02-28 13:37:49.192408027 +0400
+++ scratch-1.4.0.7.src/src/plugins/scratch/unixSeriaPort2Ops.c 2013-02-28 13:43:02.607540279 +0400
@@ -337,7 +337,10 @@
 }
 
 int isSerialPortDev(char *s) {
-       return isPrefix("ttyusb", s);
+       return isPrefix("ttyusb", s) ||
+               isPrefix("ttys", s) ||
+               isPrefix("ttyacm", s) ||
+               isPrefix("rfcomm", s);
 }
 
 int isPrefix(char *prefix, char *s) {

Offline

 

#2 2013-03-05 16:17:45

TRocket
Scratcher
Registered: 2009-08-18
Posts: 1000+

Re: Scratch does not display serial ports on Linux

mikhirev wrote:

Hi!
Scratch is unable to display serial ports other than /dev/ttyUSB*. So it is unable to communicate with modern Arduino boards connected via USB that appears as /dev/ttyACM* and with boards connected via Bluetooth (/dev/rfcomm*) of COM port (/dev/ttyS*).
The following patch fixes this issue:

Code:

--- scratch-1.4.0.7.src/src/plugins/scratch/unixSeriaPort2Ops.c.orig    2013-02-28 13:37:49.192408027 +0400
+++ scratch-1.4.0.7.src/src/plugins/scratch/unixSeriaPort2Ops.c 2013-02-28 13:43:02.607540279 +0400
@@ -337,7 +337,10 @@
 }
 
 int isSerialPortDev(char *s) {
-       return isPrefix("ttyusb", s);
+       return isPrefix("ttyusb", s) ||
+               isPrefix("ttys", s) ||
+               isPrefix("ttyacm", s) ||
+               isPrefix("rfcomm", s);
 }
 
 int isPrefix(char *prefix, char *s) {

cool. If you have a github account you could make a pull request to lightnin's repo.


http://i.imgur.com/1QqnHxQ.png

Offline

 

#3 2013-03-06 11:26:51

mikhirev
New Scratcher
Registered: 2013-03-05
Posts: 2

Re: Scratch does not display serial ports on Linux

TRocket wrote:

If you have a github account you could make a pull request to lightnin's repo.

Done: https://github.com/lightnin/Scratch_1.4/pull/1

Offline

 

Board footer