SageTV Community  

Go Back   SageTV Community > SageTV Development and Customizations > SageTV Github Development
Forum Rules FAQs Community Downloads Today's Posts Search

Notices

SageTV Github Development Discussion related to SageTV Open Source Development. Use this forum for development topics about the Open Source versions of SageTV, hosted on Github.

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 03-28-2016, 02:02 PM
jjyec jjyec is offline
Sage User
 
Join Date: Jan 2007
Posts: 7
Hauppauge HDPVR blaster / Linux

Under Linux, with the HDPVR blaster over i2c-0, I seem to be hitting a bug where whenever the blaster is closed I get a trap. Seems like it runs the first time then traps after this:
Stack: [0x00007f1412e11000,0x00007f1412f12000], sp=0x00007f1412f0fcb0, free space=1019k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
C [PVR150Tuner.so+0x1c53] PlayCommand+0x63
j sage.SFIRTuner.playCommand(Lsage/SFIRTuner$Remote;Ljava/lang/String;I)V+0
j sage.SFIRTuner.playCommand(Ljava/lang/String;Ljava/lang/String;IZ)V+93
j sage.api.Global$37.runSafely(Lsage/Catbert$FastStackLjava/lang/Object;+47
J 1548 C1 sage.PredefinedJEPFunction.run(Lsage/Catbert$FastStackV (152 bytes) @ 0x00007f1435550612 [0x00007f1435550420+0x1f2]
J 1547 C1 sage.Catbert.evaluateAction(Ljava/lang/String;Ljava/lang/String;[Ljava/lang/ObjectLjava/lang/Object; (90 bytes) @ 0x00007f143554f5a5 [0x00007f143554e900+0xca5]
I traced it down to the bit of code in java/sage/SFIRTuner.java:
public void playTuneString(String remoteName, String cmdString, boolean forceSynchronous)
...
...
// To deal with reinitializing the IR XMT for the 150 on Linux after the receive fails
if (!Sage.WINDOWS_OS && devFilename.endsWith("PVR150Tuner.so"))
{
closeDevice();
Seems like PVR150Tuner.so expects an argument to the closeDevice function. I suspect the first time it's called the contents of this non-existing argument is null, so the function simply returns, but later on the contents point to some garbage causing the trap.

From native/so/PVR150Tuning/PVR150Tuner.c:
void CloseDevice(int devHandle)
{
if(devHandle==0)
return;
IRBlasterData *irb=(IRBlasterData *) devHandle;
close(irb->i2cfile);
The problem is, openDevice is called in SFIRTuner.java but the device handle is not saved.

I'm a professional C coder, but Java's not my thing, yet. Not sure how this Java/native interface stuff works.
Reply With Quote
  #2  
Old 03-28-2016, 04:07 PM
Narflex's Avatar
Narflex Narflex is offline
Sage
 
Join Date: Feb 2003
Location: Redondo Beach, CA
Posts: 6,349
Interesting...but the arg isn't the problem....let me point you in the right direction and you'll see.

The closeDevice() function in Java will map to the Java_sage_SFIRTuner_closeDevice() function in C. That is defined in native/so/IVTVCapture/sage_SFIRTuner.c. In there you'll see that it dynamically looks up the symbol for the method; and then calls it by passing an argument which is cast to an integer....huh...interesting. There's a bunch of stuff in that file that looks like it's assuming a 32 bit environment...so if you're on 64-bit...then that sounds like a likely culprit. If that fixes it; please commit your change.
__________________
Jeffrey Kardatzke
Google
Founder of SageTV
Reply With Quote
  #3  
Old 03-28-2016, 11:05 PM
troll5501 troll5501 is offline
Sage Advanced User
 
Join Date: Jun 2006
Posts: 136
Based on your stack trace, it looks like the issue may be somewhere in Java_sage_SFIRTuner_playCommand (in sage_SFIRTuner.c) or possibly in PlayCommand (in PVR150Tuner.c).

Code:
Stack: [0x00007f1412e11000,0x00007f1412f12000], sp=0x00007f1412f0fcb0, free space=1019k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
C [PVR150Tuner.so+0x1c53] PlayCommand+0x63
j sage.SFIRTuner.playCommand(Lsage/SFIRTuner$Remote;Ljava/lang/String;I)V+0
The issue Narflex is pointing out seems to exist in both Java_sage_SFIRTuner_closeDevice and Java_sage_SFIRTuner_playCommand, and maybe other places too. The casting related to the dlsym() calls and "LPFN" types look suspicious.

This is somewhat similar to an issue I fixed that was crashing the JVM whenever a tuner plugin was selected/opened. The issue ended up being inside Java_sage_SFIRTuner_init0 (in sage_SFIRTuner.c) where a pointer resulting from a dlopen() was cast to int. Take a look at the details here: http://github.com/google/sagetv/pull/75
__________________
Server: HP DL380 G6, VMware ESXi 5.0 with HW passthrough for USB and Firewire, 4 x HD-PVR, ZFS storage
SageTV: Production: 7.1.9+Java 1.6.0_32 on XP, Test: 9.0.4.291+Java 1.8.0_72 on Linux 64-bit
Clients: 2 x Sage HD200 Extender, 1 x Sage HD100 Extender
Sources: 4 x Motorola DCH-3200 (firewire channel changing), HD Homerun Prime, OpenDCT 0.5.7
Reply With Quote
  #4  
Old 03-29-2016, 04:29 AM
jjyec jjyec is offline
Sage User
 
Join Date: Jan 2007
Posts: 7
Thanks Troll5501, the pointers Narflex gave were on the money and I saw your change in git. The stack dump I sent was actually from a run where I had commented out the closeDevice functio. I beleive I got the IR Blaster almost working now, but for some reason I'm still investigating, I'm not getting the correct codes coming out, but I'm close. I'll share my changes when it works.
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Bug in HDPVR Blaster Control Diego Garcia Hardware Support 17 04-22-2010 12:30 PM
IR blaster with HDPVR bobsj2000 Hardware Support 6 11-20-2009 10:57 PM
Defective Blaster or HDPVR? ksed Hardware Support 2 06-23-2009 11:02 AM
HDPVR ir blaster Wire pat_smith1969 Hardware Support 0 07-14-2008 04:14 PM
Linux SageTV and the Hauppauge IR Blaster??? obrien.dan SageTV Linux 3 07-27-2006 02:01 PM


All times are GMT -6. The time now is 02:08 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2023, vBulletin Solutions Inc.
Copyright 2003-2005 SageTV, LLC. All rights reserved.