Hardware :: Forcing Specific Driver For Device Through Udev
Oct 5, 2010
My co-workers and I are trying to develop a USB device, which uses an FTDI chip as a USB-serial controller. The thing is, we would ideally like to set a custom idVendor and idProduct on the FTDI chip. The problem occurs that when we set custom idVendor and idProduct values, udev(7) loads the "usb" driver. If we leave the idVendor and idProduct values to their originals, udev(7) loads the "ftdi_sio" driver. The whole reason for the custom idVendor and idProduct values is so that I can (hopefully) write a udev(7) rule to map that particular device to a specific entry in /dev. Is there a way to write a udev(7) rule so that you can forcefully load a particular driver for a device? Is there something else that could be done to get a similar result?
I am working on getting into driver development in Linux, I am developing a driver for the Hanvon GraphicPal drawing tablet.I have started writing a driver that actually detects the device when it is plugged in, so far thats all it does, it needs a lot more work. However, testing it is really hard because when I plug in the device normally, it gets picked up by usbhid or hidraw (not sure which), so the only way to get my driver to pick it up is to unload usbhid ("sudo rmmod usbhid") and then plug in the device. However, unloading usbhid kills my usb keyboard... which, as you can imagine, makes typing difficult, making it hard to develop drivers or even to reload usbhid. So is it possible to stop that specific device from being picked up by usbhid or hidraw and only by my driver?
How can I force a Wine application (or Wine itself) to use a specific network interface? I have installed hamachi and am trying to play starcraft over virtual LAN. However, when I run Starcraft with hamachi running, it does not work. I have now determined that hamachi creates a network interface called "ham0". How do I force Wine/Starcraft to use the "ham0" network connection? I have looked into forcebindip but it crashes on wine.
How can I force a Wine application (or Wine itself) to use a specific network interface? I have installed hamachi and am trying to play starcraft over virtual LAN. However, when I run Starcraft with hamachi running, it does not work. I have now determined that hamachi creates a network interface called "ham0". How do I force Wine/Starcraft to use the "ham0" network connection?I have looked into forcebindip but it crashes on wine .
# rfcomm -a rfcomm0: 00:1A:89:09:8C:77 channel 1 clean rfcomm1: 00:07:E0:2E:99:43 channel 3 clean Then I connect by the mobile, and: # rfcomm -a rfcomm0: 00:1A:89:09:8C:77 channel 1 clean rfcomm1: 00:07:E0:2E:99:43 channel 3 clean rfcomm2: 00:1BC:0F:5C:AB -> 00:07:E0:2E:99:43 channel 1 connected [reuse-dlc release-on-hup tty-attached]
What the heck is that rfcomm2, when that mobile is bound to rfcomm1? Is it udev that makes fun of me? If so, how to bind the devices to specific rfcomm interfaces via udev?
I have a trayless SATA hotswap bay that is really terrific for quickly attaching and removing SATA hard drives. I'm trying to write a udev rule to create a symbolic link to the device node for the drive that is attached through the hotswap bay (/dev/bay -> /dev/sdX). This eliminates any ambiguity when performing destructive tasks (fdisk, etc). I'm running squeeze amd64. I've read through several tutorials and have it working somewhat. Here's the output of udevadm info for a drive attached via the hotswap bay.
Here is my udev rule DEVPATH=="/devices/pci0000:00/0000:00:11.0/host7/*", SUBSYSTEM=="block", SYMLINK+="bay%n"
This produces the desired behavior and gives me an fdisk-able device node. The problem I am having is that the "host" component of the DEVPATH varies from bootup to bootup. I'm just using on onboard SATA, host2-7, specifically host7. There is also onboard PATA, host0-1. It seems to just be random which "host"s are assigned to which controller. For example, the next time I boot the system, the onboard SATA will be host0-5 and the onboard PATA will be host6-7. In this simple case, I could just write 2 rules, one for each possibility and it would still be correct because of the different PCI addresses of the two controllers. But on systems with more SCSI (uh... libata, actually) controllers, a "host" file can point to different physical ports between bootstraps. This would be bad. Does anyone know of a way to write a rule to tie a device node to a specific physical SATA port on the motherboard/hba?
I have a Linux server that runs the Sybase DB. Sybase suggests using character devices to access raw devices rather than O_DIRECT to block devices, or cooked FS's. So, I went ahead and configured /etc/sysconfig/rawdevices as such:
This works fine. I set 'chkconfig rawdevices on' and all is well. I read that this method is deprecated and went about trying to accomplish the same via Udev rules. I already use udev rules in /etc/udev/rules.d/60-raw.rules to set permissions on these devices, i.e. ACTION=="add", KERNEL=="raw*", OWNER=="sybase", GROUP=="sybase", MODE=="0660"
That works fine. I even set symbolic links: KERNEL=="raw1", SYMLINK+="vg01/rtempdb" KERNEL=="raw2", SYMLINK+="vg01/rtestdb1" KERNEL=="raw3", SYMLINK+="vg01/rfakedb2"
But I cannot seem to get the actual device creation piece to work within udev (it only works using rawdevices). I've tried: ACTION=="add", KERNEL=="vg01/tempdb", RUN+="/bin/raw /dev/raw/raw1 %N"
No errors, but nothing happens. The device just doesn't create. I've also tried doing it by passing major and minor numbers. Is it possible to get all of this into udev rules or am I stuck with rawdevices? I'm also utterly confused as to the future of rawdevices... the raw man page said it was deprecated, and now at v5.5 it has that piece taken out. Also RHEL 5.3 dropped support for rawdevices in initscripts only to add itback in 5.4. I'm an admin, not a DBA, so I cannot say if this is a bad or good way, only that it is the way the vendor supports and recommends, so it is the way that I must go... just trying to make it work as "un-deprecated" and cleanly as possible.
Having finally made the switch from Windows (7 Professional) to Linux (Fedora 13) on my laptop, I'm now trying to get all my devices working, specifically an Olympus VN-4100PC Digital Voice Recorder. I've installed odvr and it works in root, but not as a normal user. The installation instructions say: odvr *requires* access to the user-space USB interface.
It is recommended to place "41-odvr.rules" into "/etc/udev/rules.d" or setup your own udev rules rather than running odvr as root. After changing udev rules, don't forget to run "udevcontrol reload_rules" and to replugin your DVR. Again, root privileges are required unless udev is properly setup. The file "41-odvr.rules" (designed for Ubuntu) has the following content: SUBSYSTEM=="usb", SYSFS{idVendor}=="07b4", SYSFS{idProduct}=="020d", ACTION=="add", GROUP="audio", MODE="0664"
I tried just doing what it said and copying it to "/etc/udev/rules.d" but it didn't seem to work. Looking at other files, I then changed it to: SUBSYSTEM=="usb", ATTR{idVendor}=="07b4", ATTR{idProduct}=="020d", ACTION=="add", GROUP="audio", MODE="0664"
And now if I do "ls -l /dev/bus/usb/002", I get: crw-rw-r--. 1 root audio 189, 134 Oct 15 01:21 007
Which seems to suggest that it is running the "41-odvr.rules" file, since lsusb gives: Bus 002 Device 007: ID 07b4:020d Olympus Optical Co., Ltd Digital Voice Recorder VN-240PC
But odvr still doesn't work as a normal user, giving: Failed to open Olympus device: couldn't claim interface
My touchscreen "LG Display LGD-MultiTouch" will be recognized sometimes as /dev/input/event0 and sometimes as /dev/input/event3. How to hardcode /dev/input/event0 using udev and xorg.conf?
I need to prevent udev from creating the /dev/v4l/by-path/* and /dev/v4l/by-id/* files upon connecting my webcam. The problem is that Kopete doesn't want to display the video if these files are present. It works fine if I remove them, but I'd rather not have them created in the first place, since they seem to be completely useless anyway.
I have just bought a DVB-T usb dongle to watch some TV. The software I'm using is vdr, which has to be started through the /etc/init.d/vdr service. I have created a udev script that executes the service on device insertion. It works nicely, however now when I boot up the computer it takes ages to get to desktop. I believe it is because of the WAIT_FOR part. But without this part, the service starts too soon because the usb dongle has been inserted but the firmware has not finished loading. Can someone point out an alternative way to do it? The script is here [URL].
how udev rules work to create device files. Following is what I did for that: Up on plugging in my phone (sony w800i), I am getting a device file 'devcdc-wdm0' created. I just tried to figure out the rule which is responsible for the creation of this particular file.
I searched in 'etcudev ules.d' and 'libudev ules.d' for the string 'cdc-wdm' to find that rule. But I am not getting any hits in that search. Could any one help me out in this one.
On my debian lenny OS I have an external usb hard disk I would like to automount it at boot. So I edited the /etc/fstab file in order to automount /dev/sdb1. It worked without problem. Then I recompiled the kernel and, as consequence, /dev/sdb1 changed to /dev/sdc1. I started playing with udev in order to match the now called /dev/sdc1 and to change its name in /dev/maxtor (being maxtor the brand of the hard disk). Obviously I edited also /etc/fstab: /dev/sdb1 is now /dev/maxtor.
The boot automount doesn't work anymore. On the boot sequence I can read the message "Mounting local filesystem...mount: special device /dev/maxtor does not exist FAILED". But when I log into the system I can run the command "mount /dev/maxtor /mnt/maxtor" and it works! So, IMHO, my udev rule is correct otherwise also the manual mount wouldn't work, right? I have to tell to udev to create /dev/maxtor BEFORE the boot automount process.
I tried to delete my udev rule and to edit /etc/fstab changing /dev/maxtor in /dev/sdc1 (the name udev gave to my hard disk after kernel recompile, before was /dev/sdb1) and it didn't work: on boot process I always see the "Mounting local filesystem...mount: special device /dev/sdc1 does not exist Failed". Then I tried to change /dev/sdc1 in /dev/sdb1 in /etc/fstab and to reboot with the old original kernel and int this way it works. With my compiled kernel, the OS seems to have lost the capacity to detect my device node correctly.
Some times I boot up, and udev has labelled what is usually eth0 as eth1. Of course, my rc.inet1.conf is configured for seeing internet at eth0, so no connection, quite obviously. Then I reboot and the device label is back to "eth0". Actually I'm still not able to get connected, even at eth0, despite my nameservers being OK, and the default route gateway being all OK. PS. I have a static ip address.
I am using a 3rd party kernel driver that does not support udev properly. When I was using wheezy I placed the required device files in /lib/udev/devices.
The udev in jessie does not appear to support this. Is there any way to have udev create these device files or will I have to create then using a script at boot-up?
I am currently using fedora 11 kernel 2.6.29 version, i wanted to write device driver for usb to detect my own device. My project is radio with computer. My fm radio get connected to usb port so i need to write h/w interfacing program.
The error "USB device 6 (vend/prod 0x603/0xf2) is not claimed by any active driver." is in dmesg every time I connect my Logitech keyboard to my system. I also tried (all with the same error): - Memory stick - DVD-burner - Compaq mouse
I have installed live cd on usb pendrive. Everything works great. How can I find out which device driver it is using? Where are the device driver files stored? How do you specify the device driver when mounting a device?
I've just installed Ubuntu 10.4 and was trying to use a small bash script for which I need hcitool to return the device name. The problem is that hcitool returns nothing when I query for the device's name using the address. The address was found using hcitool's scan option, so I know the device is responding. Also, I can pair the laptop with the phone using gnome's bluetooth application, what I can't do is get hcitool to return the device's name. I've tried scanning for other devices and querying for their names, and I tried using another laptop with Ubuntu installed to get the phone's name, in all cases hcitool returns the device's name, only when issuing the query from my mac to this specific phone does hcitool fail.
I'm issuing the following commands: Code: knitter@knitter-laptop:~$ hcitool scan Scanning ... <address omitted><name omitted> 00:8D:31:8C:0C:0AKntSE <address omitted><name omitted>
After getting the list of devices that were found I grab my phone's address and ask for the name. Code: knitter@knitter-laptop:~$ hcitool name 00:8D:31:8C:0C:0A knitter@knitter-laptop:~$ As you can see, when scanning for devices I get both the address and the name, but when asking for the name I get nothing, and I really needed to use the hcitool name <address> command for the script as it would make things easier.
I was trying to get this feature: wake up my htpc from s3 with my remote control and the solution is to modify /proc/acpi/wakeup and a descriptor in /sys. Here are the details: I'm using a Microsoft IR receiver for MCE remote that appears as dev 2 of bus 2 in lsusb
root@htpc:~# lsusb Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub Bus 002 Device 002: ID 0471:0815 Philips (or NXP) eHome Infrared Receiver Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub Bus 001 Device 006: ID 045e:0714 Microsoft Corp. Bus 001 Device 005: ID 045e:0715 Microsoft Corp. Bus 001 Device 004: ID 045e:0707 Microsoft Corp. Wireless Laser Mouse 8000 Bus 001 Device 003: ID 045e:070c Microsoft Corp. Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub....
That's USB0 I have to enabled, why not usb 1 or 2 (bus 2 in lsusb)? Moreover why are all the disabled/enabled preceded with a star and S4 and not S3 mentioned? Nevertheless that wasn't enough to get it work. I looked in gconf-editor in apps/gnome-power-manager/general but I have no can-suspend or something similar... (I'm running on 10.10, with 10.04 I could suspend only once, afterwards the computer didn't go to suspend, just black screen then login screen). So I looked in /sys/ and found that 'cat /sys/bus/usb/devices/2-1/power/wakeup' (notice the 2.1 as bus 2 device 2 (0,1,...) gave 'disabled' so a echo enabled > /sys/bus/usb/devices/2-1/power/wakeup and now I can wake-up with the remote when I want.
What I don't understand: Why USB0 in /proc/acpi/wakeup ? Why have to change in /proc and /sys ? Is it possible to automate this to get it work even if I change the usb port the receiver is plugged in ?
I am trying to setup a complex audio system, but I won't bore you with the details (unless you ask). Basically, I want to have pulseaudio only use one specific device and ignore the rest of the devices.
11.04 64 bit I just picked up a new high-gain usb wireless adapter that I would like to use for a while in place of the built in wireless adapter in my desktop. It is detected and works just fine. My question is this: Is there any way I can disable just the built in adapter and leave the new one active (or visa versa?) I don't want to remove the built-in one as there will be occasions that I will want to use both.
How can I mount a device with specific user rights on start up? I still have some problems figuring it out. I would like to mount the divide with uid=1000 and gid=1000. My current entry to the /etc/fstab/ file looks like this:
Currently I have 5 HID's I would like to use on the system at any given time. However, I have the problem of them using different device paths depending on what order I plug them in... Which wreaks havoc on qjoypad and also my music software which looks for a specific device number, which may or may not be the same as it was last time.
For example, I have 2 rock band drum controllers which I use to send MIDI signals. I need them always assigned to the same device path, so that I don't have to change the settings in my music software every time I run it, to make sure it's looking at the right controller
Or if I am going to play games with a gamepad, but I also have the drums hooked up, the gamepad may be assigned to /dev/input/js2, so I create my qjoypad profile.... Let's say the next day I reboot with the drums not plugged in, the gamepad is now /dev/input/js0, and the qjoypad profile won't work because it is looking for that gamepad at /dev/input/js2... So I would either have to create a new profile, or hook the drums back up in the same order ... Or something
It's just a mess...
Is there any way to tell Ubuntu to say "/dev/input/js0 is always Playstation gamepad", "/dev/input/js1 is always drum pad 1", etc.?
Or some way to do away with /dev/input scheme altogether and somehow link directly to the name of the device?
I have a ZTE 3G USB modem (MF645). When I plug it, 5 devices appear: /dev/ttyUSB[0-4]. The modem device is /dev/ttyUSB2, and I can successfully connect wvdial on it. NetworkManager detects the modem, however, it tries to connect to /dev/ttyUSB1 instead, and fails.
How does NM decides which device to connect to? Is it possible to instruct it to connect to a specific device?
Is there a way to bind specific programs to specific network devices (not IPs, since I have dynamic IPs)?
For example, I wish for irssi to route through eth0 and w3m to route through eth1. Keep in mind these devices have dynamic IPs, so I cannot attached them to an IP.
The solution cannot be accomplished through route since route pivots on IPs not devices.
This is one of those questions where I highly suspect that the answer will be something like ". . .just stinks bein' you, kid."My setup:I have Ubuntu 10.04 x64 (desktop) installed on a computer with a bunch of SATA ports, including one e-SATA on the backBecause of the way the hardware works with these ports, the *external* port is the first SATA port, a second SATA port inside becomes #2, and a cluster of four ports (that can be made into a (ahem!) RAID array become ports 3 through 6.
All ports are configured as SATA (PATA emulation)My boot drive is located on SATA-2 (the inside connector), a four disk "MD" raid array is located on SATA 3-6, and I have an external HD enclosure that I plug into the e-SATA connection.
With all six drives plugged in, they get ordered like this: /dev/sda - External drive /dev/sdb - Internal operating system drive (bootable)