NextPVR Forums
  • ______
  • Home
  • New Posts
  • Wiki
  • Members
  • Help
  • Search
  • Register
  • Login
  • Home
  • Wiki
  • Members
  • Help
  • Search
NextPVR Forums Public Developers v
« Previous 1 … 14 15 16 17 18 … 93 Next »
WinLIRC as a channel changer

 
  • 0 Vote(s) - 0 Average
WinLIRC as a channel changer
rheslip
Offline

Junior Member

Posts: 32
Threads: 4
Joined: Jan 2005
#1
2005-01-06, 05:31 PM
I was looking for a simple and inexpensive way to make GBPVR change channels on my Starchoice satellite box. After some fooling around I managed to get this working.

You will need WinLIRC http://winlirc.sourceforge.net/. There are instructions there on installation, configuration and how to make a simple $5 IR blaster that plugs into your serial port. You will need the file "transmit.exe" which unfortunately they left out of the latest v6.5. It can be found in some older archives such as 6.4 at http://cmail.info.kuzbass.net/~nav/

The hard part is getting the IR codes for your tuner. WinLIRC has a learning feature (which requires additional hardware) but I found it's not that accurate at capturing the IR timings. I ended  up using a scope to measure the IR timings but now they are dead on. If you are lucky you can find what you need for your tuner - I can post my WinLIRC.RC config file which works for the Starchoice box if that helps somebody.

I wrote a simple jscript program which calls transmit.exe to send the IR codes. You will have to put a copy of transmit.exe in \windows\system32. You will also have to have WinLIRC running, setting it up in you windows startup is probably a good idea so its running after a reboot.

/////////////////////////////////////////////////////////////////////////////
var cmdline;

var WshShell = new ActiveXObject("WScript.Shell&quotWink;

objArgs = WScript.Arguments;

// channel changer script for GBPVR
// r heslip jan 1 2005
//
// executes WinLIRC "transmit.exe" three times to send the three digits
// usage:
// channel <remote> <channel> <repeats> <delay>
// <remote> is the remote name as defined in winlirc.rc
// <channel> is the three digit channel number
// <repeats> is a repeat count passed to transmit.exe
// <delay> is the delay in milliseconds to wait before transmitting again

cmdline=new String ("transmit &quotWink;

cmdline=cmdline + objArgs(0)+ " " + objArgs(1).substr(0,1) +" " + objArgs(2);


//WScript.Echo(cmdline); // helps with debugging !

var oExec = WshShell.Exec(cmdline);

while (oExec.Status == 0)
{
    WScript.Sleep(10);
}

WScript.Sleep(objArgs(3));

cmdline="transmit ";
cmdline=cmdline + objArgs(0)+ " " + objArgs(1).substr(1,1) +" " + objArgs(2);

// WScript.Echo(cmdline);

var oExec = WshShell.Exec(cmdline);

while (oExec.Status == 0)
{
    WScript.Sleep(10);
}

WScript.Sleep(objArgs(3));

cmdline="transmit ";
cmdline=cmdline + objArgs(0)+ " " + objArgs(1).substr(2,1) +" " + objArgs(2);

// WScript.Echo(cmdline);

var oExec = WshShell.Exec(cmdline);

while (oExec.Status == 0)
{
    WScript.Sleep(10);
}
/////////////////////////////////////////////////////////////////

GBPVR must pass the script 4 parameters - the name of the remote as configured in WinLIRC (in my case its "star&quotWink, the 3 digit channel number, an IR repeat count, and the delay in milliseconds between IR commands. I use a repeat of 1 and a delay of 1000ms - you may have to change this for your tuner.

Configure GBPVR for an external .exe channel changer. The executable is windows script host:

\WINDOWS\system32\wscript.exe

The parameter string in my case is:

"\Program Files\devnz\gbpvr\Winlirc PVR files\channel.js" star {channel} 1 1000

The quotes around the script path are required. I installed the WinLIRC stuff in a subdir of GBPVR as you can see. Check the zero pad and 3 digit channel number boxes. If you have a 2 digit tuner, take out the last block that calls transmit.exe in the script.

Its possible you might need the latest windows scripting host (5.6 ?) to make this work but it works fine on my XP Pro SP1 installation as is.

WinLIRC seems to suck up a lot of CPU when its transmitting. On a Duron 900mhz box GBPVR would sometimes go back to the main menu when changing channels in Live TV, but it changed channels for recordings properly. On a P4 1.7ghz there is no problem.

Hope this helps somebody.

Rich
jrockintuitive
Offline

Senior Member

Posts: 292
Threads: 19
Joined: Dec 2004
#2
2005-01-06, 06:39 PM
Can we get this posted somewhere that all new users can find this. - or at least somewhere prominent on wiki.

I'm all setup but if I could avoided the cost of the usb-uirt device i would have.

Nice work.
rheslip
Offline

Junior Member

Posts: 32
Threads: 4
Joined: Jan 2005
#3
2005-01-07, 12:12 AM
For the sake of completeness, here is the WinLIRC config file I'm using for the Starchoice 301 receiver (made by Motorola)

Rich


#
#
# WinLIRC 0.6.5 (LIRC 0.6.1pre3) on Sun Nov 14 18:09:07 2004
#
# contributed by R Heslip
#
# brand: Starchoice satellite receiver (Motorola)
# model: 301
# supported devices: very basic channel changer
#
# note: most of the numbers below are timings in microseconds as measured on the remote
# this codeset is almost identical in timing to the original remote
# be careful with "gap" - if its shorter than the sum of header + all the bits
# + ptrail, winLIRC 6.5 crashes very ungracefully !
#

begin remote

name star
bits 12
flags SPACE_ENC
eps 25
aeps 100

header 5600 2000
one 1000 2900
zero 1050 950
ptrail 1000
gap 60854
toggle_bit 0
min_repeat 2
frequency 38000


begin codes
1 0x0000000000000F04
2 0x0000000000000886
3 0x000000000000048C
4 0x0000000000000E83
5 0x000000000000098B
6 0x0000000000000D8D
7 0x000000000000050B
8 0x0000000000000901
9 0x0000000000000708
0 0x0000000000000246
end codes

end remote
dneprrider
Offline

Member

Posts: 222
Threads: 20
Joined: Mar 2005
#4
2005-03-28, 03:56 PM
Just wondering if any one else has managed to implement a method to change channels on an external device i.e. a cable box or Satellite receiver from within GB-PVR.

I purchased a cheap serial port IR transceiver at a local discount retailer (JetEye PC, model ESI-9680, readily available on ebay or other sources).

The ESI-9680 unit works without modification when hooked up to my PC. Checked this using the serial port watcher program, http://www.geocities.com/CapeCanaveral/L...ectrl.html to view data on the serial port.

I am trying to control an older Bell ExpressVu 2700 Satellite receiver. I used a LIRC config file for another ExpressVu model 3100 and it worked fine for the 2700.
http://lirc.sourceforge.net/remotes/expressvu/ Note: many other remote control config files are available on this site.

Using WinLIRC in manual mode I can control the satellite receiver, turn it on/off and change channels.

I am not a programmer and haven’t written any code since 1993 and then it was in assembly language. So I wouldn't know an error if I saw one in windows scripting language. The channel.js script listed above has some html codes inserted in place of quotes and less, greater than symbols due to the conversion of the text to html display methods of this forum site.
After trying to remove these inserted html codes I still get run errors for this script file.

Does any one have a working script or alternative that calls WinLIRC transmit.exe from within GB-PRV.

Regards,
Richard
dneprrider
Offline

Member

Posts: 222
Threads: 20
Joined: Mar 2005
#5
2005-03-30, 01:59 AM
I finally got the script to work, after fixing the format changes. It is great to have GB-PVR switch channels on the satellite box....

I'll be posting all my setup steps here soon to help others with an ExpressVu 2700/3100 receiver and Jeteye IR module.
Regards,
Richard
dneprrider
Offline

Member

Posts: 222
Threads: 20
Joined: Mar 2005
#6
2005-04-05, 10:13 PM
I think it more appropriate to post this under the WINLIRC thread as opposed to the external channel changer broken thread, as it is apparent that the .exe channel changer works, and my problem rests with WinLIRC.

Here is what I have learnt over the past few days. Thanks to all who have responded with similar scripts/apps to test out similar functionality. All have indicated the same issue! Which I am getting too below.

I have written a simplified NT script file (channel.cmd) that takes in the {channel} argument from the .exe channel changer, and passes the channel numbers to the WINLIRC command line IR transmit.exe executable.

The script file also logs the passed channel numbers into a text file c:\input.txt in order to check that correct channel numbers are being passed.

Results:
From the GB-PVR TV guide I can select a TV channel to watch, channel changer calls the script file which parses the 3 digit channel number into 3 seperate digits, and then calls transmit.exe. The correct IR commands are sent and the external satellite box changes to the selected channel. As evident from the changed contents of input.txt file and the satellite box switching channels.

From a command window I can run channel.cmd followed by the channel number, whereby the transmit.exe executable is called and the external satellite box changes to the selected channel.

However when in recording mode for any selected “to be recorded” TV show channel, at the correct time, the channel.cmd script is run, but transmit.exe executable dosen’t run. Therefore the recording starts but the external satellite box channel remains at the original setting. The input.txt file logs the correct channel number so the channel.cmd script is running but transmit.exe is not being called. The same situation exists when in instant record mode.



Does any one have any idea why for sometimes a batch called file will run but at other times it would not? Any other suggestions or altarnatives to a serial port IR blaster would be greatly appreciated.

System
I am running this on a Toshiba Tecra XP Pro laptop with SP2 installed.
No TV in encoder card installed as this is my testing machine. Easier to move around than my P3 desktop which will be the final system when my Nvidia MX440 TV out card arrives.
I have added the directories used to my PATH statement and ensured that the .cmd extension is included in the PATHEXT.

Please see below for the channel.cmd script file

///////////////////////////////////////

@echo off
REM .exe channel changer send out the 3 digit channel number as one number
rem i.e {345}
rem
rem However TRANSMIT.exe sends out the remote codes serially
rem
rem usage: transmit remotename codename #times to repeat IR signal
rem
REM Need to pass a string of 3 numbers to TRANSMIT i.e 345
rem
rem Therefore need to parse the 3 digit channel# 345 into three arguments
rem for example:
rem
rem transmit 3100 3 1
rem transmit 3100 4 1
rem transmit 3100 5 1
rem
rem make it easy and hard code the remotename = 3100
rem make it easy and hard code the repeat = 1


rem Need to take in the {channel} as %1 then parse it into 3 digits

SET CHANNEL=%1


call C:\WINLIRC\transmit 3100 %CHANNEL:~0,1% 4
rem copy 1st digit of channel # into input.txt file for debug purpose
echo 3100 %CHANNEL:~0,1% 4 >> C:\INPUT.TXT
SLEEP 1

call C:\WINLIRC\transmit 3100 %CHANNEL:~1,1% 4
rem copy 2nd digit of channel # into input.txt file for debug purpose
echo 3100 %CHANNEL:~1,1% 4 >> C:\INPUT.TXT
SLEEP 1

call C:\WINLIRC\transmit 3100 %CHANNEL:~2,1% 4
rem copy 3rd digit of channel # into input.txt file for debug purpose
echo 3100 %CHANNEL:~2,1% 4 >> C:\INPUT.TXT
SLEEP 1


EXIT

/////////////////////////////////////////////////////////
sub
Online

Administrator

NextPVR HQ, New Zealand
Posts: 106,697
Threads: 767
Joined: Nov 2003
#7
2005-04-05, 10:23 PM
Transmit.exe is trying to use the clipboard to send data to WinLIRC. Since the recording service is not running as a process on the same desktop session as WinLIRC, this type of communication is not possible.

Below is the source code to transmit.exe
Code:
int APIENTRY WinMain(HINSTANCE hInstance,
                     HINSTANCE hPrevInstance,
                     LPSTR     lpCmdLine,
                     int       nCmdShow)
{
    LRESULT copyDataResult;
    HWND pOtherWnd = FindWindow(NULL, "WinLirc");
    if (pOtherWnd)
    {
        COPYDATASTRUCT cpd;
        cpd.dwData = 0;
        cpd.cbData = strlen(lpCmdLine)+1;
        cpd.lpData = (void*)lpCmdLine;
        copyDataResult = SendMessage(pOtherWnd,WM_COPYDATA,(WPARAM)hInstance,(LPARAM)&cpd);
        // copyDataResult has value returned by other app
    }
    else
    {
        return 1;
    }
    return 0;
}

You'll need to find a replacement for transmit.exe that does this a different way.

This is not a bug in GB-PVR.
rheslip
Offline

Junior Member

Posts: 32
Threads: 4
Joined: Jan 2005
#8
2005-04-05, 10:53 PM
Sub

Your explanation makes sense. It did work though on .2313 and .9010. I reinstalled with XP Home SP2 somewhere in there though and thats probably what broke it.

WinLIRC is supposed to listen for requests on a specific socket if I remember correctly - you can change channels using a different machine if you want. I would think using that mechanism as opposed to the clipboard should make it functional. I have no idea how to code it tho !

Rich
sub
Online

Administrator

NextPVR HQ, New Zealand
Posts: 106,697
Threads: 767
Joined: Nov 2003
#9
2005-04-05, 11:15 PM
Quote:Your explanation makes sense. It did work though on .2313 and .9010. I reinstalled with XP Home SP2 somewhere in there though and thats probably what broke it.
As you can see from dneprrider's tests and description above, GB-PVR is still living up to it's end of the bargain. GB-PVR is executing the configured executeable and passing the channel number correctly.

I dont think it will work, but you could try: In the Control Panel -> Administrative Tools -> Services -> GB-PVR Recording Service, try enabling the 'interact with desktop' setting.

Quote:WinLIRC is supposed to listen for requests on a specific socket if I remember correctly - you can change channels using a different machine if you want. I would think using that mechanism as opposed to the clipboard should make it functional. I have no idea how to code it tho !
I agree, but sorry, I cant help you there. I'm busy with my own things.
dneprrider
Offline

Member

Posts: 222
Threads: 20
Joined: Mar 2005
#10
2005-04-06, 10:53 PM
I have enlisted a friend of mine to code a small executable that takes the recording service arguments; and passes the arguments to WinLIRC’s TCP/IP server port. This method eliminates the problem of trying to pass arguments between windows sessions.

I believe this to be a better solution to extending WinLIRC usefulness with GB-PVR.

This will allow the recording service to control any WinLIRC compatible remote anywhere using TCP.


I’ll post the code & executable when it has been fully debugged and working.



sub Wrote:As you can see from dneprrider's tests and description above, GB-PVR is still living up to it's end of the bargain. GB-PVR is executing the configured executeable and passing the channel number correctly.

I dont think it will work, but you could try: In the Control Panel -> Administrative Tools -> Services -> GB-PVR Recording Service, try enabling the 'interact with desktop' setting.


I agree, but sorry, I cant help you there. I'm busy with my own things.
« Next Oldest | Next Newest »

Users browsing this thread: 1 Guest(s)

Pages (3): 1 2 3 Next »


Possibly Related Threads…
Thread Author Replies Views Last Post
  API channel.stream.start mvallevand 2 1,323 2023-05-07, 09:40 PM
Last Post: mvallevand
  Way to tell programmatically if channel load in from NPVR has finished... gdogg371 3 2,373 2021-03-11, 03:59 PM
Last Post: mvallevand
  What is being sent when using /live?channel=3.1 scJohn 2 1,906 2020-01-30, 04:51 PM
Last Post: sub
  Web command to create recurring any channel mvallevand 2 2,586 2019-02-04, 03:09 PM
Last Post: mvallevand
  XMLTV Channel Number Option gdogg371 12 6,738 2018-07-18, 04:32 PM
Last Post: sub
  Channels List by Channel Group Name scJohn 1 2,769 2018-01-05, 10:45 PM
Last Post: mvallevand
  Channel List (native controller) psycik 2 3,072 2017-06-19, 09:14 AM
Last Post: psycik
  Getting all channel listings - decimal channel numbers psycik 11 8,234 2015-12-13, 02:17 AM
Last Post: seejaydee
  Channel/ChannelMapping whurlston 4 2,858 2014-04-14, 06:26 PM
Last Post: whurlston
  What causes a new tuner to be used services/live?channel= psycik 2 2,276 2014-02-04, 05:32 PM
Last Post: psycik

  • View a Printable Version
  • Subscribe to this thread
Forum Jump:

© Designed by D&D, modified by NextPVR - Powered by MyBB

Linear Mode
Threaded Mode