

![]() | Start a set with this search |
![]() | Include this search in one of my sets |
![]() | Exclude this search from one of my sets |
![]() | Permalink to these results Paste this link in email or IM: |
| Atom feed for tracking future search results Paste this URL into your reader: |
13 messages in net.java.dev.jna.usersRe: [jna-users] handling serial port ...| From | Sent On | Attachments |
|---|---|---|
| zamek | Mar 11, 2008 11:58 am | |
| Marc Ravensbergen | Mar 11, 2008 12:24 pm | |
| zamek | Mar 11, 2008 1:47 pm | |
| Timothy Wall | Mar 12, 2008 5:38 am | |
| zamek | Mar 12, 2008 2:34 pm | |
| Timothy Wall | Mar 12, 2008 4:36 pm | |
| zamek | Mar 13, 2008 1:12 pm | |
| Timothy Wall | Mar 13, 2008 5:04 pm | .java |
| zamek | Mar 14, 2008 7:26 am | |
| Timothy Wall | Mar 14, 2008 8:20 am | |
| zamek | Mar 14, 2008 8:51 am | |
| Timothy Wall | Mar 17, 2008 6:58 am | |
| zamek | Mar 17, 2008 11:22 am |

![]() | Permalink for this message Paste this link in email or IM: |
![]() | Permalink for this thread Paste this link in email or IM: |
| Atom feed for this thread Paste this URL into your reader: |
| Subject: | Re: [jna-users] handling serial port with jan on linux | Actions... |
|---|---|---|
| From: | Timothy Wall (twal...@dev.java.net) | |
| Date: | Mar 12, 2008 4:36:37 pm | |
| List: | net.java.dev.jna.users | |
For one thing, your sigset_t should be a total of 128 bytes (yours is 256); note that Java long is *not* the same thing as native long (NativeLong is). I don't think that would prevent the signal handler from being called, though.
strace might help to see what's going on.
On Mar 12, 2008, at 5:34 PM, zamek wrote:
hi all,
I would like to test serial port handling in Linux with jna. Open, read and close is working well, but I cannot install signal handler. Seems to be I am new in jna and perhaps I made some mistake in declarations of signal handler. Could anybody help me to install signal handler?
return value of sigaction (saRes) is 0, but signal.callback never called:(
here is the code snippet:
------------------------------------------------------------------ SignalHandler_t signal = new SignalHandler_t (){ @Override public void callback(int signal) { int st = 0; CLibrary.INSTANCE.ioctl(dev, CLibrary.TIOCMGET, st); st &= ~CLibrary.TIOCM_RTS; CLibrary.INSTANCE.ioctl(dev, CLibrary.TIOCMSET, st); st |= CLibrary.TIOCM_RTS; CLibrary.INSTANCE.ioctl(dev, CLibrary.TIOCMSET, st); }};
...
SigActionStruct saio = new SigActionStruct(); saio.sa_handler = this.signal; CLibrary.INSTANCE.sigemptyset(saio.sa_mask); saio.sa_flags = 0; saio.sa_restorer = null; int saRes = CLibrary.INSTANCE.sigaction(CLibrary.SIGIO, saio, null);
------------------------------------------------------------------
public interface SignalHandler_t extends Callback { public void callback(int signal); }
public interface SignalAction extends Callback { public void callback (int a, Pointer info, Pointer p); }
public static class SigSet_t extends Structure { public long sig[] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}; }
public interface SignalRestorer extends Callback { public void callback(); }
public static class SigActionStruct extends Structure { public SignalHandler_t sa_handler; public SignalAction sa_sigaction; public SigSet_t sa_mask; public int sa_flags; public SignalRestorer sa_restorer; }
-- thx, ---------------------------------- Zoltan Zidarics programmer PTE-PMMFK H-7621 Pecs, Boszorkany u. 2. Hungary E-Mail: zam...@vili.pmmf.hu ----------------------------------








.java