You are not logged in.

#1 2011-09-15 04:24:00

clincher
Member
Registered: 2011-06-13
Posts: 6

How to get hardware's attention as soon as it gets plugged in?

I have this joystick with a cthulhu board, in case anyone has one and could use the details, and it seems to disconnect right after I plug it in. According to the person who builds the PCBs it appears the cthulhu is trying to go into PS3 mode since nothing is prompting it.

$ dmesg | tail -4
usb 4-4: new full speed USB device using ohci_hcd and address 5
input: Toodles 2008 Cthulhu+ PC/PS3 Controller as /devices/pci0000:00/0000:00:04.0/usb4/4-4/4-4:1.0/input/input12
generic-usb 0003:14D8:0409.000A: input,hidraw4: USB HID v1.11 Gamepad [Toodles 2008 Cthulhu+ PC/PS3 Controller] on usb-0000:00:04.0-4/input0
usb 4-4: USB disconnect, address 5

I have tried using this script:

#!/bin/bash

# Polls Toodles PC/PS3 Cthulhu controller, preventing it from entering XBox 360
# mode. Run this script as root, then plug in the controller.

DEV_DIR=/dev/input/by-id
DEV_NAME=usb-Toodles_2008_Cthulhu+_PC_PS3_Controller-joystick

echo "Please connect PC/PS3 Cthulhu now."

# Loop indefinitely until Cthulhu controller is detected
until [ -a $DEV_DIR/$DEV_NAME ]; do
    DO_NOTHING=""
done

echo "  - PC/PS3 Cthulhu detected. Ensuring connection..."

# Have Cthulhu scream into the void for a couple of seconds to ensure connection
cat $DEV_DIR/$DEV_NAME > /dev/null & CAT=$!
sleep 2
kill $CAT

echo "  - PC/PS3 Cthulhu connected!"

And I tried editing /etc/udev/rules.d/10-local.rules so it contains the following:

 SYSFS{idVendor}=="14d8", NAME="input/%k", RUN+="/bin/touch /dev/input/%k"

But those approaches didn't seem to work. It used to work and one day it just wouldn't, it was probably after an update and, since I don't play every day with it, I'm unsure as to what caused it.
Any help will be appreciated

EDIT: The stick is working fine, I have tested it on Windows.

Last edited by clincher (2011-09-15 04:26:27)

Offline

Board footer

Powered by FluxBB