LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware
User Name
Password
Linux - Hardware This forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?

Notices


Reply
  Search this Thread
Old 02-20-2016, 10:06 AM   #1
joostvdb
LQ Newbie
 
Registered: Feb 2016
Posts: 5

Rep: Reputation: Disabled
Separate two Wireless (twin) Gamepads


Hello Everyone!

I recently bought these controllers from ebay:
http://www.ebay.com/itm/2-x-2-4G-USB...MAAOSw14xWKuSe

(I also saw them on Amazon)

I bought them to try and run RetroPie on my Raspberry Pi.

When i install the driver on Windows, windows recognizes the controllers as two indiviual controllers. On raspbian, they are detected as a single (combined) controller. The buttons are merged into one, but the axises are shared. So when i move the analog stick on the first controller, it shows exactly the same as i move that analog stick on the second controller.

I have done some research, but could not find out how i can distinguish the two controllers in Raspbian.

What information i gathered so far:

Code:
lsusb -v

Bus 001 Device 006: ID 2563:0555
Couldn't open device, some information will be missing
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               1.10
  bDeviceClass            0 (Defined at Interface level)
  bDeviceSubClass         0
  bDeviceProtocol         0
  bMaxPacketSize0         8
  idVendor           0x2563
  idProduct          0x0555
  bcdDevice            1.00
  iManufacturer           1
  iProduct                2
  iSerial                 0
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength           34
    bNumInterfaces          1
    bConfigurationValue     1
    iConfiguration          0
    bmAttributes         0x80
      (Bus Powered)
    MaxPower              350mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           1
      bInterfaceClass         3 Human Interface Device
      bInterfaceSubClass      0 No Subclass
      bInterfaceProtocol      0 None
      iInterface              0
        HID Device Descriptor:
          bLength                 9
          bDescriptorType        33
          bcdHID               1.10
          bCountryCode            0 Not supported
          bNumDescriptors         1
          bDescriptorType        34 Report
          wDescriptorLength     202
         Report Descriptors:
           ** UNAVAILABLE **
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x81  EP 1 IN
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0008  1x 8 bytes
        bInterval               8
Code:
dmesg | grep Joystick

[    3.859653] usb 1-1.3: Product: Twin USB Joystick
[   13.886474] input: ShanWan Twin USB Joystick as /devices/platform/soc/3f980000.usb/usb1/1-1/1-1.3/1-1.3:1.0/0003:2563:0555.0003/input/input2
[   13.887118] hid-generic 0003:2563:0555.0003: input,hidraw2: USB HID v1.10 Joystick [ShanWan Twin USB Joystick] on usb-3f980000.usb-1.3/input0
Code:
sudo find /sys | grep drivers.*0555

/sys/bus/hid/drivers/hid-generic/0003:2563:0555.0003
And the output of jstest-gtk can be found here

I also tried using xboxdrv to get the conntrollers to work, but with no success so far.

Can anyone help me getting these controllers recognised as two indiviual controllers?

Thanks in advance!
 
Old 03-08-2016, 08:58 AM   #2
saveriocastellano
LQ Newbie
 
Registered: Mar 2016
Posts: 1

Rep: Reputation: Disabled
i have exactly the same problem... did you manage to solve it ?
 
Old 03-08-2016, 02:16 PM   #3
joostvdb
LQ Newbie
 
Registered: Feb 2016
Posts: 5

Original Poster
Rep: Reputation: Disabled
Lightbulb Debugging information

Hello everyone!

using the testgui from hidapi, i've managed to debug the controllers.
Using this gui tool, i've found that the signals send by the controllers only differ in the first two digits. hidapi shows the following information:


Code:
Received 8 bytes:
01 80 80 80  80 0f 00 00
Received 8 bytes:
02 80 80 80  80 0f 00 00
over and over. This is the input when the controllers are not used.

The numbers change when the MODE switch is pressed to:

Code:
Received 8 bytes:
01 80 7F 80  7F 0f 00 00
Received 8 bytes:
02 80 7F 80  7F 0f 00 00
over and over.This is also the input when the controllers are not used.

The numbers correspond to certain buttons and axises like shown in the format below:

Code:
<ControllerID> <Right Hat horizontal> <Right Hat vertical> <Left Hat horizontal> <Left Hat vertical> <Shape buttons*> <Multiple buttons**> <unknown>

* Shape buttons are the 4 buttons on the right side of the controller (triangle=1F, round=2F, cross=4F, square=8F)
** Shoulder buttons are the buttons on the back, hat left and right are the buttons when you push down on the hats (LeftTop=01,LeftBottom=04,RightTop=02,RightBottom=08,SELECT=10,START=20,HatL=40,HatR=80)

Vibration is also possible. The values to send are almost the same as those being received:

Code:
<ControllerID> <unknown (00)> <unknown (00)> <Left Vibration (value 80)> <Right vibration (value 80)> <unknown> <unknown> <unknown>
So far so good. At least i've found the data to send and receive.. But i have no clue how to write a USB HID driver that is joydev compatible..

Can anyone (help me) write such a driver?

Thanks in advance!
 
Old 03-17-2016, 10:04 AM   #4
pitcrawler
LQ Newbie
 
Registered: Mar 2016
Posts: 9

Rep: Reputation: Disabled
I have the same issue and I've been trying to do some of my own research.

I've also never written a device driver, but perhaps it's possible to add the device to the xboxdrv userspace device driver. It already has support for some generic usb gamepads, and also for the xbox 360 wireless receiver. This is similar to the Shanwan Twin USB receiver, with it being a single usb device which supports multiple controllers with different Controller IDs

It's source is at: https://github.com/xboxdrv/xboxdrv/b...controller.cpp

Maybe it's possible to create a driver based on that one.

You'd need to also add the device info into the xboxmsg.cpp file.
 
Old 03-18-2016, 02:18 PM   #5
pitcrawler
LQ Newbie
 
Registered: Mar 2016
Posts: 9

Rep: Reputation: Disabled
So I've been playing a little with the xboxdrv code and managed to create a new device type for the Shanwan Twin USB controller.
I basically made a copy of the xbox 360 wireless device code, and I added the Shanwan device into the xpad.device.cpp file.
Now when I plug in my Shanwan usb adapter, it is recognised by xboxdrv, as shown below:

Code:
pi@raspberrypi:~/Documents/xboxdrv-stable $ sudo ./xboxdrv
xboxdrv 0.8.8 - http://pingus.seul.org/~grumbel/xboxdrv/
Copyright © 2008-2011 Ingo Ruhnke <grumbel@gmail.com>
Licensed under GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This program comes with ABSOLUTELY NO WARRANTY.
This is free software, and you are welcome to redistribute it under certain
conditions; see the file COPYING for details.

Controller:        Shanwan Twin Wireless USB
Vendor/Product:    2563:0555
USB Path:          001:006
Controller Type:   Shanwan (wireless)

-- [ ERROR ] ------------------------------------------------------
USBController::usb_write(): libusb_submit_transfer(): LIBUSB_ERROR_IO
pi@raspberrypi:~/Documents/xboxdrv-stable $
Now I have a file, shanwan_wireless_controller.cpp, which is a copy of xbox360_wireless_controller.cpp except I changed where it says "Xbox360WirelessController" in the file to "ShanwanWirelessController".

There's a section of code near the top of xbox360_wireless_controller.cpp, which initializes the controller:
Code:
Xbox360WirelessController::Xbox360WirelessController(libusb_device* dev, int controller_id,
                                                     bool try_detach) :
  USBController(dev),
  m_endpoint(),
  m_interface(),
  m_battery_status(),
  m_serial()
{
  // FIXME: A little bit of a hack
  m_is_active = false;

  assert(controller_id >= 0 && controller_id < 4);

  // FIXME: Is hardcoding those ok?
  m_endpoint  = controller_id*2 + 1;
  m_interface = controller_id*2;

  usb_claim_interface(m_interface, try_detach);
  usb_submit_read(m_endpoint, 32);
}
I will likely need to use the m_interface variable when parsing the gamepad data and compare it to the controller ID value. If it matches then I'll send the data on to this virtual joystick device. Otherwise it will go to the other device.

I will have to create 2 virtual joystick devices upon connection of the usb receiver.

There's a method in controller_factory.cpp called create_multiple
Code:
std::vector<ControllerPtr>
ControllerFactory::create_multiple(const XPadDevice& dev_type, libusb_device* dev, const Options& opts)
It has a section of code to create 4 xbox360 wireless devices when using thw xbox360 wireless receiver, so I created an entry for the Shanwan receiver as shown:
Code:
    case GAMEPAD_XBOX360_WIRELESS:
      for(int wireless_id = 0; wireless_id < 4; ++wireless_id)
      {
        lst.push_back(ControllerPtr(new Xbox360WirelessController(dev, wireless_id, opts.detach_kernel_driver)));
      }
      break;
      
    case GAMEPAD_SHANWAN_WIRELESS:
      for(int wireless_id = 0; wireless_id < 2; ++wireless_id)
      {
        lst.push_back(ControllerPtr(new ShanwanWirelessController(dev, wireless_id, opts.detach_kernel_driver)));
      }
      break;
I'll need to make sure my create_multiple code gets called and then edit my newly created shanwan_wireless_controller.cpp/.hpp files to process the data that the controller sends, ignoring any that are not from the correct controller ID.


As I said, I've never written a device driver before, but I think I have the basic gist of it... maybe.

Last edited by pitcrawler; 03-18-2016 at 02:31 PM. Reason: spelling
 
Old 03-18-2016, 02:26 PM   #6
pitcrawler
LQ Newbie
 
Registered: Mar 2016
Posts: 9

Rep: Reputation: Disabled
duplicate

Last edited by pitcrawler; 03-18-2016 at 02:28 PM. Reason: Duplicate post
 
Old 03-18-2016, 05:20 PM   #7
pitcrawler
LQ Newbie
 
Registered: Mar 2016
Posts: 9

Rep: Reputation: Disabled
I managed to get one controller to work, but for the life of me I can't figure out how to make it create 2 input devices from one usb receiver with one set of event data.. I know there has to be a way though.
 
Old 03-19-2016, 02:17 PM   #8
pitcrawler
LQ Newbie
 
Registered: Mar 2016
Posts: 9

Rep: Reputation: Disabled
I've successfully separated the gamepads into two individual joystick devices using a different method.

Instead of trying to write a driver for the /dev/input/eventX or dev/input/jsX devices, I wrote my own driver using python-uinput by intercepting the raw hid data sent from the device. In my case it was /dev/hidraw3.

I've just tested both gamepads using two separate instances of the jstest-gtk program and they work fine. Now I'm going to try and test it out on some 2 player games on my Retropie box.

Some info about my driver:
It creates two extra (virtual) joystick devices named Joystick1 and Joystick2.
The original Shanwan twin joystick (With the merged analog input) still exists as a device in the system. You'd just use the virtual ones instead.
I currently have the hidraw device name hard coded. I may be able to find it automatically or allow it to be given as an argument in the future.

I will upload it to my Dropbox account and give a link later once I've tested things.

Last edited by pitcrawler; 03-19-2016 at 09:03 PM.
 
Old 03-26-2016, 11:00 AM   #9
joostvdb
LQ Newbie
 
Registered: Feb 2016
Posts: 5

Original Poster
Rep: Reputation: Disabled
Great work!

Great work pitcrawler! Is the vibration also working?

Also, could you share your code on github (https://github.com/xboxdrv/xboxdrv/) and share the branch name with us?

Thanks in advance!

Last edited by joostvdb; 03-26-2016 at 11:01 AM.
 
Old 03-26-2016, 12:28 PM   #10
pitcrawler
LQ Newbie
 
Registered: Mar 2016
Posts: 9

Rep: Reputation: Disabled
I'll try and get it uploaded somewhere this weekend.

Vibration does not currently work because, although uinput supports vibration, python-uinput doesn't yet. A patch request has been made for python-uinput to support vibration, but it might be beyond my abilities.

Also note that the file is just one self-contained python script.
 
Old 03-28-2016, 04:21 AM   #11
smith121
LQ Newbie
 
Registered: Mar 2016
Posts: 3

Rep: Reputation: Disabled
Linux

Very simple. Linux is opensource. Just follow the development list, fix some bugs, after you know your stuff, start maybe writing bigger stuff like new features, optimizations, maybe some drivers.
 
Old 03-30-2016, 06:54 PM   #12
pitcrawler
LQ Newbie
 
Registered: Mar 2016
Posts: 9

Rep: Reputation: Disabled
Here's what I have so far, let me know if you see any room for improvements.

This script must be run as root, so say your controller uses /dev/hidraw1 you'd go:
sudo python3 shanwan-joystick.py /dev/hidraw1 &
It'll then run as a background process and create two new joystick devices that are named "Joystick1" and "Joystick2" and can be tested using jstest/jstest-gtk for example.

To find out which /hidraw device your controller uses you can use the "dmesg" command and it should tell you. e.g.:
Code:
[   16.171759] hid-generic 0003:2563:0555.0006: input,hidraw5: USB HID v1.10 Joystick [ShanWan Twin USB Joystick] on usb-3f980000.usb-1.5/input0
tells me it's /dev/hidraw5

To use this with RetroPie, which it what I made it for, you can setup the first controller as an input device WITHOUT using this script. Then you'd make 2 copies of the controller definition file in /opt/retropie/configs/all/retroarch-joypads. Mine's called ShanWanTwinUSBJoystick.cfg. You'd rename those two copies Joystick1.cfg and Joystick2.cfg. (And maybe reboot your Raspberry pi and re-run the python script) Then you need to go into an individual emulator's settings and assign the joysticks to player 1 and 2. You'll have to figure that part out for yourselves.


shanwan-joystick.py:
Code:
import sys
import uinput
import time
#import struct

# Shanwan Twin USB hidraw driver.

# Read 32 bytes from hidraw. They remain static if you don't press
# anything on the joystick, but occasionally it flips from having 
# joystick id 1 to 2 at the start and vice-versa. We'll just test the
# first byte then we'll know which set of 8 bytes to look at for each
# joystick.

class TwinUSB:

    def __init__(self, devfile):
        try:
            self.file = open( devfile, "rb" );
        except:
            print ("Could not open", devfile)
            return
        self.buf = None
        self.oldBuf = None
        
        self.hatDir = [15, 15]
        self.oldHatDir = [15, 15]

        # Will hold the state of all of the buttons and axes.
        # Each gamepad has 12 buttons, 1 dpad and 2 analog sticks.
        # The buttons are either on or off, the dpad is either in
        # some direction or none.
        self.eventState = [[0, 0, 0, 0, 0, 0, 0 ,0 ,0 ,0 ,0 ,0, 127, 128, 127, 128, 0, 0], \
                           [0, 0, 0, 0, 0, 0, 0 ,0 ,0 ,0 ,0 ,0, 127, 128, 127, 128, 0, 0]]

        self.events = (uinput.BTN_TRIGGER, uinput.BTN_THUMB, uinput.BTN_THUMB2, \
              uinput.BTN_TOP, uinput.BTN_TOP2, uinput.BTN_PINKIE, \
              uinput.BTN_BASE, uinput.BTN_BASE2, uinput.BTN_BASE3, \
              uinput.BTN_BASE4,  uinput.BTN_BASE5,  uinput.BTN_BASE6,
              uinput.ABS_HAT0X + (-1, 1, 0, 0), \
              uinput.ABS_HAT0Y + (-1, 1, 0, 0), \
              uinput.ABS_X + (0, 255, 0, 0), uinput.ABS_Y + (0, 255, 0, 0),\
              uinput.ABS_Z + (0, 255, 0, 0), uinput.ABS_RZ + (0, 255, 0, 0))

        self.axisEvents = [uinput.ABS_HAT0X, uinput.ABS_HAT0Y, uinput.ABS_X, \
                  uinput.ABS_Y, uinput.ABS_Z, uinput.ABS_RZ]

        # Hat directions from top clockwise
        self.hatDirs = [[0,-1], [1, -1], [1, 0], [1, 1], \
                        [0, 1], [-1, 1], [-1, 0], [-1, -1]]

        self.devices = [uinput.Device(self.events, "Joystick1"), \
                        uinput.Device(self.events, "Joystick2")]

        time.sleep(1)

        
    def getEventChanges(self):
        """Read the raw controller input data into a buffer and interpret
           the data if it's different from the last read"""
    
        # Note: for buttons being released, the event state for the button
        # will be set to -1. (t.e. if it was previously pressed and now is
        # not pressed, it will be set to -1) The button release event will
        # be emitted once then the event state for the button will be reset
        # to 0.
        
        self.buf = self.file.read(32);
        if self.buf != self.oldBuf:
            self.oldBuf = self.buf
            # Interpret the events
            self.interpretEvents(self.buf[0])
 
       
    def interpretEvents(self, firstID):
    """Interpret the raw controller input data and update the event state"""
        # FirstID is the joystick id that is in the first byte of the
        # buffer, either 1 or 2. If it's anything else then something
        # went wrong.
        
        if firstID == 1 or firstID == 2:
            for dev in range(0, 2):
            
                # 6th byte is shape buttons
                btn = self.buf[((firstID - 1) * 8) + (dev * 8) + 5]
                # Buttons 1 to 4:
                self.eventState[dev][0] = -1 if self.eventState[dev][0] and not btn & 16 else btn & 16
                self.eventState[dev][1] = -1 if self.eventState[dev][1] and not btn & 32 else btn & 32
                self.eventState[dev][2] = -1 if self.eventState[dev][2] and not btn & 64 else btn & 64
                self.eventState[dev][3] = -1 if self.eventState[dev][3] and not btn & 128 else btn & 128

                # Buttons 5 to 12:
                btn = self.buf[((firstID - 1) * 8) + (dev * 8) + 6]
                self.eventState[dev][4] = -1 if self.eventState[dev][4] and not btn & 1 else btn & 1
                self.eventState[dev][5] = -1 if self.eventState[dev][5] and not btn & 2 else btn & 2
                self.eventState[dev][6] = -1 if self.eventState[dev][6] and not btn & 4 else btn & 4
                self.eventState[dev][7] = -1 if self.eventState[dev][7] and not btn & 5 else btn & 8
                self.eventState[dev][8] = -1 if self.eventState[dev][8] and not btn & 16 else btn & 16
                self.eventState[dev][9] = -1 if self.eventState[dev][9] and not btn & 32 else btn & 32
                self.eventState[dev][10] = -1 if self.eventState[dev][10] and not btn & 64 else btn & 64
                self.eventState[dev][11] = -1 if self.eventState[dev][11] and not btn & 128 else btn & 128

                # Left stick (eventstate 14-15) (byte 3 = x 4 = y))
                axisX = self.buf[((firstID - 1) * 8) + (dev * 8) + 3]
                axisY = self.buf[((firstID - 1) * 8) + (dev * 8) + 4]
                self.eventState[dev][12] = axisX
                self.eventState[dev][13] = axisY
                
                # Right stick (eventstate 12-13) (byte 1 = x 2 = y))
                axisX = self.buf[((firstID - 1) * 8) + (dev * 8) + 1]
                axisY = self.buf[((firstID - 1) * 8) + (dev * 8) + 2]
                self.eventState[dev][14] = axisX
                self.eventState[dev][15] = axisY
                
                # D-pad (first 4 bits of byte 5 is the hat direction.
                # value is 0 to 7 for the 8 directions starting from
                # the top and going clockwise. Neutral position = 15.)
                # these must be converted into -1, 0, 1 event values for
                # the x and y hat axes.
                
                # Mask off the last 4 bits
                self.hatDir[dev] = self.buf[((firstID - 1) * 8) + (dev * 8) + 5] & 0xf
                if self.hatDir[dev] == 15:
                    self.eventState[dev][16] = 0
                    self.eventState[dev][17] = 0
                else:
                    self.eventState[dev][16] = self.hatDirs[self.hatDir[dev]][0]
                    self.eventState[dev][17] = self.hatDirs[self.hatDir[dev]][1]
 
            
    def emitEvents(self):
        """Emit input events based on the current event state""" 
        for i in range(0, 2):
            # Button events:
            for j in range(0, 12):
                # If this button was just released then emit a release event
                # and reset to 0.
                if self.eventState[i][j] == -1:
                    self.devices[i].emit(self.events[j], 0)
                    self.eventState[i][j] = 0
                elif self.eventState[i][j] > 0:
                    self.devices[i].emit(self.events[j], 1)
            
            # Axis events
            self.devices[i].emit(self.axisEvents[2], self.eventState[i][12])
            self.devices[i].emit(self.axisEvents[3], self.eventState[i][13])
            self.devices[i].emit(self.axisEvents[4], self.eventState[i][14])
            self.devices[i].emit(self.axisEvents[5], self.eventState[i][15])
            
            # D=pad
            # if the current hat direction is different to oldHat
            # then send an event on both axes
            if self.oldHatDir[i] != self.hatDir[i]:
                self.devices[i].emit(self.axisEvents[0], self.eventState[i][16])
                self.devices[i].emit(self.axisEvents[1], self.eventState[i][17])
            
            self.oldHatDir[i] = self.hatDir[i]
 
 
"""Main proecess"""
try:
    if len(sys.argv) != 2:
        print ("Usage: joystick.py [hidraw-file]")
        sys.exit()
    if not sys.argv[1].startswith("/dev/"):
        print("You must enter a hidraw file path, e.g. /dev/hidraw0")
        sys.exit()
    cJoysticks = TwinUSB(sys.argv[1])
    # see if the file was opened
    if hasattr(cJoysticks, 'file'):
        running = 1
        while (running):
            cJoysticks.getEventChanges()
            cJoysticks.emitEvents()
            time.sleep(.02)
except KeyboardInterrupt:
    running = 0
    print ("Bye")
finally:
    if cJoysticks:
        if hasattr(cJoysticks, 'file'):
            cJoysticks.file.close()
 
1 members found this post helpful.
Old 04-02-2016, 02:14 PM   #13
joostvdb
LQ Newbie
 
Registered: Feb 2016
Posts: 5

Original Poster
Rep: Reputation: Disabled
Added support for more than 2 controllers

Hey all,

I published the code on github: https://github.com/JoostvdB94/ShanWanTwin_2-4Ghz_Linux
I also added some casts and removed the delay. The script adds new devices if there are more than 2 controllers too!

Have fun!
(script must be run as root!)
 
Old 04-03-2016, 07:33 PM   #14
pitcrawler
LQ Newbie
 
Registered: Mar 2016
Posts: 9

Rep: Reputation: Disabled
Thanks. I noticed you changed it to use python 2 instead of python 3 as I originally used. That's fine and it works ok. I think there was a warning about a tab being used on line 78 instead of spaces when I downloaded your version, but it's not a big deal.

I put the startup script in my /etc/rc.local and put the python script in /opt/ShanWanTwin_2-4Ghz_Linux/.

It took me longer than it should have taken, but I finally figured out how to get both controllers set-up from boot to work for both players in the emulators; at least in those that use Retroarch.

In emulationstation, you go to the setup menu. Choose the Setup Retroarch option. Then in the Retroarch menu, go to "Input" then "Player 1 bindings" Set it to use Shanwan Gamepad 1. Configure the controls and axes. Then go back and to "Player 2 bindings" and set it up to use Shanwan Gamepad 2 and configure the controls.

You also need to go into the hotkey bindings menu and set the hotkey enable button to select on your first gamepad. And set the enter menu button to X or whatever you want.

Then you go back to the main Retroarch menu and select "Save new config" It will save a timestamped config file in /opt/retropie/configs/all/. You'll need to go into the Linux commandline and rename that newly saved config file to "retroarch.cfg" replacing the one already called that.

I'm writing this all from memory but I'm sure it can be figured out. Good luck.
 
Old 04-10-2016, 07:05 AM   #15
joostvdb
LQ Newbie
 
Registered: Feb 2016
Posts: 5

Original Poster
Rep: Reputation: Disabled
I've also been looking for a way to automatically start and stop the script. I think the best way to do that is using the udev rules.
Is there anyone with experience with udev rules? I've been experimenting and wrote some rules, but none of them acually ran the script.
The rule below should work, but it doesn't. I'm also working on a way to save the PID so i can stop the script on unplug.

Code:
ACTION=="add", ENV{ID_VENDOR_ID}=="2563", ENV{ID_MODEL_ID}=="0555", ENV{ID_INPUT_JOYSTICK}="",MODE="0000", RUN+="/usr/bin/sh -c '/etc/init.d/start-shanwan.sh'"
Suggestions are still welcome on the github page!
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Dual Head, Twin view, separate X window - things you can do with multi displays MonsterMaxx Linux - Newbie 24 10-18-2008 01:04 AM
LXer: Twin Brothers of Separate Mothers LXer Syndicated Linux News 0 05-07-2008 09:41 AM
plugging in two gamepads DJOtaku Linux - Games 6 11-28-2006 07:46 AM
Separate Wallpaper in Twin View fredmt Linux - General 1 08-28-2005 05:29 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware

All times are GMT -5. The time now is 03:24 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration