high latency sending signals with usb device

The place where software developers meet

Moderator: marcus

high latency sending signals with usb device

Postby tony » Mon 17. Aug 2009, 10:35

Hi,

I'M writing a c# app using the IRTrans.NET.dll (v. 3.1.2.0) with the Irtrans USB device. I want t send ir commands to a media receiver. Usually everything works fine and the commands are send with a latency < 20ms, my Code :

.....
irt = new IRTransServer("localhost");
.....

if (null != irt) {
if (Monitor.TryEnter(irt, 250)) {
try {
long start = DateTime.Now.Ticks;
NETWORKSTATUS stat = irt.IRSend(IRTRANS_RECEIVER, command);
long diff = (DateTime.Now.Ticks - start) / 10000;
if (stat != null || diff > 200) {
logger.Error("irtrans: IR ERROR: cmd=" + command + ", " + diff + "ms");
if (stat != null) {
logger.Error("irtrans: message=" + stat.message + ", adress=" + stat.adress + ", netstatus=" + stat.netstatus + ", statuslevel=" + stat.statuslevel);
}
} else {
if (logger.IsDebugEnabled) logger.Debug("irtrans: cmd=" + command + ", " + diff + "ms");
}
} catch (System.Net.Sockets.SocketException sockEx) {
logger.Error("irtrans: " + sockEx, sockEx);
} catch (IRTrans.NET.IRTransConnectionException connEx) {
logger.Error("irtrans: " + connEx, connEx);
} catch (Exception ex) {
logger.Error("irtrans: " + ex, ex);
} finally {
Monitor.Exit(irt);
}
} else {
logger.Error("irtrans: IrSend currently locked by another thread, cmd=" + command);
}

Sometimes, the latency (diff) is up to 4 Seconds and more to send a signal. The System load is less than 5%. Do you have any idea how to resolve that problem?
I have 15 systems and every system has the same problem. Irtrans Server is running as a windows service, IrServer Version is 6.2.23.0. Operating System is Windows XP, SP3

Best Regards,

Tony
tony
 
Posts: 7
Joined: Wed 29. Jul 2009, 09:07

Re: high latency sending signals with usb device

Postby IRTrans » Mon 17. Aug 2009, 13:02

Hi Tony,
no idea what the problem might be - so far I have not seen that.

Do you stay connected to the irserver or do you close the connection each time ?
If you disconnect the problem might be caused by the name resolution.

You could also enable logging for the irserver (-loglevel 4) to see what happens when.

Did you try sending codes using the IRTrans GUI Client ? - Does it happen there, too ?

IRTrans
IRTrans
Administrator
 
Posts: 2115
Joined: Mon 21. Apr 2008, 23:32

Re: high latency sending signals with usb device

Postby tony » Mon 17. Aug 2009, 14:18

Hi,

I connect after checking that the service is running and stay connected. I already tried the usb tray client and the behaviour is the same.
The next step is enabling the logging, and additionallly trying out using the IRTrans.ocx.

Tony
tony
 
Posts: 7
Joined: Wed 29. Jul 2009, 09:07

Re: high latency sending signals with usb device

Postby IRTrans » Mon 17. Aug 2009, 14:24

Hi,
please try to use the GUI Client for sending it is sort of our reference.

Furthermore: Which IRServer SW Version and FW version are you using ?

IRTrans
IRTrans
Administrator
 
Posts: 2115
Joined: Mon 21. Apr 2008, 23:32

Re: high latency sending signals with usb device

Postby tony » Mon 17. Aug 2009, 20:57

Hi,

using the gui client, i cannot see how long it takes to send a command. For Example, when I send a signal 20 times in one second, it is heavy to see if a signal is blocked, and sending different signals in a short interval is nearly impossible to do. I set the loglevel to 4, but neither in the file "irserver.log" nor in the event log are detailed log informations. Where do I find the additional log information?
I use the IrServer Version 6.2.23, Firmware Version is 3.8.
Could it be, that the USB Bus cause the problems if other devices are connected too?

Greetings,

Tony
tony
 
Posts: 7
Joined: Wed 29. Jul 2009, 09:07

Re: high latency sending signals with usb device

Postby IRTrans » Mon 17. Aug 2009, 22:06

To see the logging it would be the best to start the irserver using irtranstray.exe and not as a service - using the service makes debugging a lot more complicated.

Sending 20 IR codes in one second is not very useful - most IR Codes have a length of 200-500ms.

If you overload the system with that many IR Codes delays might come from waiting / synchronizing: You send 20 IR codes. The IP stack of the server
can read and buffer a few kb of data. Sending the 20 IR Codes with 250ms length each will take 5s. That explains the delay.

3.8 seems to be the hardware version - the firmware version is shown when the server is started.

Normally that should not be USB problems.

IRTrans
IRTrans
Administrator
 
Posts: 2115
Joined: Mon 21. Apr 2008, 23:32

Re: high latency sending signals with usb device

Postby tony » Tue 18. Aug 2009, 09:59

Hi,

this is the debug log of a delayed signal. I tried to send 2 signals, the first one has a delay of 1250 ms:

myApps.log
[Thread-1] DEBUG| 11:29:50 671|IRSender: 37 irtrans: ------------------start irtrans-------------------------
[Thread-4] DEBUG| 11:30:11 500|IRSender:135 irtrans: trying to send:onoff
[Thread-4] ERROR| 11:30:12 750|IRSender:148 irtrans: IR ERROR: cmd=onoff, 1250ms
[Thread-7] DEBUG| 11:30:15 375|IRSender:135 irtrans: trying to send:onoff
[Thread-7] DEBUG| 11:30:15 375|IRSender:152 irtrans: cmd=onoff, 0ms

irtrans.log
IRTRANS TCP/IP Socket connection request
IRTRANS TCP/IP Client 1 accepted from 127.0.0.1
Netcommand: 1 [1]
Send [1] digicorder - onoff [0 - B:0 M:0x0 LED: Default]
IRTRans Send status: 0 - 0 SEQ:130 TO:250
IRTRans Send status: 0 - 0 SEQ:130 TO:250
IRTRans Send status: 1 - 69 SEQ:130 TO:250
IRTRans Send Done: 4
Send Status 8 - 8 [0]
Netcommand: 1 [1]
Send [1] digicorder - onoff [0 - B:0 M:0x0 LED: Default]
IRTRans Send Done: 1
Send Status 8 - 8 [0]

and here is another one:

Send [1] digicorder - right [0 - B:0 M:0x0 LED: Default]
IRTRans Send Done: 1
Send Status 8 - 8 [0]
Netcommand: 1 [1]
Send [1] digicorder - mute [0 - B:0 M:0x0 LED: Default]
IRTRans Send status: 0 - 0 SEQ:169 TO:250
IRTRans Send status: 0 - 0 SEQ:169 TO:250
IRTRans Send status: 0 - 0 SEQ:169 TO:250
IRTRans Send status: 1 - 0 SEQ:169 TO:250
IRTRans Send status: 1 - 169 SEQ:169 TO:250
IRTRans Send status: 0 - 0 SEQ:169 TO:250
IRTRans Send status: 1 - 0 SEQ:169 TO:250
IRTRans Send status: 1 - 0 SEQ:169 TO:250
IRTRans Send status: 1 - 0 SEQ:169 TO:250
IRTRans Send status: 1 - 0 SEQ:169 TO:250
IRTRans Send Done: 10
TimeoutSend Status 272 - 272 [1]
Netcommand: 1 [1]
Send [1] digicorder - vol+ [0 - B:0 M:0x0 LED: Default]
IRTRans Send status: 0 - 0 SEQ:170 TO:250
IRTRans Send status: 1 - 0 SEQ:170 TO:250
IRTRans Send status: 1 - 170 SEQ:170 TO:250
IRTRans Send status: 0 - 0 SEQ:170 TO:250
IRTRans Send status: 1 - 0 SEQ:170 TO:250
IRTRans Send status: 1 - 170 SEQ:170 TO:250
IRTRans Send status: 0 - 0 SEQ:170 TO:250
IRTRans Send Done: 8
Send Status 8 - 8 [0]

is there a possibility to configure the timeout, to minimize the delay to e.g. 1 second and then resend the signal ?
tony
 
Posts: 7
Joined: Wed 29. Jul 2009, 09:07

Re: high latency sending signals with usb device

Postby IRTrans » Tue 18. Aug 2009, 10:39

Hmm, it looks like you are trying to send the next IR Code while the device is still busy.

I am still waiting for the firmware version ...

IRTrans
IRTrans
Administrator
 
Posts: 2115
Joined: Mon 21. Apr 2008, 23:32

Re: high latency sending signals with usb device

Postby tony » Tue 18. Aug 2009, 14:42

Hi

this is the output of the irtrans usb tray:

Init Server Socket done
Init Events done
1 USB Devices found
IRTRans Send Done: 1
Name : IRTrans USB
Version: U6.03.32
FW SNo : 41287
Capab : Power On; Soft ID; Dual Transmitter Drivers;
FW Cap : 0x43850db
FW Cap2: 0x8196c71
USB SNo: MMS7A4BR
Node : USB

Init communication ...
IRServer Version 6.02.23
[ 0]: IRTrans USB U6.03.32 SN: 41287

In the second example I'm not sure, if that is tat is the case, but in the first example, I've sended two on/off signals, one at 11:30:11 500ms and one at 11:30:15 375. between this two function calls the sending of the first signal takes 1250ms. However try to ensure the thread safety by inserting an additional log statement in the thread safe block to investigate if I am right.

Tony
tony
 
Posts: 7
Joined: Wed 29. Jul 2009, 09:07

Re: high latency sending signals with usb device

Postby IRTrans » Tue 18. Aug 2009, 15:37

We might try a newer firmware.

Please send us an email to support@irtrans.de.

IRTrans
IRTrans
Administrator
 
Posts: 2115
Joined: Mon 21. Apr 2008, 23:32

Next

Return to APIs

Who is online

Users browsing this forum: No registered users and 8 guests

cron