JP1 Remotes Forum Index JP1 Remotes


FAQFAQ SearchSearch 7 days of topics7 Days MemberlistMemberlist UsergroupsUsergroups RegisterRegister
ProfileProfile Log in to check your private messagesLog in to check your private messages Log inLog in

URC-6440/OARUSB04G Extender 1.04 now available
Goto page Previous  1, 2, 3, 4, 5, 6  Next
 
Post new topic   Reply to topic    JP1 Remotes Forum Index -> JP1 - Extenders
View previous topic :: View next topic  
Author Message
mathdon
Expert


Joined: 22 Jul 2008
Posts: 2970
Location: Cambridge, UK

PostPosted: Sun Apr 03, 2016 5:41 pm    Post subject: Reply with quote

AndrewZ wrote:
can I use LKP on Device buttons as an alternative to Activity buttons? Is this supported by the Extender?

I don't know Embarassed . It isn't deliberately supported, but RMIR will allow you to set one up. I just don't know if it will actually work. I have a feeling that it won't work but there is no harm in you trying it to see, though. In the RMIR setup for an LKP you would need to set Device to "<None>" and Key to the device key concerned.
_________________
Graham
Back to top
View user's profile Send private message
AndrewZ



Joined: 15 Sep 2003
Posts: 39

PostPosted: Mon Apr 04, 2016 3:42 am    Post subject: Reply with quote

Thanks for the responses, I check as soon as the remote is in my hands.

Anyway, what's the best practice now to use multiple Watch* scenarios?
Definitely I can use, for example, WatchMovie2 (Shift-WatchMovie), but what are the other options people use? Have a macro for WD TV Live box on WatchMovie now and need to add another one for DVD. Need something simple to be adopted by family members Wink
Thanks!
Back to top
View user's profile Send private message
Elemecca



Joined: 13 Apr 2016
Posts: 7
Location: Reno, NV, USA

PostPosted: Thu Apr 14, 2016 11:58 am    Post subject: Only install with Windows Reply with quote

macro wrote:
Well, apparently it had something to do with OSX or my MacBook. After trying everything I could think to with the MacBook short of formatting the remote, I booted up my old XP box to give that a shot. Worked first try, and the remote seems to be functioning again. Phew!


This echoes my experience trying to install the extender on my OARUSB04G 4000 from Linux. Every time I tried to copy Settings_reset_OARUSB04G_extender104(2576A1).bin over the settings.bin on the remote, I got drive errors in the system log and the remote was soft-bricked. Recovering required the "plug in USB and only then put in batteries" trick that forces it to mount the settings drive without trying to read the (invalid) settings file.

Code:
[993488.681515] usb 1-2: new full-speed USB device number 32 using xhci_hcd
[993488.871024] usb 1-2: New USB device found, idVendor=06e7, idProduct=8020
[993488.871032] usb 1-2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[993488.871036] usb 1-2: Product: UEI Mass Storage           
[993488.871040] usb 1-2: Manufacturer: UEI Remotes             
[993488.871044] usb 1-2: SerialNumber: 000000000001
[993488.872254] usb-storage 1-2:1.0: USB Mass Storage device detected
[993488.873247] scsi host65: usb-storage 1-2:1.0
[993489.871246] scsi 65:0:0:0: Direct-Access                                    PQ: 0 ANSI: 0
[993489.872240] sd 65:0:0:0: Attached scsi generic sg1 type 0
[993489.873594] sd 65:0:0:0: [sda] 465 512-byte logical blocks: (238 kB/233 KiB)
[993489.874480] sd 65:0:0:0: [sda] Write Protect is off
[993489.874489] sd 65:0:0:0: [sda] Mode Sense: 03 00 00 00
[993489.875358] sd 65:0:0:0: [sda] No Caching mode page found
[993489.875369] sd 65:0:0:0: [sda] Assuming drive cache: write through
[993490.001472]  sda: sda1
[993490.001476] sda: p1 size 465 extends beyond EOD, enabling native capacity
[993490.127431]  sda: sda1
[993490.127441] sda: p1 size 465 extends beyond EOD, truncated
[993490.132183] sd 65:0:0:0: [sda] Attached SCSI disk
[993495.160848] FAT-fs (sda1): utf8 is not a recommended IO charset for FAT filesystems, filesystem will be case sensitive!
[993495.186024] sd 65:0:0:0: [sda] tag#0 FAILED Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE
[993495.186034] sd 65:0:0:0: [sda] tag#0 Sense Key : Illegal Request [current]
[993495.186039] sd 65:0:0:0: [sda] tag#0 Add. Sense: No additional sense information
[993495.186046] sd 65:0:0:0: [sda] tag#0 CDB: Write(10) 2a 00 00 00 00 01 00 00 01 00
[993495.186050] blk_update_request: I/O error, dev sda, sector 1
[993495.186056] Buffer I/O error on dev sda1, logical block 0, lost sync page write
[993568.007842] sd 65:0:0:0: [sda] tag#0 FAILED Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE
[993568.007846] sd 65:0:0:0: [sda] tag#0 Sense Key : Illegal Request [current]
[993568.007848] sd 65:0:0:0: [sda] tag#0 Add. Sense: No additional sense information
[993568.007850] sd 65:0:0:0: [sda] tag#0 CDB: Write(10) 2a 00 00 00 00 02 00 00 03 00
[993568.007852] blk_update_request: I/O error, dev sda, sector 2
[993568.007855] Buffer I/O error on dev sda1, logical block 1, lost async page write
[993568.007858] Buffer I/O error on dev sda1, logical block 2, lost async page write
[993568.007859] Buffer I/O error on dev sda1, logical block 3, lost async page write
[993568.021901] VFS: Dirty inode writeback failed for block device sda1 (err=-5).
[993589.017643] usb 1-2: USB disconnect, device number 32


I attached the remote to my Windows 10 VM and did the copy there and it worked on the first try. As a bonus, RMIR can write to the remote on Windows so I can finally use *.rmir files instead of SimpleSet *.bin files, which means I won't lose all my notes and function names every time I close RMIR anymore.

It seems like UEI only really tested the (fake) drive provided by these remotes on Windows. Other OSes implement the FAT filesystem a little differently and the remote seems to really not like something they do when writing files. If I get the time I'll see if I can figure out what it doesn't like and whether I can get a clean write by working with the block device directly from userspace without mounting the FS.
Back to top
View user's profile Send private message
bobocher



Joined: 21 Jun 2016
Posts: 8

PostPosted: Mon Jun 27, 2016 5:46 am    Post subject: Reply with quote

Thanks a lot for the extender. Works perfect. I have one question though.

Is it possible to simulate a long key press, in particular as part of a macro?

I have PVR "Vu+ duo" which for many buttons have two actions: one for normal press and another action for long press (for example color buttons but also many others too). These buttons works perfect when pressed manually but I don't know how to simulate that long presses in macros.

This PVR uses MCE protocol. I can see what events are coming to the device (which is a Linux device and I have access to logs) and it seems it can differentiate between "key press", "key repeat" and "key release". A normal key click is registered as two events ("key press", "key release"). A long key press produces many events ("key press", "key repeat", "key repeat" ... "key release").

Therefore it's not possible to simulate long key press with a bunch of normal presses as for each normal press a "key release" will be registered and it will not be accepted as long press.

Any ideas?
Back to top
View user's profile Send private message
mathdon
Expert


Joined: 22 Jul 2008
Posts: 2970
Location: Cambridge, UK

PostPosted: Wed Jun 29, 2016 11:55 am    Post subject: Reply with quote

bobocher wrote:
Is it possible to simulate a long key press, in particular as part of a macro?

Sorry, no, this is not possible. It is possible to control the length of time that a key press in a macro is held, see the section "Special buttons for macro control" in the extender manual, but the timing range is 0 to 450ms which is probably too short to be recognised as a long keypress. This facility was added to allow users to shorten, rather than lengthen, the default time of 250ms as for some equipment 250ms causes a repeat action to start. Also, if you keep pressed the key that sends the macro, the last key in the macro sequence is effectively held until you release the macro key. However, this won't help for anything other than the last key.

Had I been aware of a need for longer durations, I could have included it but I'm afraid I have no plans at present for a further revision of the extender.
_________________
Graham
Back to top
View user's profile Send private message
bobocher



Joined: 21 Jun 2016
Posts: 8

PostPosted: Wed Jun 29, 2016 2:29 pm    Post subject: Reply with quote

Thanks, Graham!

I'll see if I can develop a workaround on PVR side.
Back to top
View user's profile Send private message
tidklaas



Joined: 28 Jun 2016
Posts: 5

PostPosted: Tue Jul 05, 2016 11:56 am    Post subject: Re: Only install with Windows Reply with quote

Elemecca wrote:
macro wrote:
Well, apparently it had something to do with OSX or my MacBook. After trying everything I could think to with the MacBook short of formatting the remote, I booted up my old XP box to give that a shot. Worked first try, and the remote seems to be functioning again. Phew!


This echoes my experience trying to install the extender on my OARUSB04G 4000 from Linux. Every time I tried to copy Settings_reset_OARUSB04G_extender104(2576A1).bin over the settings.bin on the remote, I got drive errors in the system log and the remote was soft-bricked. Recovering required the "plug in USB and only then put in batteries" trick that forces it to mount the settings drive without trying to read the (invalid) settings file.

[...]


I ran into the same problem using Linux. Apparently Simpleset's FAT implementation is rather... simple (sorry, could not resist) and can not handle blocks being written out of order. A workaround is using 'dd' instead of 'cp' and forcing it to perform block writes synchronously:
Code:

dd bs=512 conv=notrunc,fsync oflag=sync of=<path/to/remote>/OFA\ REMOTE/settings.bin if=YourSettings.bin



Tido
Back to top
View user's profile Send private message
yaworski



Joined: 22 Jun 2014
Posts: 440
Location: Warsaw, Poland

PostPosted: Tue Jul 05, 2016 1:37 pm    Post subject: Reply with quote

@tidklaas that's a great find. I can confirm that it's also working on my system.

As for the FAT/mass storage implementation in the remote it's more complicated than it seems because the file is also being decrypted before writing into flash so the remote's CPU has some work to do.

I wonder if there's a way to duplicate this behaviour in Java. Saving the file in RMIR to temporary location and then calling Runtime.exec to execute dd would probably work but it's not very elegant solution.
_________________
Marcin
Back to top
View user's profile Send private message
tidklaas



Joined: 28 Jun 2016
Posts: 5

PostPosted: Tue Jul 05, 2016 2:04 pm    Post subject: Reply with quote

yaworski wrote:
I wonder if there's a way to duplicate this behaviour in Java. Saving the file in RMIR to temporary location and then calling Runtime.exec to execute dd would probably work but it's not very elegant solution.


I am no expert on Java, the last time I was forced to use it I was still in university. In C this would be equivalent to opening the file on the remote with flags O_WRONLY|O_SYNC and then writing the image in 512 byte portions.

Tido
Back to top
View user's profile Send private message
tidklaas



Joined: 28 Jun 2016
Posts: 5

PostPosted: Wed Jul 06, 2016 11:18 am    Post subject: Reply with quote

Okay, after patching RMIR to write the config image with synchronous I/O and in 512 byte blocks, I can upload directly to my URC-6440 R02.

Since SF will not let me post a patch for the project, I will just append it here. If anyone takes offence at the coding style or methods used, please bear in mind that I mostly do kernel level or bare metal development in C and have not touched Java in over ten years... Wink

Code:

Index: km/com/hifiremote/jp1/RemoteMaster.java
===================================================================
--- km/com/hifiremote/jp1/RemoteMaster.java     (revision 1482)
+++ km/com/hifiremote/jp1/RemoteMaster.java     (working copy)
@@ -3346,6 +3346,7 @@
     if ( ioName.equals( "JPS" ) )
     {
       JPS jps = ( JPS )ioIn;
+/*     
       if ( use == Use.UPLOAD && osName.equals( "Linux" )
           && ( portName == null || portName.contains( "REMOTE" ) ) )
       {
@@ -3354,7 +3355,9 @@
         JOptionPane.showMessageDialog( this, message, title, JOptionPane.INFORMATION_MESSAGE );
         return null;
       }
-      else if ( jps.isOpen() && ( use == Use.SAVING || use == Use.SAVEAS ) )
+      else
+*/
+      if ( jps.isOpen() && ( use == Use.SAVING || use == Use.SAVEAS ) )
       {
         portName = jps.getFilePath();
         System.err.println( "Already open on Port " + portName );
Index: km/com/hifiremote/jp1/io/JPS.java
===================================================================
--- km/com/hifiremote/jp1/io/JPS.java   (revision 1482)
+++ km/com/hifiremote/jp1/io/JPS.java   (working copy)
@@ -5,12 +5,15 @@
 import java.io.File;
 import java.io.FileInputStream;
 import java.io.FileNotFoundException;
-import java.io.FileOutputStream;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.InputStreamReader;
-import java.io.OutputStream;
+import java.nio.ByteBuffer;
+import java.nio.channels.FileChannel;
+import java.nio.file.Paths;
+import java.nio.file.StandardOpenOption;
 import java.util.Arrays;
+import java.util.EnumSet;
 import java.util.List;
 
 import javax.swing.JOptionPane;
@@ -313,10 +316,23 @@
     }
     try
     {
+      int written, remain;
       ByteArrayOutputStream bao = new ByteArrayOutputStream();
-      s.save( bao );
-      OutputStream o = new FileOutputStream( filePath );
-      o.write( bao.toByteArray() );
+      s.save( bao );
+      FileChannel o = FileChannel.open(Paths.get(filePath), EnumSet.of(StandardOpenOption.WRITE, StandardOpenOption.SYNC));
+     
+      written = 0;
+      remain = bao.size();
+      while(remain > 0){
+        int chunk = Math.min(512, bao.size() - written);
+       
+        ByteBuffer buff = ByteBuffer.wrap(bao.toByteArray(), written, chunk);
+        o.write(buff);
+       
+        remain -= chunk;
+        written += chunk;
+      }
+
       bao.close();
       o.close();;
     }


Tido
Back to top
View user's profile Send private message
yaworski



Joined: 22 Jun 2014
Posts: 440
Location: Warsaw, Poland

PostPosted: Thu Jul 07, 2016 3:16 am    Post subject: Reply with quote

@tidklaas this is great. I'll review the patch and if it's OK I'll submit it to SF.
_________________
Marcin
Back to top
View user's profile Send private message
yaworski



Joined: 22 Jun 2014
Posts: 440
Location: Warsaw, Poland

PostPosted: Mon Jul 11, 2016 8:24 am    Post subject: Reply with quote

@tidklaas: For some reason the patch couldn't apply cleanly. I've made the changes manually with some modifications. For some reason java.nio method doesn't work properly on Windows - the upload process takes a really long time and data uploaded are corrupted. I don't know how it would behave on OS X. I've added a check so the java.nio is used only on Linux and old way is used otherwise.

I can't yet commit that change to the repo though because java.nio requires Java 1.7 and RMIR right now uses 1.6+.
_________________
Marcin
Back to top
View user's profile Send private message
tidklaas



Joined: 28 Jun 2016
Posts: 5

PostPosted: Mon Jul 11, 2016 9:12 am    Post subject: Reply with quote

@yaworski: for me this patch is just a proof of concept, so I have no problem with it being modified or even completely rewritten.
As I said, I have hardly any knowledge of proper Java coding. I just cobbled this thing together with the first interfaces I could find that looked like they were doing what I wanted.
Back to top
View user's profile Send private message
Barf
Expert


Joined: 24 Oct 2008
Posts: 836

PostPosted: Mon Jul 11, 2016 9:47 am    Post subject: Reply with quote

yaworski wrote:
java.nio requires Java 1.7 and RMIR right now uses 1.6+.


So why not update? (IrScrutinizer uses 1.7, and there are quite some niceties there). Graham?

The number of users confined to 1.6 can probably be counted on the toes of one hand (no spelling mistake!).
Back to top
View user's profile Send private message Send e-mail Visit poster's website
yaworski



Joined: 22 Jun 2014
Posts: 440
Location: Warsaw, Poland

PostPosted: Mon Jul 11, 2016 10:32 am    Post subject: Reply with quote

@Barf, I've already PM-ed Graham asking about this and I'm waiting for his response before moving forward with committing changes to the repo.

@tidklaas, you've done a really good job anyway :).
_________________
Marcin
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic       JP1 Remotes Forum Index -> JP1 - Extenders All times are GMT - 5 Hours
Goto page Previous  1, 2, 3, 4, 5, 6  Next
Page 3 of 6

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


 

Powered by phpBB © 2001, 2005 phpBB Group
Get Smart! the band's official homepage Rockabilly Central