serialport 1.0.2 → 1.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +5 -2
- data/VERSION +1 -1
- data/ext/native/serialport.h +1 -1
- data/ext/native/win_serialport_impl.c +19 -14
- data/serialport.gemspec +2 -2
- metadata +2 -2
data/CHANGELOG
CHANGED
@@ -1,8 +1,11 @@
|
|
1
|
+
1.0.3 => 04/08/2010: [FIXED] [Windows] Could not specify 10 or "COM10" or higher
|
2
|
+
[FIXED] [Windows] Warning passing INT instead of LONG to GetCommModemStatus
|
3
|
+
|
1
4
|
1.0.2 => 04/06/2010: [FIXED] Passing a block into open did not properly handle a return from within the block
|
2
5
|
|
3
|
-
1.0.1 => 01/20/2010: [FIXED] Conditional RB_SERIAL_EXPORT
|
6
|
+
1.0.1 => 01/20/2010: [FIXED] Conditional RB_SERIAL_EXPORT needed for Visual Studio bonked GCC
|
4
7
|
|
5
|
-
1.0.0 => 01/12/2010: [FIXED] x86_64 segmentation
|
8
|
+
1.0.0 => 01/12/2010: [FIXED] x86_64 segmentation faults
|
6
9
|
[NEW] Windows Ruby 1.9 support
|
7
10
|
|
8
11
|
0.7.4 => 10/12/2009: [NEW] Conditional 1.8.6 & 1.9 support (POSIX only).
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.0.
|
1
|
+
1.0.3
|
data/ext/native/serialport.h
CHANGED
@@ -2,6 +2,7 @@
|
|
2
2
|
* Guillaume Pierronnet <moumar@netcourrier.com>
|
3
3
|
* Alan Stern <stern@rowland.harvard.edu>
|
4
4
|
* Daniel E. Shipton <dshipton@redshiptechnologies.com>
|
5
|
+
* Hector G. Parra <hector@hectorparra.com>
|
5
6
|
*
|
6
7
|
* This code is hereby licensed for public consumption under either the
|
7
8
|
* GNU GPL v2 or greater.
|
@@ -60,12 +61,8 @@ VALUE RB_SERIAL_EXPORT sp_create_impl(class, _port)
|
|
60
61
|
int fd;
|
61
62
|
HANDLE fh;
|
62
63
|
int num_port;
|
63
|
-
char *
|
64
|
-
char
|
65
|
-
"COM1", "COM2", "COM3", "COM4",
|
66
|
-
"COM5", "COM6", "COM7", "COM8"
|
67
|
-
};
|
68
|
-
//int new_fd;
|
64
|
+
char *str_port;
|
65
|
+
char port[260]; /* Windows XP MAX_PATH. See http://msdn.microsoft.com/en-us/library/aa365247(VS.85).aspx */
|
69
66
|
|
70
67
|
DCB dcb;
|
71
68
|
|
@@ -78,20 +75,28 @@ VALUE RB_SERIAL_EXPORT sp_create_impl(class, _port)
|
|
78
75
|
{
|
79
76
|
case T_FIXNUM:
|
80
77
|
num_port = FIX2INT(_port);
|
81
|
-
if (num_port < 0
|
78
|
+
if (num_port < 0)
|
82
79
|
{
|
83
80
|
rb_raise(rb_eArgError, "illegal port number");
|
84
81
|
}
|
85
|
-
|
82
|
+
sprintf(port, "\\\\.\\COM%d", num_port + 1); /* '0' is actually COM1, etc. */
|
86
83
|
break;
|
87
84
|
|
88
85
|
case T_STRING:
|
89
86
|
Check_SafeStr(_port);
|
90
87
|
#ifdef RUBY_1_9
|
91
|
-
|
88
|
+
str_port = RSTRING_PTR(_port);
|
92
89
|
#else
|
93
|
-
|
90
|
+
str_port = RSTRING(_port)->ptr;
|
94
91
|
#endif
|
92
|
+
if (str_port[0] != '\\') /* Check for Win32 Device Namespace prefix "\\.\" */
|
93
|
+
{
|
94
|
+
sprintf(port, "\\\\.\\%s", str_port);
|
95
|
+
}
|
96
|
+
else
|
97
|
+
{
|
98
|
+
sprintf(port, "%s", str_port);
|
99
|
+
}
|
95
100
|
break;
|
96
101
|
|
97
102
|
default:
|
@@ -99,13 +104,13 @@ VALUE RB_SERIAL_EXPORT sp_create_impl(class, _port)
|
|
99
104
|
break;
|
100
105
|
}
|
101
106
|
|
102
|
-
printf("SerialPort => %s\n", port);
|
103
107
|
fd = open(port, O_BINARY | O_RDWR);
|
104
|
-
printf(" fd => %i\n", fd);
|
105
108
|
if (fd == -1)
|
109
|
+
{
|
106
110
|
rb_sys_fail(port);
|
111
|
+
}
|
112
|
+
|
107
113
|
fh = (HANDLE) _get_osfhandle(fd);
|
108
|
-
printf(" fh => %i\n", fh);
|
109
114
|
if (SetupComm(fh, 1024, 1024) == 0)
|
110
115
|
{
|
111
116
|
close(fd);
|
@@ -557,7 +562,7 @@ void RB_SERIAL_EXPORT get_line_signals_helper_impl(obj, ls)
|
|
557
562
|
struct line_signals *ls;
|
558
563
|
{
|
559
564
|
HANDLE fh;
|
560
|
-
|
565
|
+
unsigned long status; /* DWORD */
|
561
566
|
|
562
567
|
fh = get_handle_helper(obj);
|
563
568
|
if (GetCommModemStatus(fh, &status) == 0)
|
data/serialport.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{serialport}
|
8
|
-
s.version = "1.0.
|
8
|
+
s.version = "1.0.3"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Guillaume Pierronnet", "Alan Stern", "Daniel E. Shipton", "Tobin Richard", "Hector Parra", "Ryan C. Payne"]
|
12
|
-
s.date = %q{2010-04-
|
12
|
+
s.date = %q{2010-04-19}
|
13
13
|
s.description = %q{Ruby/SerialPort is a Ruby library that provides a class for using RS-232 serial ports.}
|
14
14
|
s.email = %q{hector@hectorparra.com}
|
15
15
|
s.extensions = ["ext/native/extconf.rb"]
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: serialport
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Guillaume Pierronnet
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-04-
|
17
|
+
date: 2010-04-19 00:00:00 -07:00
|
18
18
|
default_executable:
|
19
19
|
dependencies: []
|
20
20
|
|