Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

android-udev-rules: use proper path for udev/rules.d #31705

Closed
wants to merge 1 commit into from

Conversation

lebel
Copy link

@lebel lebel commented Nov 15, 2017

Motivation for this change

The file 51-android.rules don't appear properly in /etc/udev/rules.d

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option build-use-sandbox in nix.conf on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nox --run "nox-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Fits CONTRIBUTING.md.

@Mic92
Copy link
Member

Mic92 commented Nov 15, 2017

Both directories are equivalent: https://github.com/NixOS/nixpkgs/blob/master/nixos/modules/services/hardware/udev.nix#L51

The rule file is also loaded without this patch:

$ realpath /etc/udev/rules.d/51-android.rules
/nix/store/y6i6avdxlzqv1d5ajb4a3911ci282ld4-udev-rules/51-android.rules

@lebel
Copy link
Author

lebel commented Nov 15, 2017

I don't see /etc/udev/rules.d/51-android.rules on my machine and adb doesn't work without root, that's my point. Maybe it is something I forgot to do in configuration.nix.

@jtojnar
Copy link
Contributor

jtojnar commented Nov 15, 2017

You need to add pkgs.android-udev-rules to services.udev.packages. Or better, use programs.adb.enable, which does it for you.

config = mkIf config.programs.adb.enable {
services.udev.packages = [ pkgs.android-udev-rules ];
environment.systemPackages = [ pkgs.androidenv.platformTools ];
users.extraGroups.adbusers = {};
};

@lebel
Copy link
Author

lebel commented Nov 15, 2017

Thanks @jtojnar, I do now see the file in /etc/udev/rules.d, and with my user part of adbusers group, I still can't adb shell to my phone.

@jtojnar
Copy link
Contributor

jtojnar commented Nov 15, 2017

It works for me fine even without adding myself to the group. Are you sure you have USB debugging enabled on the phone?

@lebel
Copy link
Author

lebel commented Nov 15, 2017

I does work with other Linux distros that uses the same rules file.

I get the following when I try to adb shell:

[12:27] lebeld@tardis:~
➤ adb kill-server 

[12:27] lebeld@tardis:~
➤ adb shell  
* daemon not running. starting it now at tcp:5037 *
* daemon started successfully *
error: insufficient permissions for device.
See [http://developer.android.com/tools/device.html] for more information.

[12:27] lebeld@tardis:~
➤       

NEVERMIND

I made sure to select Transfer files in the telephone menu, which transformed my phone from a fastboot device to a OnePlus 5 phone and after that I was able to adb shell into it as a user.

@jtojnar
Copy link
Contributor

jtojnar commented Nov 15, 2017

This can be closed then.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants