On Thu, Aug 9, 2012 at 4:02 AM, Andrius Sutas <andrius.su...@gmail.com> wrote:
> Bug with reopening closed interface fixed in r10845. Could someone please
> test package in Unix/Mac environment?
>
> On Tue, Aug 7, 2012 at 9:37 AM, Juan Pablo Carbajal <carba...@ifi.uzh.ch>
> wrote:
>>
>> On Tue, Aug 7, 2012 at 4:37 AM, Andrius Sutas <andrius.su...@gmail.com>
>> wrote:
>> > Hey,
>> >
>> > please see alpha release of Serial I/O package.
>> >
>> > I am looking for any comments on code style, usability, naming etc.
>> > Also, it
>> > would be great if people could reply on which platforms they
>> > successfully
>> > (and not, which is more important) tested it. Sorry but Windows is not
>> > yet
>> > supported.
>> >
>> > Currently open flags are hardcoded to: O_RDWR | O_NOCTTY | O_SYNC, as I
>> > yet
>> > to decide what is the best way to maintain cross-platformability and
>> > ease of
>> > use (e.g. using string for parity setting and then doing switch
>> > according to
>> > platform being used instead of making the same flags from different
>> > platforms global to Octave), comments are welcome.
>> >
>> > Also, a simple example to get started (for testing adapter's RX and TX
>> > lines
>> > are connected together):
>> >
>> > s0 = serial() # Opens default serial port ttyUSB0 in default
>> > configuration
>> > of 115200, 8-N-1
>> >
>> > s1 = serial("/dev/ttyUSB1", 115200) # Opens serial port ttyUSB1 with
>> > baudrate of 115200 (config defaults to 8-N-1)
>> > srl_flush(s1); # Flush input and output buffers
>> > srl_write(s1, "Hello world!") # Blocking write call, currently only
>> > accepts
>> > strings
>> > data = srl_read(s1, 11)  # Blocking read call, returns uint8 array of
>> > exactly 11 bytes read (data = [72  101  108  108  111   32  119  111
>> > 114
>> > 108  100])
>> >
>> > char(data) # Converts uint8 array to string, (ans = "Hello world", note:
>> > no
>> > exclamation mark)
>> >
>> > srl_baudrate(s1, 9600) # Change baudrate
>> > srl_bytesize(s1, 5) # Change byte size (config becomes 5-N-1)
>> > srl_parity(s1, "E") # Changes parity checking (config becomes 5-E-1),
>> > possible values [E]ven, [O]dd, [N]one.
>> > srl_stopbits(s1, 2) # Changes stop bits (config becomes 5-E-2), possible
>> > values 1, 2.
>> >
>> > s2 = serial("/dev/ttyS0", 9600, 6, "odd", 2) # Opens serial port ttyS0
>> > in
>> > 9600, 6-O-2 configuration
>> >
>> > srl_close(s0) # Closes and releases file descriptor
>> >
>> >
>> > ------------------------------------------------------------------------------
>> > Live Security Virtual Conference
>> > Exclusive live event will cover all the ways today's security and
>> > threat landscape has changed and how IT managers can respond.
>> > Discussions
>> > will include endpoint security, mobile security and the latest in
>> > malware
>> > threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
>> > _______________________________________________
>> > Octave-dev mailing list
>> > Octave-dev@lists.sourceforge.net
>> > https://lists.sourceforge.net/lists/listinfo/octave-dev
>> >
>>
>> Hi Andrius,
>>
>> Thanks for the first release!
>>
>> When installing on Ubuntu 10.10, gcc version 4.4.5 (Ubuntu/Linaro
>> 4.4.4-14ubuntu5.1) I get the following deprecation warning
>>
>> srl_read.cc: In function ‘octave_value_list Fsrl_read(const
>> octave_value_list&, int)’:
>> srl_read.cc:92: warning: ‘void Array<T>::resize(octave_idx_type) [with
>> T = octave_int<unsigned char>]’ is deprecated (declared at
>> /usr/local/include/octave-3.6.2/octave/../octave/Array.h:459)
>>
>> but I guess this is something in core.
>>
>> I have no usb-to-serial at hand (I am away from my lab) but I tested
>> using virtual loopback using pseudo terminals.
>> (for the ones who wan to try: In linux install "socat" and then run
>> "socat -d -d PTY: PTY:")
>> The following lines work as expected
>>
>> pkg load serial
>> s1 = serial("/dev/ptmx", 115200);
>> srl_flush(s1);
>> srl_write(s1, "Hello world!")
>> data = srl_read(s1,12);
>> char(data)
>> srl_close(s1)
>>
>> However when run again I get
>>
>> s1 = serial("/dev/ptmx", 115200);
>> srl_flush(s1);
>> srl_write(s1, "Hello world!");
>> data = srl_read(s1,12);
>> error: srl_read: Invalid resizing operation or ambiguous assignment to
>> an out-of-bounds array element
>>
>> This may be due to the virtual loopback. I will try again with
>> hardware later, but it would be nice to see why there is a problem (if
>> there is!) with virtual loopbacks.
>>
>>
>> --
>> M. Sc. Juan Pablo Carbajal
>> -----
>> PhD Student
>> University of Zürich
>> http://ailab.ifi.uzh.ch/carbajal/
>
>

Hi,
Tested on Ubuntu 10.04 and it works fine. Several calls to the test do not break

Request: srl_read is blocking that is ok, however if by error we
called srl_read and there is nothing written on the port Octave hangs
and not even ctrl-C releases the block. the only solution is to kill
Octave. Can that be fixed?


-- 
M. Sc. Juan Pablo Carbajal
-----
PhD Student
University of Zürich
http://ailab.ifi.uzh.ch/carbajal/

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Octave-dev mailing list
Octave-dev@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/octave-dev

Reply via email to