LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 02-22-2014, 12:33 PM   #1
pchristy
Senior Member
 
Registered: Oct 2012
Location: South Devon, UK
Distribution: Slackware
Posts: 1,119

Rep: Reputation: Disabled
Stop udev claiming usb device as hid


I have a WiSPY 2.4 GHz spectrum analyzer dongle. When I plug it into the system, udev claims it as a HID device (which it isn't!) and stops the spectools software accessing it.

The software comes with a set of udev rules that I've installed in /etc/udev/rules.d (yes, I've tried it in /lib/udev/rules.d too!) which contains the following relevant line:

ATTRS{idVendor}=="1781", ATTRS{idProduct}=="083e", MODE="0660", OWNER="users"

Following advice gleaned via Google, I've amended this to:

ATTRS{idVendor}=="1781", ATTRS{idProduct}=="083e", MODE="0660", OWNER="plugdev", RUN="/bin/sh -c 'echo -n $id:1.0 > /sys/bus/usb/drivers/usbhid/unbind'"

(I am a member of the plugdev group).

This worked under Mageia 4, but doesn't work now I've returned to Slack!

Its as if Slack can't read the rules file, although the permissions are the same as the other files in the directory.

As an aside - which may or may not be related - my system also seems unable to read the HOSTNAME file, as the hostname stays resolutely stuck on darkstar. Is it possible that I've omitted an essential file whilst installing which is preventing the system from reading some system files properly? And if so, what on earth can it be?

All suggestions gratefully received!

System is Slackware64-14.0, running a home-brew kernel-3.4.80. Everything else seems to be working fine.

--
Pete

Last edited by pchristy; 02-22-2014 at 12:34 PM.
 
Old 02-22-2014, 01:26 PM   #2
Richard Cranium
Senior Member
 
Registered: Apr 2009
Location: McKinney, Texas
Distribution: Slackware64 15.0
Posts: 3,858

Rep: Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225
Change /etc/hosts to match the machine name that you really want.
 
Old 02-22-2014, 02:43 PM   #3
pchristy
Senior Member
 
Registered: Oct 2012
Location: South Devon, UK
Distribution: Slackware
Posts: 1,119

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by Richard Cranium View Post
Change /etc/hosts to match the machine name that you really want.
Already done - no effect! I think also you mean etc/HOSTNAME - that's what rc.M looks at, and if it doesn't find it, it drops back to the default (darkstar). I do have my computer's name in /etc/hosts - along with the others on the local net - and in /etc/HOSTNAME, but rc.M doesn't seem to be recognising it for some reason, which makes me wonder if its related to an inability to read the udev rules as well.

I've also checked the permissions of both files, and they seem ok.

Of course, I could be barking up completely the wrong tree, and the two issues may be unrelated!

But thanks for the suggestion!

Cheers,

--
Pete
 
Old 02-22-2014, 02:50 PM   #4
Richard Cranium
Senior Member
 
Registered: Apr 2009
Location: McKinney, Texas
Distribution: Slackware64 15.0
Posts: 3,858

Rep: Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225
What's the output of...
Code:
ls -l /etc/HOSTNAME
...?
 
Old 02-23-2014, 01:59 AM   #5
pchristy
Senior Member
 
Registered: Oct 2012
Location: South Devon, UK
Distribution: Slackware
Posts: 1,119

Original Poster
Rep: Reputation: Disabled
-rw-r--r-- 1 root root 21 Feb 20 19:31 /etc/HOSTNAME

--
Pete
 
Old 02-23-2014, 03:15 AM   #6
Richard Cranium
Senior Member
 
Registered: Apr 2009
Location: McKinney, Texas
Distribution: Slackware64 15.0
Posts: 3,858

Rep: Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225
OK. Have you tried updating /etc/HOSTNAME to contain the correct name and then running...
Code:
echo $(cat /etc/HOSTNAME | cut -f1 -d .)
/bin/hostname $(cat /etc/HOSTNAME | cut -f1 -d .)
...as root to see what happens?
 
Old 02-23-2014, 03:25 AM   #7
Richard Cranium
Senior Member
 
Registered: Apr 2009
Location: McKinney, Texas
Distribution: Slackware64 15.0
Posts: 3,858

Rep: Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225
As for the problem that you really care about, unplug your dongle, open a terminal as root, run the command
Code:
udevadm monitor
and plug the dongle back in. You should get a dump of the kernel and udevd events that are triggered by the device. Please provide that output.
 
Old 02-23-2014, 03:38 AM   #8
Richard Cranium
Senior Member
 
Registered: Apr 2009
Location: McKinney, Texas
Distribution: Slackware64 15.0
Posts: 3,858

Rep: Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225
You might find http://www.reactivated.net/writing_udev_rules.html useful too.
 
Old 02-23-2014, 04:24 AM   #9
pchristy
Senior Member
 
Registered: Oct 2012
Location: South Devon, UK
Distribution: Slackware
Posts: 1,119

Original Poster
Rep: Reputation: Disabled
1) ~$ cat /etc/HOSTNAME
minivac.christy.home

(Just to be sure )

2)root@darkstar:/home/pchristy# echo $(cat /etc/HOSTNAME | cut -f1 -d .)
minivac
root@darkstar:/home/pchristy# /bin/hostname $(cat /etc/HOSTNAME | cut -f1 -d .)
root@darkstar:/home/pchristy#

First command seems to correctly read Hostname, but second one doesn't change hostname until I close terminal and re-open it. Then hostname is correct. So it looks as if all the elements are correctly in place, so why doesn't it work from within rc.M?

3) root@minivac:/home/pchristy# udevadm monitor
monitor will print the received events for:
UDEV - the event which udev sends out after rule processing
KERNEL - the kernel uevent

KERNEL[741.579120] add /devices/pci0000:00/0000:00:13.0/usb4/4-2 (usb)
KERNEL[741.584933] add /devices/pci0000:00/0000:00:13.0/usb4/4-2/4-2:1.0 (usb)
KERNEL[741.585108] add /devices/pci0000:00/0000:00:13.0/usb4/4-2/4-2:1.0/0003:1781:083E.0002 (hid)
KERNEL[741.590238] add /class/usb (class)
KERNEL[741.590429] add /devices/pci0000:00/0000:00:13.0/usb4/4-2/4-2:1.0/usb/hiddev0 (usb)
KERNEL[741.590527] add /devices/pci0000:00/0000:00:13.0/usb4/4-2/4-2:1.0/0003:1781:083E.0002/hidraw/hidraw0 (hidraw)
UDEV [741.591135] add /class/usb (class)
UDEV [741.601603] add /devices/pci0000:00/0000:00:13.0/usb4/4-2 (usb)
UDEV [741.604370] add /devices/pci0000:00/0000:00:13.0/usb4/4-2/4-2:1.0 (usb)
UDEV [741.606468] add /devices/pci0000:00/0000:00:13.0/usb4/4-2/4-2:1.0/0003:1781:083E.0002 (hid)
UDEV [741.609229] add /devices/pci0000:00/0000:00:13.0/usb4/4-2/4-2:1.0/usb/hiddev0 (usb)
UDEV [741.612494] add /devices/pci0000:00/0000:00:13.0/usb4/4-2/4-2:1.0/0003:1781:083E.0002/hidraw/hidraw0 (hidraw)


Again, if I'm reading that correctly, it looks as if udev is not reading the rule at all!

BTW, thanks very much for the assistance! I've been using slack for some years, so I'm reasonably familiar with it, but something has gone wrong with this installation - probably my fault - and I'm struggling to figure it out!

Its Sunday morning here in the UK so we're a few hours ahead of Texas time! I have to go out and attend to some family business for a few hours, so I'll be silent for a bit!

Cheers,

--
Pete
 
Old 02-23-2014, 05:01 AM   #10
Richard Cranium
Senior Member
 
Registered: Apr 2009
Location: McKinney, Texas
Distribution: Slackware64 15.0
Posts: 3,858

Rep: Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225
You don't happen to have /etc mounted on a different partition than / do you?
 
Old 02-23-2014, 05:07 AM   #11
Richard Cranium
Senior Member
 
Registered: Apr 2009
Location: McKinney, Texas
Distribution: Slackware64 15.0
Posts: 3,858

Rep: Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225
Well, udev is a special pile of magic of its own.

What does running the command
Code:
udevadm test /devices/pci0000:00/0000:00:13.0/usb4/4-2/4-2:1.0/0003:1781:083E.0002
as root give you?
 
Old 02-23-2014, 05:41 AM   #12
pchristy
Senior Member
 
Registered: Oct 2012
Location: South Devon, UK
Distribution: Slackware
Posts: 1,119

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by Richard Cranium View Post
You don't happen to have /etc mounted on a different partition than / do you?
No, its all on/dev/sda1.


root@darkstar:/home/pchristy# udevadm test /devices/pci0000:00/0000:00:13.0/usb4/4-2/4-2:1.0/0003:81:083E.0002
run_command: calling: test
adm_test: version 182
This program is for debugging only, it does not run any program,
specified by a RUN key. It may show incorrect results, because
some values may be different, or not available at a simulation run.

builtin_kmod_init: load module index
add_matching_files: unable to open '/run/udev/rules.d': No such file or directory
parse_file: reading '/lib/udev/rules.d/10-dm.rules' as rules file
parse_file: reading '/lib/udev/rules.d/11-dm-lvm.rules' as rules file
parse_file: reading '/lib/udev/rules.d/13-dm-disk.rules' as rules file
parse_file: reading '/lib/udev/rules.d/40-libgphoto2.rules' as rules file
parse_file: reading '/lib/udev/rules.d/40-slackware.rules' as rules file
parse_file: reading '/lib/udev/rules.d/40-usb-media-players.rules' as rules file
parse_file: reading '/lib/udev/rules.d/40-usb_modeswitch.rules' as rules file
parse_file: reading '/lib/udev/rules.d/42-usb-hid-pm.rules' as rules file
parse_file: reading '/lib/udev/rules.d/50-udev-default.rules' as rules file
parse_file: reading '/lib/udev/rules.d/55-hpmud.rules' as rules file
parse_file: reading '/lib/udev/rules.d/56-hpmud_add_printer.rules' as rules file
parse_file: reading '/lib/udev/rules.d/56-hpmud_support.rules' as rules file
parse_file: reading '/lib/udev/rules.d/59-non-libata-devices.rules' as rules file
parse_file: reading '/lib/udev/rules.d/60-cdrom_id.rules' as rules file
parse_file: reading '/lib/udev/rules.d/60-floppy.rules' as rules file
parse_file: reading '/lib/udev/rules.d/60-persistent-alsa.rules' as rules file
parse_file: reading '/lib/udev/rules.d/60-persistent-input.rules' as rules file
parse_file: reading '/lib/udev/rules.d/60-persistent-serial.rules' as rules file
parse_file: reading '/lib/udev/rules.d/60-persistent-storage-tape.rules' as rules file
parse_file: reading '/lib/udev/rules.d/60-persistent-storage.rules' as rules file
parse_file: reading '/lib/udev/rules.d/60-persistent-v4l.rules' as rules file
parse_file: reading '/lib/udev/rules.d/60-wacom.rules' as rules file
parse_file: reading '/lib/udev/rules.d/61-accelerometer.rules' as rules file
parse_file: reading '/lib/udev/rules.d/65-permissions.rules' as rules file
parse_file: reading '/lib/udev/rules.d/69-libmtp.rules' as rules file
parse_file: reading '/lib/udev/rules.d/70-infrared.rules' as rules file
parse_file: reading '/etc/udev/rules.d/70-persistent-cd.rules' as rules file
parse_file: reading '/etc/udev/rules.d/70-persistent-net.rules' as rules file
parse_file: reading '/lib/udev/rules.d/70-printers.rules' as rules file
parse_file: reading '/lib/udev/rules.d/75-cd-aliases-generator.rules' as rules file
parse_file: reading '/lib/udev/rules.d/75-net-description.rules' as rules file
parse_file: reading '/lib/udev/rules.d/75-persistent-net-generator.rules' as rules file
parse_file: reading '/lib/udev/rules.d/75-probe_mtd.rules' as rules file
parse_file: reading '/lib/udev/rules.d/75-tty-description.rules' as rules file
parse_file: reading '/lib/udev/rules.d/77-nm-olpc-mesh.rules' as rules file
parse_file: reading '/lib/udev/rules.d/78-sound-card.rules' as rules file
parse_file: reading '/lib/udev/rules.d/80-drivers.rules' as rules file
parse_file: reading '/lib/udev/rules.d/80-libnjb.rules' as rules file
parse_file: reading '/lib/udev/rules.d/80-udisks.rules' as rules file
add_rule: IMPORT found builtin 'pci-db %p', replacing /lib/udev/rules.d/80-udisks.rules:6
parse_file: reading '/lib/udev/rules.d/80-udisks2.rules' as rules file
parse_file: reading '/lib/udev/rules.d/85-regulatory.rules' as rules file
parse_file: reading '/lib/udev/rules.d/86-hpmud_plugin.rules' as rules file
parse_file: reading '/lib/udev/rules.d/90-alsa-restore.rules' as rules file
parse_file: reading '/lib/udev/rules.d/90-libgpod.rules' as rules file
parse_file: reading '/lib/udev/rules.d/95-dm-notify.rules' as rules file
parse_file: reading '/lib/udev/rules.d/95-keyboard-force-release.rules' as rules file
parse_file: reading '/lib/udev/rules.d/95-keymap.rules' as rules file
parse_file: reading '/lib/udev/rules.d/95-udev-late.rules' as rules file
parse_file: reading '/lib/udev/rules.d/95-upower-battery-recall-dell.rules' as rules file
parse_file: reading '/lib/udev/rules.d/95-upower-battery-recall-fujitsu.rules' as rules file
parse_file: reading '/lib/udev/rules.d/95-upower-battery-recall-gateway.rules' as rules file
parse_file: reading '/lib/udev/rules.d/95-upower-battery-recall-ibm.rules' as rules file
parse_file: reading '/lib/udev/rules.d/95-upower-battery-recall-lenovo.rules' as rules file
parse_file: reading '/lib/udev/rules.d/95-upower-battery-recall-toshiba.rules' as rules file
parse_file: reading '/lib/udev/rules.d/95-upower-csr.rules' as rules file
parse_file: reading '/lib/udev/rules.d/95-upower-hid.rules' as rules file
parse_file: reading '/lib/udev/rules.d/95-upower-wup.rules' as rules file
parse_file: reading '/lib/udev/rules.d/97-bluetooth-hid2hci.rules' as rules file
parse_file: reading '/lib/udev/rules.d/97-bluetooth-serial.rules' as rules file
parse_file: reading '/lib/udev/rules.d/97-bluetooth.rules' as rules file
parse_file: reading '/lib/udev/rules.d/99-fuse.rules' as rules file
parse_file: reading '/etc/udev/rules.d/99-wispy.rules' as rules file
util_lookup_user: specified user 'plugdev' unknown
udev_rules_new: rules use 229692 bytes tokens (19141 * 12 bytes), 35589 bytes buffer
udev_rules_new: temporary index used 59780 bytes (2989 * 20 bytes)
unable to open device '/sys/devices/pci0000:00/0000:00:13.0/usb4/4-2/4-2:1.0/0003:1781:083E.0002'
builtin_kmod_exit: unload module index


Interesting! Right at the end it doesn't seem to recognise the "plugdev", even though this is listed in kuser! I have now tried changing the group in the rule to "users", and it doesn't recognise that either!

I feel we are getting somewhere, but right now I really do have to go out!

Many thanks for your assistance

--
Pete
 
Old 02-23-2014, 05:54 AM   #13
Richard Cranium
Senior Member
 
Registered: Apr 2009
Location: McKinney, Texas
Distribution: Slackware64 15.0
Posts: 3,858

Rep: Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225
OWNER in the rule would mean user. You probably want to use GROUP instead.
 
Old 02-23-2014, 05:55 AM   #14
Richard Cranium
Senior Member
 
Registered: Apr 2009
Location: McKinney, Texas
Distribution: Slackware64 15.0
Posts: 3,858

Rep: Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225
I'm at a loss on the hostname thing. You could add some echo commands in /etc/rc.d/rc.M in that block of code to see what's going on during startup.
 
Old 02-23-2014, 11:27 AM   #15
pchristy
Senior Member
 
Registered: Oct 2012
Location: South Devon, UK
Distribution: Slackware
Posts: 1,119

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by Richard Cranium View Post
OWNER in the rule would mean user. You probably want to use GROUP instead.
D'oh! I can't believe I missed that! I've been staring at it so long, I can't see the wood for the trees!

Many thanks, that fixed it!

Now what on earth is causing the hostname issue.....

Just a thought: This is a laptop, and I'm using network manager instead if rc.inet(whatever). I wonder if there's something in there......

--
Pete
 
  


Reply

Tags
hid, udev



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
Usb hid device fos Programming 3 09-03-2010 06:10 AM
USB - HID device enumeration process anmol_ranka Programming 1 04-18-2007 12:50 PM
HID ( Human Interface Device ) USB saeed371 Debian 1 10-16-2005 05:47 PM
Problem with usb hid device on nforce 2 gak330 Linux - Hardware 0 06-06-2004 12:44 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 01:43 AM.

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