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

Add Motorola G3, edit some other Motorola values #277

Merged
merged 1 commit into from
Aug 26, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 12 additions & 15 deletions 51-android.rules
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,7 @@ ATTR{idVendor}!="18d1", GOTO="not_Google"
# PinePhone (v1.2) (4ee0=fast 4ee1=mtp, 4ee2=mtp,adb 4ee3=rndis 4ee4=rndis,adb 4ee5=ptp, 4ee6=ptp,adb 4ee7=adb)
# Yandex Phone 4ee7=debug
# Fairphone3 (4ee1=mtp)
# Motorola G3 (2d02=audio 2d03=audio,adb 4ee8=midi 4ee9=midi,adb)
ATTR{idProduct}=="4ee0", GOTO="adbfast"
ATTR{idProduct}=="4ee2", GOTO="adb"
ATTR{idProduct}=="4ee4", GOTO="adb"
Expand All @@ -215,7 +216,7 @@ ATTR{idProduct}=="5208", GOTO="adb"

ATTR{idProduct}=="2d00", GOTO="adb"
ATTR{idProduct}=="2d01", GOTO="adb"
ATTR{idProduct}=="2d03", GOTO="adb"
ATTR{idProduct}=="2d03", GOTO="adbaud"
ATTR{idProduct}=="2d05", GOTO="adb"
# Nexus 7
ATTR{idProduct}=="4e42", GOTO="adb"
Expand Down Expand Up @@ -458,31 +459,27 @@ ATTR{idProduct}=="2d66", SYMLINK+="android_adb"
ATTR{idProduct}=="428c", SYMLINK+="android_adb"
# Droid
ATTR{idProduct}=="41db", SYMLINK+="android_adb"
# Xoom ID 1
ATTR{idProduct}=="70a8", GOTO="adbfast"
# Xoom ID 2
ATTR{idProduct}=="70a9", GOTO="adbfast"
# Xoom (70a8=mtp 70a9=mtp,adb)
ATTR{idProduct}=="70a8", GOTO="mtp"
ATTR{idProduct}=="70a9", GOTO="adbmtp"
# XT890/907/Razr (710d=mtp 710e=mtp,adb)
ATTR{idProduct}=="710e", GOTO="adbmtp"
# Razr XT912
ATTR{idProduct}=="4362", GOTO="adbfast"
# Moto XT1052
#ATTR{idProduct}=="2e83", GOTO="adbfast"
# Moto E/G
#ATTR{idProduct}=="2e76", GOTO="adbfast"
# Moto E/G (Dual SIM)
#ATTR{idProduct}=="2e80", GOTO="adbfast"
# Moto E/G (Global GSM)
#ATTR{idProduct}=="2e82", GOTO="adbfast"
# Moto x4
#ATTR{idProduct}=="2e81", GOTO="adbfast"
# Droid Turbo 2
ATTR{idProduct}=="2ea4", GOTO="adbfast"
# Atrix/Razr HD (2e32=mtp 2e33=mtp,adb)
# Razr M (2e50=mtp 2e51=mtp,adb)
# Moto G3 (2e76=mtp,adb 2e81=charge,adb 2e82=mtp 2e83=ptp 2e84=ptp,adb 2e24=rndis 2e25=rndis,adb)
# Moto Z3 Play, beckham, XT1929
# For details see: <https://github.com/M0Rf30/android-udev-rules/issues/264>
# 18d1:4ee8=midi; 18d1:4ee9=midi+adb
# BP TOOLS: 2ee5=charging, mtp, ptp; 2ee6=charging+adb, mtp+adb, ptp+adb; 2ee7=rndis; 2ee8=rndis+adb; 18d1:4ee8=midi; 18d1:4ee9=midi+adb
# QCOM: 05c6:9091=charing+adb, mtp+adb, ptp+adb; 05c6:9092=charging, mtp, ptp; 18d1:4ee8=midi; 18d1:4ee9=midi+adb; 22b8:2e24=rndis; 22b8:2e25=rndis+adb
ATTR{idProduct}=="2e24", GOTO="rndis"
ATTR{idProduct}=="2e25", GOTO="adbrndis"
ATTR{idProduct}=="2e33", GOTO="adbmtp"
ATTR{idProduct}=="2e51", GOTO="adbmtp"
Copy link
Contributor

@mskiptr mskiptr Aug 23, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure that's feasible but could we try to keep individual devices separated? Ideally each device would be in its own section that fully describes what usb ids (and in which modes) it can show up as.

Of course since manufacturers do use the same IDs for different devices, we will have to somehow accommodate that, so here's an idea:

For Moto Z3 Play and Galaxy A4 (2016) tried keeping the following format:

#   <device name>, <codename>, <model #>
#     <any additional information, like links to a full investigation>
#     <ids that already appear elsewhere or that we can't yet reasonably use in code>
#     <weird case>: <ids that appear there>
<rule0>
<rule1> # also <another mode that features the same id, but we don't have a way to express in code or distinguish it>
<rule2> # <explanation if the rule doesn't exactly match the mode the device is in>

The first two lines are pretty self-explanatory.

The next two lines are in this format:

<pid0>=<mode1>+<mode2>, <mode3>; <vid>:<pid1>=<mode4>

where pluses mean multiple modes apply at the same time, commas mean several different modes (or mode combinations) give the same vid:pid pair and semicolons separate unrelated cases (where vid:pid was different).

Finally there are the actual rules.

  • If there's exactly one mode combination that yields this id, there's no need for further comments.
  • If there are several cases that yield this id, the rule should specify the most general one and all the others should be listed in the comment that follows. (like for 22b8:2e8{1,2})
  • If there are several cases that yield this id, but nothing really fits we should do something reasonable and explain what it really means in the comment. (like 22b8:2eb7 or 04e8:6860)

So, what to do when there's already a rule for a given id but as part of a different device? I think we should just leave it there and specify this case in the comment. I tried to do that for the modes that use ids from Google: 18d1:2d0{2,3} and 18d1:4ee{8,9}. If it becomes clear that an ID is consistent across many devices, we can move it out of the first one into some vendor-wide section (and in return put a comment in the device-specific section).

ATTR{idProduct}=="2e76", GOTO="adbmtp"
ATTR{idProduct}=="2e80", GOTO="fast"
ATTR{idProduct}=="2e81", GOTO="adb" # also sideload
Expand Down