Giter Site home page Giter Site logo

Comments (6)

jgottula avatar jgottula commented on August 25, 2024 3

The lines that udev is complaining about look to me like no-op lines that were meant to effectively just serve as comments.

#	Sony Ericsson
ATTR{idVendor}!="0fce", GOTO="not_Sony_Ericsson"
ENV{adb_user}="yes"
#		Xperia X10 mini
ATTR{idProduct}=="3137"
ATTR{idProduct}=="2137", SYMLINK+="android_adb"
#		Xperia X10 mini pro
ATTR{idProduct}=="3138"
ATTR{idProduct}=="2138", SYMLINK+="android_adb"
#		Xperia X8
ATTR{idProduct}=="3149"
ATTR{idProduct}=="2149", SYMLINK+="android_adb"
#		Xperia X12
ATTR{idProduct}=="e14f"
ATTR{idProduct}=="614f", SYMLINK+="android_adb"

This snippet is a good example. What's happening here is that the author of this portion of the file has decided to document both the normal and debug mode USB product ID's for each of these devices. But then they only actually do anything to the latter type. (So, in effect, the function of the non-debug-mode PID lines, e.g. ATTR{idProduct}=="3137", is simply to say "3137 is the PID the X10 mini would have when NOT in debug mode", and to then explicitly show that nothing should be done in that case, as a contrast to PID 2137.)

Prior to systemd/udev v243, these lines would just silently be ignored. But in v243 (which, not coincidentally, was released on Sep 3 2019), a warning was added for cases where a line in a udev rules file has at least one syntactically valid match key, but then lacks any assignment/action keys that would do anything based on the matches.

So, as of udev v243 and later, this weird quirky pseudo-comment syntax used multiple times in this file is no longer a valid thing and generates annoying warnings.

There are a few ways the rules file could be modified to fix this and get rid of the warnings:

  1. (Best) Rather than having rule lines that match but then do nothing, just use the comment syntax to document what the non-debug USB PID is for each device instead. There is literally no point to a rule that matches a USB PID and then takes no actions based on that match.
  2. (Dumb) Make these lines technically correct by adding a GOTO after the matching part. (Probably to android_usb_rule_match, I would assume?) This approach works because doing a GOTO is technically an action. It's a pretty stupid fix though.
  3. (Dumb) Make these lines technically correct by having them define an unused LABEL after the matching part. This approach works because defining a LABEL is technically an action. As with the previous idea, this one is also stupid.

This is mainly due to the weird setup here with the conditionals. As per specification udev rules are not meant to be dynamic. What's being done here with the conditionals and then if checks makes it more readable, but is inherently out of spec imo. This will be resolved if all rules include both idVendor and idProduct checks instead of checking once per vendor.

Nah, the LABEL/GOTO stuff is technically fine, really; it arguably does make things more readable. The problem here has strictly to do with rules that match but don't act; those are certainly out of spec.

from android-udev-rules.

meganukebmp avatar meganukebmp commented on August 25, 2024 1

This is mainly due to the weird setup here with the conditionals. As per specification udev rules are not meant to be dynamic. What's being done here with the conditionals and then if checks makes it more readable, but is inherently out of spec imo. This will be resolved if all rules include both idVendor and idProduct checks instead of checking once per vendor.

from android-udev-rules.

ilf avatar ilf commented on August 25, 2024

There are a few ways the rules file could be modified to fix this and get rid of the warnings:

I would love to see this fixed. (It's pretty annoying in the systemd journal.)

from android-udev-rules.

ilf avatar ilf commented on August 25, 2024

Here are my error messages:

systemd-udevd[PID]: /usr/lib/udev/rules.d/51-android.rules:89 The line takes no effect, ignoring.
systemd-udevd[PID]: /usr/lib/udev/rules.d/51-android.rules:226 The line takes no effect, ignoring.
systemd-udevd[PID]: /usr/lib/udev/rules.d/51-android.rules:237 The line takes no effect, ignoring.
systemd-udevd[PID]: /usr/lib/udev/rules.d/51-android.rules:319 The line takes no effect, ignoring.
systemd-udevd[PID]: /usr/lib/udev/rules.d/51-android.rules:367 The line takes no effect, ignoring.
systemd-udevd[PID]: /usr/lib/udev/rules.d/51-android.rules:369 The line takes no effect, ignoring.
systemd-udevd[PID]: /usr/lib/udev/rules.d/51-android.rules:371 The line takes no effect, ignoring.
systemd-udevd[PID]: /usr/lib/udev/rules.d/51-android.rules:540 The line takes no effect, ignoring.
systemd-udevd[PID]: /usr/lib/udev/rules.d/51-android.rules:543 The line takes no effect, ignoring.
systemd-udevd[PID]: /usr/lib/udev/rules.d/51-android.rules:546 The line takes no effect, ignoring.
systemd-udevd[PID]: /usr/lib/udev/rules.d/51-android.rules:549 The line takes no effect, ignoring.

This is my file: 51-android.rules

So the problematic lines are:

89: ATTR{idProduct}=="7030"
226: ATTR{idProduct}=="0c93"
237: ATTR{idProduct}=="0c01"
319: ATTR{idProduct}=="618f"
367: ATTR{idProduct}=="2d66"
369: ATTR{idProduct}=="428c"
371: ATTR{idProduct}=="41db"
540: ATTR{idProduct}=="3137"
543: ATTR{idProduct}=="3138"
546: ATTR{idProduct}=="3149"
549: ATTR{idProduct}=="e14f"

from android-udev-rules.

ilf avatar ilf commented on August 25, 2024

Closed with commit 8a21289 and released with 20200410. Thanks!

from android-udev-rules.

M0Rf30 avatar M0Rf30 commented on August 25, 2024

Thanks for your cooperation :D

from android-udev-rules.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.