Fedora 7 Serial Port detection
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   chirag_shah
Posted On:   Wednesday, October 17, 2007 02:25 PM

we are java research students. we are working on sms based project, we have one issue of sending sms on fedora 7 with fargo maestro 20 gsm modem.Our Modem is connected to Serial Port. Before I proceed let me tell you that we are newbies in Linux & having average knowlegde of java, j2me... We have installed sun java in the linux box..then comm.jar api. the deployment of the .so & java.comm jar is done as per specified our application is based on the following code: http://www.java-samples.com/showtutorial.php?tutorialid=22 we have complied java files...then we have written the shell file for running the java class file.    More>>

we are java research students.

we are working on sms based project, we have one issue of sending sms on fedora 7 with fargo maestro 20 gsm modem.Our Modem is connected to Serial Port.


Before I proceed let me tell you that we are newbies in Linux & having average knowlegde of java, j2me...



We have installed sun java in the linux box..then comm.jar api.

the deployment of the .so & java.comm jar is done as per specified



our application is based on the following code:

http://www.java-samples.com/showtutorial.php?tutorialid=22


we have complied java files...then we have written the shell file for running the java class file.


--------------------------------------------------------------------------------

			
//DemoSms.java
public class DemoSms
{
public static void main(String args[])
{
SMSClient sc = new SMSClient(1);
sc.sendMessage("MyCellNo","Hello");
}

}
//ends here

--------------------------------------------------------------------------------

			
#shell file

JAVA_HOME=/opt/jdk1.5.0_12
CLASSPATH=/opt/sms:$JAVA_HOME/jre/lib/comm.jar

$JAVA_HOME/bin/java -cp $CLASSPATH DemoSms

#shell file ends here



--------------------------------------------------------------------------------

			
/*
Console message errors we get are as follows
*/


[root@TEST ~]# sh SmsSend.sh
/dev/ttyS0
PortId = javax.comm.CommPortIdentifier@173a10f
java.io.IOException: Not all params are supported by kernel
at com.sun.comm.LinuxSerial.nativeSetSerialPortParams (Native Method)
at com.sun.comm.LinuxSerial.setSerialPortParams(Linux Serial.java:346)
at SerialConnection.setConnectionParameters(SerialCon nection.java:167)
at SerialConnection.openConnection(SerialConnection.j ava:100)
at Sender.send(Sender.java:44)
at SMSClient.run(SMSClient.java:39)
at java.lang.Thread.run(Thread.java:595)

[1]+ Stopped sh SmsSend.sh
[root@TEST ~]# sh SmsSend.sh
/dev/ttyS0
PortId = javax.comm.CommPortIdentifier@173a10f


java.lang.RuntimeException:
Error opening "/dev/ttyS0"
lockf(): Resource temporarily unavailable
at com.sun.comm.LinuxDriver.getCommPort(LinuxDriver.j ava:66)
at javax.comm.CommPortIdentifier.open(CommPortIdentif ier.java:369)
at SerialConnection.openConnection(SerialConnection.j ava:89)
at Sender.send(Sender.java:44)
at SMSClient.run(SMSClient.java:39)
at java.lang.Thread.run(Thread.java:595)

--------------------------------------------------------------------------------


As we are newbies we are not able to trace where the actual problem is...

We have used this modem in windows env and it runs perfectly..


We have tried configuring minicom also to try to send sms but we have failed in doing so..

We have already put around 20 hours trying to find the error but with no use..

Your help is very much appreciated...



Please help!!!..

   <<Less

Re: Fedora 7 Serial Port detection

Posted By:   Christopher_Koenigsberg  
Posted On:   Saturday, October 20, 2007 06:48 PM

well, if it were me I'd say, so the API is trying to do a "lockf" system call, on the file descriptor, but it's failing?



you are delving beyond the limits of Java API's, I'm afraid. I used to do some C/Unix systems programming in decades past and this sounds like that kind of stuff.



Is the device's file descriptor maybe really locked by another process? did you run your program earlier and did it maybe acquire the lock without releasing it?



is there a different system call (flock, fcntl etc.) it should use instead? (I think nowadays usually 2 of them are implemented in terms of the 3rd one underneath, right? I forget, I think flock was the original BSD syscall, but lockf was the original SysV syscall, and I forget where fcntl came in? etc.)



is it a temporary condition or does it always fail? is there something you can set in the API, a flag or switch or argument, to tell it not to try and do the lockf? etc.
About | Sitemap | Contact