When we put our device to fastboot mode for flashing our binaries using fastboot command, while trying to check if device is connect or not using “fastboot devices” command, we got below error,
$ fastboot devices
no permissions (missing udev rules? user is in the plugdev group); see [http://developer.android.com/tools/device.html] fastboot
We could always use “sudo fastboot devices” but this is not good idea, when we are using fastboot in some automated tools or trying to flashing binaries to bash script, so we had to resolve this issue.
Solution :
Once the device enters to fastboot mode, check what is the output of lsusb,
$ lsusb
Bus 001 Device 014: ID xxxx:yyyy Company Inc (fastboot)
As we can see the devices is connected over USB in fastboot mode, but actual fastboot command is not detecting this mode as a normal user.
Now, we need to update the udev rules,
$ sudo vim /etc/udev/rules.d/51-android.rules
update it with idvendor and idproduct values as we seen in “lsusb” command,
SUBSYSTEM=="usb", ATTR{idVendor}=="xxxx", ATTR{idProduct}=="yyyy", MODE="0666", GROUP="plugdev"
Now, if we check, it still shown the fastboot devices as “no permissions” but it also shown the “usb:1-1” as at the end.
$ fastboot -l devices
no permissions (missing udev rules? user is in the plugdev group); see [http://developer.android.com/tools/device.html] fastboot
usb:1-1
make sure to restart udev service as,
$ sudo service udev restart
Now remove the USB cable of device from the Laptop/Desktop and connect it back, and if you check, we will not see permissions error.
$ fastboot -l devices
1234567890 fastboot
usb:1-1