~ubuntu-branches/ubuntu/edgy/rxtx/edgy-201105201527

« back to all changes in this revision

Viewing changes to src/RS485Imp.c

  • Committer: Bazaar Package Importer
  • Author(s): Mario Joussen
  • Date: 2006-03-01 18:56:52 UTC
  • mfrom: (1.1.2 upstream) (2.1.1 etch)
  • Revision ID: james.westby@ubuntu.com-20060301185652-ri9941gi01goklvz
Tags: 2.1.7-2
Fixed stupid bug in clean target.
(closes: Bug#354859)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*-------------------------------------------------------------------------
2
2
|   rxtx is a native interface to RS485 ports in java.
3
 
|   Copyright 1997-2002 by Trent Jarvi taj@www.linux.org.uk
 
3
|   Copyright 1997-2004 by Trent Jarvi taj@www.linux.org.uk
4
4
|
5
5
|   This library is free software; you can redistribute it and/or
6
6
|   modify it under the terms of the GNU Library General Public
16
16
|   License along with this library; if not, write to the Free
17
17
|   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
18
18
--------------------------------------------------------------------------*/
19
 
#if defined(__MWERKS__)//dima
 
19
#if defined(__MWERKS__) /* dima */
20
20
#include "RS485.h"
21
 
#else//dima
 
21
#else /* dima */
22
22
#include "config.h"
23
23
#include "gnu_io_RS485.h"
24
 
#endif//dima
 
24
#endif /* dima */
25
25
#include <unistd.h>
26
26
#include <time.h>
27
27
#include <stdio.h>
196
196
        int cspeed = translate_speed( env, speed );
197
197
        if( !cspeed ) return;
198
198
        if( tcgetattr( fd, &ttyset ) < 0 ) goto fail;
199
 
        if( !translate_data_bits( env, (int *)&(ttyset.c_cflag), dataBits ) ) return;//dima c_cflag in darwin is unsigned long
200
 
        if( !translate_stop_bits( env, (int *)&(ttyset.c_cflag), stopBits ) ) return;//dima c_cflag in darwin is unsigned long
201
 
        if( !translate_parity( env, (int *)&(ttyset.c_cflag), parity ) ) return;//dima c_cflag in darwin is unsigned long
 
199
        if( !translate_data_bits( env, (int *)&(ttyset.c_cflag), dataBits ) ) return; /* dima c_cflag in darwin is unsigned long */
 
200
        if( !translate_stop_bits( env, (int *)&(ttyset.c_cflag), stopBits ) ) return; /* dima c_cflag in darwin is unsigned long */
 
201
        if( !translate_parity( env, (int *)&(ttyset.c_cflag), parity ) ) return;/* dima c_cflag in darwin is unsigned long */
202
202
#ifdef __FreeBSD__
203
203
        if( cfsetspeed( &ttyset, cspeed ) < 0 ) goto fail;
204
204
#else
390
390
        /* wait for the last bit to go 
391
391
         * see get_lsr_info in linux/driver/char/serial.c 
392
392
         * */
393
 
#if defined(TIOCSERGETLSR) //dima ????????? I did it in exactly the same way as in SerialImp.c
 
393
#if defined(TIOCSERGETLSR) /* dima ????????? I did it in exactly the same way as in SerialImp.c */
394
394
        do
395
395
        {
396
396
                result=ioctl(fd, TIOCSERGETLSR);
458
458
        /* wait for the last bit to go 
459
459
         * see get_lsr_info in linux/driver/char/serial.c 
460
460
         * */
461
 
#if defined(TIOCSERGETLSR) //dima ????????? I did it in exactly the same way as in SerialImp.c
 
461
#if defined(TIOCSERGETLSR) /* dima ????????? I did it in exactly the same way as in SerialImp.c */
462
462
        do
463
463
        {
464
464
                result=ioctl(fd, TIOCSERGETLSR);
907
907
        int fd = get_java_var( env, jobj, "fd", "I" );
908
908
        int timeout = get_java_var( env, jobj, "timeout", "I" );
909
909
 
910
 
        if( length > SSIZE_MAX || length < 0 ) {
 
910
        if( (size_t) length > SSIZE_MAX || (size_t) length < 0 ) {
911
911
                throw_java_exception( env, ARRAY_INDEX_OUT_OF_BOUNDS,
912
912
                        "readArray", "Invalid length" );
913
913
                return -1;
1028
1028
        jboolean interrupted = 0;
1029
1029
        jclass jclazz, jthread;
1030
1030
        jclazz = (*env)->GetObjectClass( env, jobj );
1031
 
        fd = fd = get_java_var(env, jobj, "fd", "I");
 
1031
        fd = get_java_var(env, jobj, "fd", "I");
1032
1032
        method = (*env)->GetMethodID( env, jclazz, "sendEvent", "(IZ)V" );
1033
1033
        jthread = (*env)->FindClass( env, "java/lang/Thread" );
1034
1034
        interrupt = (*env)->GetStaticMethodID( env, jthread, "interrupted", "()Z" );