udev: symlink for my meizu m6
I want to create a symlink to my meizu m6.... say something like /dev/meizu
How do I specify a rule for udev to do it? Here's the info for the device: Code:
$ udevinfo --query=all --name=sdb |
There may already be a file in /etc/udev/rules.d that contains a rule for your device and if so, you can edit it to suit your needs. Let's assume there isn't such a file. You can make a rule like this:
ENV{ID_VENDOR}=="Meizu", ENV{ID_MODEL}=="MiniPlayer", ENV{ID_SERIAL_SHORT}=="000000E5E5000", SYMLINK+="meizu" Add this as a single line to a new file in /etc/udev/rules.d, which you can call something like 10-local.rules. I've deliberately chosen properties that are meaningful (model, manufacturer, serial number) because it makes more sense to identify a device by those things rather than, say, file system type. |
Ok... let my try that. I wonder if it's possible to use ID_FS_UUID to identify it.
Code:
ENV{ID_FS_UUID}=="68DE-5DE7",SYMLINK+="meizu" |
Of course you're free to add that property to the rule!
|
Good to know, however, it didn't work your way... nor mine. :-)
I don't have to restart udev (/etc/init.d/udev restart) after adding/editing the file, right? Cause I just read that files are read by udev when events are performed by the kernel. Here's the file as I created it: Code:
$ cat 62-meizu.rules By the way, I'm on kubuntu gutsy. |
Yeah, you shouldn't need to restart udev but it wouldn't hurt to do so. Just to check: are there any other files in /etc/udev/rules.d?
|
Yes, there are a number of files.
Code:
$ ls -l Code:
$ cat README |
Ok. In theory it should work then. First try restarting udev and see if you have a /dev/meizu. I've had strange problems with udev rules that seem to fix themselves after a restart of the udev daemon. Edit: also, let's see what's in your 60-symlinks.rules and 65-libmtp.rules files (I'm not sure if your device uses MTP or not).
|
Is it possible to see what rules are being applied on a device? Maybe with udevmonitor?
|
I've never actually used udevmonitor (apart from just now), but it's worth a try to see what's happening. Try running it with the --environment option and see what that gives you. For example, running it after turning my USB DVD-rewriter on gives me (amongst other things)
DEVLINKS=/dev/disk/by-id/usb-ATAPI_DVD_A_DH20A3P_0000000000121C73-0:0 /dev/disk/by-path/pci-0000:00:1d.7-usb-0:2:1.0-scsi-0:0:0:0 /dev/cdrom /dev/dvd /dev/dvdrw /dev/cdrw, which shows the symlinks my udev rules have created. |
It can use MTP or MSC. Right now it's MSC.
Anyway, here are the files: 60-symlinks.rules Code:
# This file establishes user-friendly symlinks to devices according to Code:
# UDEV-style hotplug map for libmtp |
The only thing I did was connect the Meizu. Here's the output:
Code:
$ sudo udevmonitor --environment |
There's nothing in those files specifically referring to your device. Another thing you could try is making your rule similar to the ones in those files (i.e. using ATTRS{*} and SYSFS{*} keys rather than ENV{*} ones). To see what's relevant, use "udevinfo -a -p /sys/block/sdb".
|
Now we're talking!
Let me see what I can do from that command output. |
It worked, man!
Code:
SUBSYSTEMS=="usb", DRIVERS=="usb", ATTRS{idVendor}=="0492", ATTRS{idProduct}=="0140", ATTRS{serial}=="000000E5E5000", \ |
Yay, well done :D. I'm not sure why though, perhaps Kubuntu's udev config is different to Slackware's in that it doesn't allow using the ENV{*} keys (but I can't say for certain, because I don't know that much!). At least it works now!
|
I got it to mount/unmount automagically with this:
Code:
$ cat 82-meizu.rules Code:
/dev/meizu /media/meizu vfat defaults,uid=antoranz,gid=antoranz,utf8 0 0 |
All times are GMT -5. The time now is 04:33 PM. |