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

RemoteMaster on Raspberry Pi with Raspian

 
Post new topic   Reply to topic    JP1 Remotes Forum Index -> JP1 - Software
View previous topic :: View next topic  
Author Message
Barf
Expert


Joined: 24 Oct 2008
Posts: 1402
Location: Munich, Germany

                    
PostPosted: Mon Oct 17, 2016 3:58 am    Post subject: RemoteMaster on Raspberry Pi with Raspian Reply with quote

Since I recently got IrScrutinizer running on Raspberry Pi, ("RPi") running Raspian Jessie I thought I should look at having RemoteMaster running on said hardware. (IrScrutinizer 1.3 fully supports the RPi with Raspian Jessie, although it takes 30 seconds to start on a RPi 3.)

Since RM is written in Java, only the shared libraries needs investigation. Since RM searches for these in os.name . os.arch this amounts to a subdirectory Linux-arm. (Note that this is not sufficiently fine-grained for some applications: there are ARM processors of different versions, with and without hardware floating-point. For our purposes, it is good enough though. IIRC, the RPi 2 and 3 uses ARM version 7 with hardware FP.)

First step is thus to create the directory Linux-arm. Binaries for jp12serial is available here, DecodeIR 2.45 here. hidapi in two different versions can be installed using Raspian apt-get (packet names libhidapi-libusb0 and
libhidapi-hidraw0 ) For RM to find it, I made a symblic link, e.g.


Code:

cd Linux-arm
ln -s /usr/lib/arm-linux-gnueabihf/libhidapi-libusb.so.0.0.0 libhidapi.so


It turns out that jp12serial and DecodeIR works fine, but for some reason I was not able to get the hidapi stuff to work. It failed to find and download a Nevo C2. This is (an except of) rmaster.err:

Code:
LibraryLoader: Loaded 'DecodeIR' successfully from '/home/bengt/jp1/controlremote-code/km/Linux-arm/libDecodeIR.so'
Starting normal download
Interface Name = CommHID
Port Name = /dev/xsight
Testing interface: JP1.X Serial
Testing interface: CommHID
Interface matched.  Trying to open remote.
Download error: com.codeminders.hidapi.HIDManager.init()V
java.util.concurrent.ExecutionException: java.lang.UnsatisfiedLinkError: com.codeminders.hidapi.HIDManager.init()V
        at java.util.concurrent.FutureTask.report(FutureTask.java:122)
        at java.util.concurrent.FutureTask.get(FutureTask.java:188)
        at javax.swing.SwingWorker.get(SwingWorker.java:602)
        at com.hifiremote.jp1.RemoteMaster$DownloadTask.done(RemoteMaster.java:691)
        at javax.swing.SwingWorker$5.run(SwingWorker.java:737)
        at javax.swing.SwingWorker$DoSubmitAccumulativeRunnable.run(SwingWorker.java:832)
        at sun.swing.AccumulativeRunnable.run(AccumulativeRunnable.java:112)
        at javax.swing.SwingWorker$DoSubmitAccumulativeRunnable.actionPerformed(SwingWorker.java:842)
        at javax.swing.Timer.fireActionPerformed(Timer.java:312)
        at javax.swing.Timer$DoPostEvent.run(Timer.java:244)
        at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:312)
        at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:745)
        at java.awt.EventQueue.access$300(EventQueue.java:103)
        at java.awt.EventQueue$3.run(EventQueue.java:706)
        at java.awt.EventQueue$3.run(EventQueue.java:704)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:77)
        at java.awt.EventQueue.dispatchEvent(EventQueue.java:715)
        at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:242)
        at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:161)
        at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:150)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:146)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:138)
        at java.awt.EventDispatchThread.run(EventDispatchThread.java:91)
Caused by: java.lang.UnsatisfiedLinkError: com.codeminders.hidapi.HIDManager.init()V
        at com.codeminders.hidapi.HIDManager.init(Native Method)
        at com.codeminders.hidapi.HIDManager.<init>(HIDManager.java:53)
        at com.codeminders.hidapi.HIDManager.getInstance(HIDManager.java:121)
        at com.hifiremote.jp1.io.CommHID.getPIDofAttachedRemote(CommHID.java:44)
        at com.hifiremote.jp1.io.CommHID.openRemote(CommHID.java:213)
        at com.hifiremote.jp1.RemoteMaster.testInterface(RemoteMaster.java:3362)
        at com.hifiremote.jp1.RemoteMaster.getOpenInterface(RemoteMas
...

I guess it would be possible for me (or someone else) to find and fix, but for the moment I do not feel sufficiently motivated...

Bottom line: RM works on RPi, with the exception of hdiapi. It takes 50 seconds to start though (using OpenJDK Runtime Environment (IcedTea 2.6.6) (java version "1.7.0_101"). (May be faster with other Java implementations.)
Back to top
View user's profile Send private message Send e-mail Visit poster's website
TiceRex



Joined: 29 Jun 2012
Posts: 51

                    
PostPosted: Sat Mar 06, 2021 6:23 am    Post subject: RPi4 Reply with quote

Hi Barf,

Thank you very much for your efforts to make it work on RPi!

I can confirm, that RemoteMaster is working properly on RPi4 (8GB) model. I'm using it with M.2 card as system disk, so file access time could not be an issue. However, the startup time can be decreased significantly by deleting unnecessary remotes from the Images and RDF directories.

I haven't tried to download/upload from/to any remote control device yet, but the editors (both RMIR and RMDU) are working flawlessly.
Back to top
View user's profile Send private message
Barf
Expert


Joined: 24 Oct 2008
Posts: 1402
Location: Munich, Germany

                    
PostPosted: Sun Mar 07, 2021 1:46 pm    Post subject: Reply with quote

Nice to hear. What Java version where you using (as per java -version). Although the challenging part is of course the deployment of the shared JNI libraries, in particular up- and downloads.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
TiceRex



Joined: 29 Jun 2012
Posts: 51

                    
PostPosted: Mon Mar 15, 2021 1:54 pm    Post subject: Reply with quote

Sorry, I didn't have time to test it recently.
Now I can confirm that the whole package (including upload/download) is working properly.

The java version is the default one in the latest Raspbian (now Raspberry Pi OS):
Code:
openjdk version "11.0.9.1" 2020-11-04
OpenJDK Runtime Environment (build 11.0.9.1+1-post-Raspbian-1deb10u2)
OpenJDK Server VM (build 11.0.9.1+1-post-Raspbian-1deb10u2, mixed mode)


I've tested it with a standard FTDI USB cable (TTL-232R-3V3), but I suspect there would be a simpler method than that using the RPi's native GPIO port.

Thank you once again!
Back to top
View user's profile Send private message
Barf
Expert


Joined: 24 Oct 2008
Posts: 1402
Location: Munich, Germany

                    
PostPosted: Mon Mar 15, 2021 3:05 pm    Post subject: Reply with quote

Nice to hear that it is working! Cool

Quote:

... I suspect there would be a simpler method than that using the RPi's native GPIO port.

There sits a lot of logic in the JP12serial library, logic that strictly speaking should not be there, but in the main program. (See the sources.) Feel free to try, but it is hardly expected to be "simple". Wink
Back to top
View user's profile Send private message Send e-mail Visit poster's website
mathdon
Expert


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

                    
PostPosted: Thu Mar 10, 2022 11:00 am    Post subject: Reply with quote

Now that I have finally acquired a Raspbery Pi 4, I have been able to investigate why RMIR failed to find a Nevo C2 in Barf's tests. RMIR uses this JNI wrapper from com.codeminders to access the C/C++ HIDAPI library. The distribution for that wrapper includes 32-bit and 64-bit hidapi binaries for Windows, Linux and Mac OS X and the appropriate one of these is extracted by RMIR for its use, but it does not include one for Linux-arm needed by the RPi. Although RMIR uses the latest version of the wrapper, v1.1, that dates from 2012. The C/C++ HIDAPI library has moved on a lot since then and that wrapper is not compatible with the Linux-arm version of libhidapi.so that Barf installed separately on RPi.

That wrapper has been superseded by hid4java, which includes a Linux-arm binary in its distribution. I have produced, for my own testing, RMIR v2.14.1 which uses this new wrapper. It works well on my Windows 10 machine but still has problems on my Raspberry Pi. I have tested it with both an XSight Lite and a Nevo C2 and in both cases, on the RPi it finds the remotes but fails to open them. Here are extracts from rmaster.err with the XSight Lite on both machines:

Extract from rmaster.err on RPi 4:

Code:
System Properties:
   java.version = 11.0.9.1
   java.vendor = Raspbian
   os.name = Linux
   os.arch = arm
   java.home = /usr/lib/jvm/java-11-openjdk-armhf
   java.class.path = /home/pi/Documents/RemoteMaster/RMIR2.14.1/RemoteMaster.jar
...
LibraryLoader: Attempting to load 'hidapi' from '/home/pi/Documents/RemoteMaster/RMIR2.14.1/Linux-arm/libhidapi.so'...
LibraryLoader: Loaded 'hidapi' successfully from '/home/pi/Documents/RemoteMaster/RMIR2.14.1/Linux-arm/libhidapi.so'
    CommHID version 2.0
...
Testing interface: CommHID
Remote found: Manufacturer = null, Product = null, Product ID = 8008
Open found device failed
Failed to open remote

Corresponding extracts from Windows 10:

Code:
System Properties:
   java.version = 14.0.2
   java.vendor = Oracle Corporation
   os.name = Windows 10
   os.arch = amd64
   java.home = C:\Program Files\Java\jdk-14.0.2
   java.class.path = RemoteMaster.jar
...
LibraryLoader: Attempting to load 'hidapi' from 'C:\RemoteMaster2.14.1\Windows-amd64\hidapi.dll'...
LibraryLoader: Loaded 'hidapi' successfully from 'C:\RemoteMaster2.14.1\Windows-amd64\hidapi.dll'
    CommHID version 2.0
...
Testing interface: CommHID
Remote found: Manufacturer = Maxim, Product = DIGITAL LITE   , Product ID = 8008
Open found device succeeded

You will see that the implementation of hidapi on the RPi is clearly incomplete, as it gives null values for the Manufacturer and Product values for the remote. Those are text values for information only, so this should have no effect on its ability to open a device, but perhaps it is indicative of incompletenesses elsewhere.

I would welcome any suggestions on what might be causing this failure to open a remote that it has already identified, or anything else that I might try.
_________________
Graham
Back to top
View user's profile Send private message
Barf
Expert


Joined: 24 Oct 2008
Posts: 1402
Location: Munich, Germany

                    
PostPosted: Thu Mar 10, 2022 2:30 pm    Post subject: Reply with quote

It may be a permission problem; try to run as root. (Of course only for debugging, not for deployment.)
Back to top
View user's profile Send private message Send e-mail Visit poster's website
mathdon
Expert


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

                    
PostPosted: Fri Mar 11, 2022 6:18 am    Post subject: Reply with quote

Barf wrote:
It may be a permission problem; try to run as root. (Of course only for debugging, not for deployment.)

Yes, that's done it. So how do I deal with this when not running as root?
_________________
Graham
Back to top
View user's profile Send private message
mathdon
Expert


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

                    
PostPosted: Fri Mar 11, 2022 7:58 am    Post subject: Reply with quote

A further problem. When I wrote that running as root had done it, I had only tried the XSight Lite. With the Nevo C2 the remote is opened, identified correctly as Nevo C2, but it fails on the check to see if an upgrade is needed, with rmaster.err giving the line "Read versions from remote failed to initiate". Java created an error log, here is an extract:

Code:
# A fatal error has been detected by the Java Runtime Environment:
#
#  SIGSEGV (0xb) at pc=0x8f8b5348, pid=1228, tid=1317
#
# JRE version: OpenJDK Runtime Environment (11.0.9.1+1) (build 11.0.9.1+1-post-Raspbian-1deb10u2)
# Java VM: OpenJDK Server VM (11.0.9.1+1-post-Raspbian-1deb10u2, mixed mode, g1 gc, linux-)
# Problematic frame:
# C  [libusb-1.0.so.0+0x5348]  libusb_exit+0xa4
#
# No core dump will be written. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again
#
# If you would like to submit a bug report, please visit:
#   Unknown
# The crash happened outside the Java Virtual Machine in native code.

No such problem occurs in Windows. I haven't yet tried this RMIR version in Linux, but I will do so.

Edit: No such problem in 64-bit Ubuntu either.
_________________
Graham
Back to top
View user's profile Send private message
Barf
Expert


Joined: 24 Oct 2008
Posts: 1402
Location: Munich, Germany

                    
PostPosted: Fri Mar 11, 2022 9:56 am    Post subject: Reply with quote

mathdon wrote:
Barf wrote:
It may be a permission problem; try to run as root. (Of course only for debugging, not for deployment.)

Yes, that's done it. So how do I deal with this when not running as root?

You have installed linux_xsight.rules, right? And made yourself a member of the dialout group? Iff yes, try to debug the workings of udevd, i.e. compare the files created when you plug in the xsight to the RPi with the files created by your Ubunto system.

Quote:

Java created an error log, here is an extract:

libusb goes bellyup, sigh... Crying or Very sad You may try the raspian forum
Back to top
View user's profile Send private message Send e-mail Visit poster's website
mathdon
Expert


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

                    
PostPosted: Fri Mar 11, 2022 1:45 pm    Post subject: Reply with quote

Barf wrote:
You have installed linux_xsight.rules, right?

Sorry, my mistake Embarassed , despite your warning to do so that setup.sh shows at the end. It is also explained in my own RMIR Announcements that this may be necessary, so I am guilty of not even following my own instructions Embarassed Embarassed Embarassed . I have now done so and that has fixed the opening problem, so am left with just the libusb problem.
_________________
Graham
Back to top
View user's profile Send private message
mathdon
Expert


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

                    
PostPosted: Sat Mar 12, 2022 9:23 am    Post subject: Reply with quote

The libusb problem seems to arise after RMIR has aborted the download. The abort occurs when RMIR fails to read an incoming data packet from the remote, which appears to be due to a timing issue. I don't fully understand what is going on. I added some diagnostic print-outs to the rmaster.err file and found that a side effect was that it ran past the original failure point, only to fail again at a later stage, which has convinced me that the problems are solvable. By adding some further delays, I have managed to get one successful download from the Nevo C2 but I don't like what I have done and at present it doesn't seem consistently reliable. I shall continue to work on it.
_________________
Graham
Back to top
View user's profile Send private message
Barf
Expert


Joined: 24 Oct 2008
Posts: 1402
Location: Munich, Germany

                    
PostPosted: Sat Mar 12, 2022 2:52 pm    Post subject: Reply with quote

Since libusb dies in C code due to a segmentation error, my gut feeling is that it is a (possibly seldomly triggered) bug in said library. Another possibily is that RMIR somehow uses it incorrectly (but it is still nasty to die from a SIGSEGV).
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic       JP1 Remotes Forum Index -> JP1 - Software All times are GMT - 5 Hours
Page 1 of 1

 
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
Top 7 Advantages of Playing Online Slots The Evolution of Remote Control