diff options
Diffstat (limited to 'recipes-extended/rxtx/files/multiple_property_dirs.patch')
| -rw-r--r-- | recipes-extended/rxtx/files/multiple_property_dirs.patch | 168 |
1 files changed, 168 insertions, 0 deletions
diff --git a/recipes-extended/rxtx/files/multiple_property_dirs.patch b/recipes-extended/rxtx/files/multiple_property_dirs.patch new file mode 100644 index 0000000..6664966 --- /dev/null +++ b/recipes-extended/rxtx/files/multiple_property_dirs.patch | |||
| @@ -0,0 +1,168 @@ | |||
| 1 | Description: Handles the case when "java.ext.dirs" system property contains | ||
| 2 | more than one directory. | ||
| 3 | Author: Philip Ashmore <contact@philipashmore.com> | ||
| 4 | Bug: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=646069 | ||
| 5 | Index: rxtx/src/gnu/io/RXTXCommDriver.java | ||
| 6 | =================================================================== | ||
| 7 | --- rxtx.orig/src/gnu/io/RXTXCommDriver.java 2011-10-28 13:02:43.046717064 -0400 | ||
| 8 | +++ rxtx/src/gnu/io/RXTXCommDriver.java 2011-10-28 13:02:43.186717068 -0400 | ||
| 9 | @@ -356,7 +356,7 @@ | ||
| 10 | First try to register ports specified in the properties | ||
| 11 | file. If that doesn't exist, then scan for ports. | ||
| 12 | */ | ||
| 13 | - for (int PortType=CommPortIdentifier.PORT_SERIAL;PortType<=CommPortIdentifier.PORT_PARALLEL;PortType++) { | ||
| 14 | + for (int PortType=CommPortIdentifier.PORT_SERIAL; PortType<=CommPortIdentifier.PORT_PARALLEL; PortType++) { | ||
| 15 | if (!registerSpecifiedPorts(PortType)) { | ||
| 16 | if (!registerKnownPorts(PortType)) { | ||
| 17 | registerScannedPorts(PortType); | ||
| 18 | @@ -375,10 +375,18 @@ | ||
| 19 | while (tok.hasMoreElements()) | ||
| 20 | { | ||
| 21 | String PortName = tok.nextToken(); | ||
| 22 | - | ||
| 23 | - if (testRead(PortName, PortType)) | ||
| 24 | + if(debug) | ||
| 25 | + System.out.println("Trying " + PortName + "."); | ||
| 26 | + if (testRead(PortName, PortType)) { | ||
| 27 | CommPortIdentifier.addPortName(PortName, | ||
| 28 | PortType, this); | ||
| 29 | + if(debug) | ||
| 30 | + System.out.println("Success: Read from " + PortName + "."); | ||
| 31 | + }else{ | ||
| 32 | + if(debug) | ||
| 33 | + System.out.println("Fail: Cannot read from " + PortName | ||
| 34 | + + "."); | ||
| 35 | + } | ||
| 36 | } | ||
| 37 | } | ||
| 38 | |||
| 39 | @@ -402,26 +410,39 @@ | ||
| 40 | private boolean registerSpecifiedPorts(int PortType) | ||
| 41 | { | ||
| 42 | String val = null; | ||
| 43 | - Properties origp = System.getProperties();//save system properties | ||
| 44 | - | ||
| 45 | - try | ||
| 46 | - { | ||
| 47 | + Properties origp = System.getProperties(); // save system properties | ||
| 48 | |||
| 49 | - String ext_dir=System.getProperty("java.ext.dirs")+System.getProperty("file.separator"); | ||
| 50 | - FileInputStream rxtx_prop=new FileInputStream(ext_dir+"gnu.io.rxtx.properties"); | ||
| 51 | - Properties p=new Properties(); | ||
| 52 | - p.load(rxtx_prop); | ||
| 53 | - System.setProperties(p); | ||
| 54 | - for (Iterator it = p.keySet().iterator(); it.hasNext();) { | ||
| 55 | - String key = (String) it.next(); | ||
| 56 | - System.setProperty(key, p.getProperty(key)); | ||
| 57 | - } | ||
| 58 | - }catch(Exception e){ | ||
| 59 | - if (debug){ | ||
| 60 | - System.out.println("The file: gnu.io.rxtx.properties doesn't exists."); | ||
| 61 | - System.out.println(e.toString()); | ||
| 62 | - }//end if | ||
| 63 | + String [] ext_dirs = System.getProperty("java.ext.dirs").split(":"); | ||
| 64 | + String fs = System.getProperty("file.separator"); | ||
| 65 | + for (int n = 0; n < ext_dirs.length; ++n) { | ||
| 66 | + String ext_file = "?"; | ||
| 67 | + try{ | ||
| 68 | + ext_file = ext_dirs[n] + fs + "gnu.io.rxtx.properties"; | ||
| 69 | + FileInputStream rxtx_prop = new FileInputStream(ext_file); | ||
| 70 | + Properties p=new Properties(); | ||
| 71 | + p.load(rxtx_prop); | ||
| 72 | + System.setProperties(p); | ||
| 73 | + for (Iterator it = p.keySet().iterator(); it.hasNext();) { | ||
| 74 | + String key = (String) it.next(); | ||
| 75 | + String value = p.getProperty(key); | ||
| 76 | + if(debug) { | ||
| 77 | + System.out.println(key + " -> " + value); | ||
| 78 | + } | ||
| 79 | + System.setProperty(key, value); | ||
| 80 | + } | ||
| 81 | + }catch(Exception e){ | ||
| 82 | + if (debug){ | ||
| 83 | + System.out.println("The file \"" + ext_file | ||
| 84 | + + "\" doesn't exist."); | ||
| 85 | + System.out.println(e.toString()); | ||
| 86 | + }//end if | ||
| 87 | + continue; | ||
| 88 | }//end catch | ||
| 89 | + if (debug){ | ||
| 90 | + System.out.println("Read properties from \"" + ext_file | ||
| 91 | + + "\"."); | ||
| 92 | + }//end if | ||
| 93 | + }//end for | ||
| 94 | |||
| 95 | if (debug) | ||
| 96 | System.out.println("checking for system-known ports of type "+PortType); | ||
| 97 | Index: rxtx/src/SerialImp.c | ||
| 98 | =================================================================== | ||
| 99 | --- rxtx.orig/src/SerialImp.c 2011-10-28 13:02:43.078717065 -0400 | ||
| 100 | +++ rxtx/src/SerialImp.c 2011-10-28 13:02:43.190717067 -0400 | ||
| 101 | @@ -4359,7 +4359,11 @@ | ||
| 102 | |||
| 103 | if( fd < 0 ) | ||
| 104 | { | ||
| 105 | - report_verbose( "testRead() open failed\n" ); | ||
| 106 | + report_verbose( "testRead() open \"" ); | ||
| 107 | + report_verbose( name ); | ||
| 108 | + report_verbose( "\" failed: " ); | ||
| 109 | + report_verbose( strerror(errno) ); | ||
| 110 | + report_verbose( "\n" ); | ||
| 111 | ret = JNI_FALSE; | ||
| 112 | goto END; | ||
| 113 | } | ||
| 114 | @@ -5095,7 +5099,7 @@ | ||
| 115 | exceptions: none | ||
| 116 | comments: | ||
| 117 | ----------------------------------------------------------*/ | ||
| 118 | -void report_warning(char *msg) | ||
| 119 | +void report_warning(const char *msg) | ||
| 120 | { | ||
| 121 | #ifndef DEBUG_MW | ||
| 122 | fprintf(stderr, msg); | ||
| 123 | @@ -5113,7 +5117,7 @@ | ||
| 124 | exceptions: none | ||
| 125 | comments: | ||
| 126 | ----------------------------------------------------------*/ | ||
| 127 | -void report_verbose(char *msg) | ||
| 128 | +void report_verbose(const char *msg) | ||
| 129 | { | ||
| 130 | #ifdef DEBUG_VERBOSE | ||
| 131 | #ifdef DEBUG_MW | ||
| 132 | @@ -5132,7 +5136,7 @@ | ||
| 133 | exceptions: none | ||
| 134 | comments: | ||
| 135 | ----------------------------------------------------------*/ | ||
| 136 | -void report_error(char *msg) | ||
| 137 | +void report_error(const char *msg) | ||
| 138 | { | ||
| 139 | #ifndef DEBUG_MW | ||
| 140 | fprintf(stderr, msg); | ||
| 141 | @@ -5150,7 +5154,7 @@ | ||
| 142 | exceptions: none | ||
| 143 | comments: | ||
| 144 | ----------------------------------------------------------*/ | ||
| 145 | -void report(char *msg) | ||
| 146 | +void report(const char *msg) | ||
| 147 | { | ||
| 148 | #ifdef DEBUG | ||
| 149 | # ifndef DEBUG_MW | ||
| 150 | Index: rxtx/src/SerialImp.h | ||
| 151 | =================================================================== | ||
| 152 | --- rxtx.orig/src/SerialImp.h 2011-10-28 13:02:43.162717067 -0400 | ||
| 153 | +++ rxtx/src/SerialImp.h 2011-10-28 13:02:43.194717067 -0400 | ||
| 154 | @@ -467,10 +467,10 @@ | ||
| 155 | jboolean is_interrupted( struct event_info_struct * ); | ||
| 156 | int send_event(struct event_info_struct *, jint, int ); | ||
| 157 | void dump_termios(char *,struct termios *); | ||
| 158 | -void report_verbose(char *); | ||
| 159 | -void report_error(char *); | ||
| 160 | -void report_warning(char *); | ||
| 161 | -void report(char *); | ||
| 162 | +void report_verbose(const char *); | ||
| 163 | +void report_error(const char *); | ||
| 164 | +void report_warning(const char *); | ||
| 165 | +void report(const char *); | ||
| 166 | void throw_java_exception( JNIEnv *, char *, char *, char * ); | ||
| 167 | int lock_device( const char * ); | ||
| 168 | void unlock_device( const char * ); | ||
