Skip to content

feat: Add adb rule for Lenovo Legion Tab Y700#360

Open
Ylarod wants to merge 1 commit intoM0Rf30:mainfrom
Ylarod:main
Open

feat: Add adb rule for Lenovo Legion Tab Y700#360
Ylarod wants to merge 1 commit intoM0Rf30:mainfrom
Ylarod:main

Conversation

@Ylarod
Copy link
Copy Markdown

@Ylarod Ylarod commented Mar 29, 2026

No description provided.

@Ylarod Ylarod force-pushed the main branch 2 times, most recently from 2df3ece to b38bb1c Compare March 29, 2026 04:38
@JoesCat
Copy link
Copy Markdown
Collaborator

JoesCat commented Mar 29, 2026

Hi @Ylarod, looking at your code here, I believe it would be advantageous to also add another PR with libmtp into file src/music-player.h.
You already have "7f41" for "adbmtp" and "7f45" for "adbptp" covered here for android rules, but for libmtp, you also should get the other values when developer-mode==off as well.
so you might probably be looking at a PR something like:

/* https://github.com/M0Rf30/android-udev-rules/pull/360 */
  { "Lenovo", 0x17ef, "Legion Tab Y700 (ADB+MTP)", 0x7f41,
      DEVICE_FLAGS_ANDROID_BUGS },
/* https://github.com/M0Rf30/android-udev-rules/pull/360 */
  { "Lenovo", 0x17ef, "Legion Tab Y700 (ADB+PTP)", 0x7f45,
      DEVICE_FLAGS_ANDROID_BUGS },
/* https://github.com/M0Rf30/android-udev-rules/pull/360 */
  { "Lenovo", 0x17ef, "Legion Tab Y700 (MTP)", 0xsome-value,
      DEVICE_FLAGS_ANDROID_BUGS },
/* https://github.com/M0Rf30/android-udev-rules/pull/360 */
  { "Lenovo", 0x17ef, "Legion Tab Y700 (PTP)", 0xsome-value,
      DEVICE_FLAGS_ANDROID_BUGS },

You can maybe use this as a template for reference: libmtp/libmtp#294

@JoesCat
Copy link
Copy Markdown
Collaborator

JoesCat commented Mar 30, 2026

Thank you for your extra effort in sending libmtp a PR, very much appreciated.

...and the extra codes you included here will be of benefit for distros running libmtp<=1.1.23

@M0Rf30 M0Rf30 requested a review from JoesCat March 31, 2026 15:43
@JoesCat
Copy link
Copy Markdown
Collaborator

JoesCat commented Mar 31, 2026

Overall, I think this is a pretty detailed pull request and if you want to merge, go ahead.
For myself if you want some opinions, I would have opted to go for more compression at the expense of comments because we're working with a text script and not compiled binaries...scripts are slow as you got to parse and lookup, so if there's less to parse, the quicker it can run....compiled code, comment a lot is best, and it gets stripped-out building a binary, so you got your speed......so it would look more like this:

#   Lenovo Legion Tab Y700 (7f3d=adb 7f40=mtp 7f41=mtp,adb 7f44=ptp 7f45=ptp,adb 7f4a=midi 7f4b=midi,adb)
ATTR{idProduct}=="7f3d", GOTO="adb"
ATTR{idProduct}=="7f40", GOTO="mtp"
ATTR{idProduct}=="7f41", GOTO="adbmtp"
ATTR{idProduct}=="7f44", GOTO="ptp"
ATTR{idProduct}=="7f45", GOTO="adbptp"
ATTR{idProduct}=="7f4a", GOTO="midi"
ATTR{idProduct}=="7f4b", GOTO="adbmidi"

basically, the code reduces down to one comment, so the script parse searches for EOL, and finished comment, then goes to the actual instructions (this is about as quick as a parser can go, or hope it will go). ;-p

The qualcom section needs some R&D work as it's got duplicates like 9011, but for now, @Ylarod has this part well documented, and that's best for now leaving it as-is in the qualcom portion.

I'm okay with the code as-is, it is detailed and covers plenty, but I'm guessing it would be preferred in the format I mentioned above (since @M0Rf30 asked for a review, so yes, if you can make that extra change, please do).

@Ylarod - if you want to go the extra effort, run 'lsusb -v' as you switch between modes, sometimes you'll see extra codes that can be added, you can see these lines as examples (where cdc and adbcdc were hiding with mtp and adbmtp):

371 #   One (0dea=mtp,ums,adb 0f87=mtp,?,adb 0f5f=mtp,cdc,adb 0f60=mtp,cdc 0f63=mtp,adb 0f64=mtp)
374 ATTR{idProduct}=="0f5f", ENV{adb_adbcdc}="yes", GOTO="adbmtp"
375 ATTR{idProduct}=="0f60", ENV{adb_cdc}="yes", GOTO="mtp"

# Xiaomi A1 (90bb=midi,adb)
ATTR{idProduct}=="90bb", GOTO="adbmidi"
ATTR{idProduct}=="90dc", GOTO="adb"
# Lenovo Legion Tab Y700 / FP3 USB tethering mode (ADB disabled)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

leave this section pretty much as-is, this qualcom section needs some R&D and compression (someday), so all the info you have here is great

ATTR{idVendor}!="17ef", GOTO="not_Lenovo"
# Lenovo Tab K10
ATTR{idProduct}=="201c", GOTO="adb"
# Lenovo Legion Tab Y700 ADB / non-data-transfer mode
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Seems okay, got plenty of codes covered here (especially the main ones). Can leave this as-is, or opt for some scripting compression mentioned in comments.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants