-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from gordonturner/develop
Preparing for release 3.0
- Loading branch information
Showing
6 changed files
with
328 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,208 @@ | ||
2017-03-25-Aux Macro | ||
==================== | ||
|
||
Command Line | ||
------------ | ||
|
||
- For the following: | ||
- On Raspberry Pi connected to Samsung TV | ||
- Kodi/osmc with cec disabled | ||
- lirc installed | ||
- cec-client install (from Github source) | ||
|
||
- Created `aux.sh` script: | ||
|
||
``` | ||
vi aux.sh | ||
``` | ||
``` | ||
#!/bin/bash | ||
echo "tx 2F:82:20:00" | cec-client RPI -s -d 4 | ||
irsend -d /run/lirc/lircd-lirc0 SEND_ONCE "Samsung" "KEY_CYCLEWINDOWS" && sleep 0.5 | ||
irsend -d /run/lirc/lircd-lirc0 SEND_ONCE "Samsung" "KEY_UP" && sleep 0.5 | ||
irsend -d /run/lirc/lircd-lirc0 SEND_ONCE "Samsung" "KEY_UP" && sleep 0.5 | ||
irsend -d /run/lirc/lircd-lirc0 SEND_ONCE "Samsung" "KEY_UP" && sleep 0.5 | ||
irsend -d /run/lirc/lircd-lirc0 SEND_ONCE "Samsung" "KEY_UP" && sleep 0.5 | ||
irsend -d /run/lirc/lircd-lirc0 SEND_ONCE "Samsung" "KEY_UP" && sleep 0.5 | ||
irsend -d /run/lirc/lircd-lirc0 SEND_ONCE "Samsung" "KEY_UP" && sleep 0.5 | ||
``` | ||
|
||
|
||
App Calls | ||
--------- | ||
|
||
- Call cec and set to Kodi: | ||
|
||
``` | ||
www.cecUsb.sendCommand( 0x1F, 0x82, 0x20, 0x00 ); | ||
``` | ||
|
||
- Must wait until complete, might have to use callback? | ||
|
||
- Then run: | ||
|
||
``` | ||
/* TODO: Consider refactoring this very procedural process */ | ||
lircNode.irsend.send_once('JVC-RM-AJ777', 'KEY_CYCLEWINDOWS', function() { | ||
sleep.sleep(1); | ||
}); | ||
lircNode.irsend.send_once('JVC-RM-AJ777', 'KEY_UP', function() { | ||
sleep.sleep(1); | ||
}); | ||
lircNode.irsend.send_once('JVC-RM-AJ777', 'KEY_UP', function() { | ||
sleep.sleep(1); | ||
}); | ||
lircNode.irsend.send_once('JVC-RM-AJ777', 'KEY_UP', function() { | ||
sleep.sleep(1); | ||
}); | ||
lircNode.irsend.send_once('JVC-RM-AJ777', 'KEY_UP', function() { | ||
sleep.sleep(1); | ||
}); | ||
lircNode.irsend.send_once('JVC-RM-AJ777', 'KEY_UP', function() { | ||
sleep.sleep(1); | ||
}); | ||
lircNode.irsend.send_once('JVC-RM-AJ777', 'KEY_UP', function() { | ||
sleep.sleep(1); | ||
}); | ||
``` | ||
|
||
|
||
Adding Sleep Step | ||
----------------- | ||
|
||
- This was harder then it should have been | ||
|
||
- Using: | ||
|
||
https://www.npmjs.com/package/sleep | ||
|
||
- should be a simple add to the `package.json`: | ||
|
||
``` | ||
"sleep":"5.1.0" | ||
``` | ||
|
||
- Install dependencies: | ||
|
||
``` | ||
npm install | ||
``` | ||
|
||
- And code: | ||
|
||
``` | ||
var sleep = require('sleep'); | ||
|
||
[...] | ||
|
||
sleep.msleep(500); | ||
``` | ||
|
||
- Got error: | ||
|
||
``` | ||
stupid-remote:macro called aux +2ms | ||
stupid-remote:macro Sent KEY_CYCLEWINDOWS +91ms | ||
/home/osmc/stupid-remote/routes/macro.js:47 | ||
sleep.msleep(500); | ||
^ | ||
|
||
TypeError: sleep.msleep is not a function | ||
at /home/osmc/stupid-remote/routes/macro.js:47:11 | ||
at ChildProcess.exithandler (child_process.js:204:7) | ||
at emitTwo (events.js:87:13) | ||
at ChildProcess.emit (events.js:172:7) | ||
at maybeClose (internal/child_process.js:827:16) | ||
at Process.ChildProcess._handle.onexit (internal/child_process.js:211:5) | ||
``` | ||
|
||
|
||
npm install | ||
----------- | ||
|
||
- Error on RPI: | ||
|
||
``` | ||
npm install | ||
``` | ||
|
||
|
||
``` | ||
> sleep@5.1.0 install /home/osmc/stupid-remote/node_modules/sleep | ||
> node-gyp rebuild | ||
|
||
module.js:327 | ||
throw err; | ||
^ | ||
|
||
Error: Cannot find module 'nan' | ||
at Function.Module._resolveFilename (module.js:325:15) | ||
at Function.Module._load (module.js:276:25) | ||
at Module.require (module.js:353:17) | ||
at require (internal/module.js:12:17) | ||
at [eval]:1:1 | ||
at Object.exports.runInThisContext (vm.js:54:17) | ||
at Object.<anonymous> ([eval]-wrapper:6:22) | ||
at Module._compile (module.js:409:26) | ||
at node.js:579:27 | ||
at nextTickCallbackWith0Args (node.js:420:9) | ||
gyp: Call to 'node -e "require('nan')"' returned exit status 1 while in binding.gyp. while trying to load binding.gyp | ||
gyp ERR! configure error | ||
gyp ERR! stack Error: `gyp` failed with exit code: 1 | ||
gyp ERR! stack at ChildProcess.onCpExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:305:16) | ||
gyp ERR! stack at emitTwo (events.js:87:13) | ||
gyp ERR! stack at ChildProcess.emit (events.js:172:7) | ||
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12) | ||
gyp ERR! System Linux 4.4.27-9-osmc | ||
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild" | ||
gyp ERR! cwd /home/osmc/stupid-remote/node_modules/sleep | ||
gyp ERR! node -v v4.4.5 | ||
gyp ERR! node-gyp -v v3.3.1 | ||
gyp ERR! not ok | ||
npm ERR! Linux 4.4.27-9-osmc | ||
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" | ||
npm ERR! node v4.4.5 | ||
npm ERR! npm v2.15.5 | ||
npm ERR! code ELIFECYCLE | ||
|
||
npm ERR! sleep@5.1.0 install: `node-gyp rebuild` | ||
npm ERR! Exit status 1 | ||
npm ERR! | ||
npm ERR! Failed at the sleep@5.1.0 install script 'node-gyp rebuild'. | ||
npm ERR! This is most likely a problem with the sleep package, | ||
npm ERR! not with npm itself. | ||
npm ERR! Tell the author that this fails on your system: | ||
npm ERR! node-gyp rebuild | ||
npm ERR! You can get information on how to open an issue for this project with: | ||
npm ERR! npm bugs sleep | ||
npm ERR! Or if that isn't available, you can get their info via: | ||
npm ERR! | ||
npm ERR! npm owner ls sleep | ||
npm ERR! There is likely additional logging output above. | ||
|
||
npm ERR! Please include the following file with any support request: | ||
npm ERR! /home/osmc/stupid-remote/npm-debug.log | ||
``` | ||
|
||
- Deleted `node_modules` and re-ran `npm install`, fixed issue | ||
|
||
|
||
Send KEY_AUX | ||
------------ | ||
|
||
``` | ||
router.get('/aux', function (req, res, next) { | ||
debug('called aux'); | ||
|
||
lircNode.irsend.send_once('Samsung', 'KEY_AUX', function() { | ||
debug("Sent KEY_AUX"); | ||
|
||
res.writeHead(200, {"Content-Type": "application/json"}); | ||
var html = '{"status":"ok"}'; | ||
res.end(html); | ||
}); | ||
|
||
}); | ||
``` | ||
|
||
- No response |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.