Using URC6440 and OARUSB04G Remotes with Linux: Difference between revisions

From JP1 Remotes Wiki
Jump to navigationJump to search
Davecs (talk | contribs)
No edit summary
Davecs (talk | contribs)
No edit summary
Line 32: Line 32:
  chown $hisname:`id -gn $hisname` /media/$hisname/REMOTE
  chown $hisname:`id -gn $hisname` /media/$hisname/REMOTE
  <span style="color:red">mount -t vfat /dev/disk/by-id/usb-UEI_Remotes_UEI_Mass_Storage_000000000001-0:0-part1
  <span style="color:red">mount -t vfat /dev/disk/by-id/usb-UEI_Remotes_UEI_Mass_Storage_000000000001-0:0-part1
  /media/davexf/REMOTE/ -o uid=`id -u $hisname`,gid=`id -g $hisname`,utf8,dmask=027,fmask=137</span>
  /media/$hisname/REMOTE/ -o uid=`id -u $hisname`,gid=`id -g $hisname`,utf8,dmask=027,fmask=137</span>
   
   
NOTE: The lines in <span style="color:red">RED</span> should be made into a single line when typed in.
NOTE: The lines in <span style="color:red">RED</span> should be made into a single line when typed in.

Revision as of 17:57, 24 September 2019

When you plug a JP1.x type remote into a Linux computer, running RemoteMasterIR, all should be well. If RMIR can't find your remote, it may well be a permissions problem. I will be looking into this further, and adding/updating as I go along. If all else fails, you might have to set up RMIR so that it runs as root.

However, when you plug a USB remote into your computer, like the OARUSB04G or URC6440, it connects by creating a "device" that you can mount. With some versions of Linux, especially older ones, your device will mount automatically, and you can run RMIR, download and upload between computer and remote, and take no special action at all. The problem is that it wasn't documented what you have to do if it doesn't... until now.

The path of the device created is unpredictable. It may turn up as /dev/sdc1. /dev/sdd1, sde1 etc., because of other things already plugged in. However, there is a "predictable" shortcut that is created when you plug it in, and it's the same for both the URC6440 and OARUSB04G models.

That shortcut is: /dev/disk/by-id/usb-UEI_Remotes_UEI_Mass_Storage_000000000001-0:0-part1

It's not very short for a shortcut, but it will always be the same, so we can make use of it in the mount command.

ONE NAMED USER METHOD

The following will allow one named user to get access to the remote control in order to run RMIR and communicate with the remote. It may well be adequate in most cases.

Create the following script and store it under /etc/udev/rules.d and I've called it 62-usbremote.rules -- it's all one line, by the way.

ACTION=="add", KERNEL=="sd*[0-9]", ATTRS{idVendor}=="06e7", ATTRS{idProduct}=="8015|8020", RUN+="/usr/local/bin/mount_ofa_setup"

The idProduct codes are 8015 for the URC6440 and 8020 for OARUSB04G, and putting a bar between them means "or".

This next script serves merely to return control to the udev system as quickly as possible, hence the & at the end of the line. I've called it mount_ofa_setup and it goes in /usr/local/bin. It must be made executable:

#!/bin/bash
/usr/local/bin/mount_ofa &

This next script does the actual job. It also goes in /usr/local/bin and is called mount_ofa and must be made executable:

#!/bin/bash
hisname="your-user-name"
mkdir /media/$hisname
mkdir /media/$hisname/REMOTE
chown $hisname:`id -gn $hisname` /media/$hisname/REMOTE
mount -t vfat /dev/disk/by-id/usb-UEI_Remotes_UEI_Mass_Storage_000000000001-0:0-part1
/media/$hisname/REMOTE/ -o uid=`id -u $hisname`,gid=`id -g $hisname`,utf8,dmask=027,fmask=137

NOTE: The lines in RED should be made into a single line when typed in.

And of course change your-user-name for your actual user name! And type it inside the quotes as shown.

After a reboot, your new udev rule should be available. Plug in your remote and the icon will appear on your desktop. You can unmount it in the normal way.

Set up RemoteMasterIR to point to it correctly from its menus:

Remote > Interface > JPS... > Other : /media/your-user-name/REMOTE/settings.bin

As with any USB-storage type interface, remember to unmount it before unplugging, else data may get broken.

ANY USER METHOD

The problem is that when you use su, sudo, gksu, and so on, to become root, the $USER variable is not changed, it will still return your username, but if it's run from UDEV, it will return root. If and when it has been determined how to get this to work for any user, this page will be updated.