Skip to content

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

Merged
M0Rf30 merged 1 commit into
M0Rf30:mainfrom
Ylarod:main
Apr 23, 2026
Merged

feat: Add adb rule for Lenovo Legion Tab Y700#360
M0Rf30 merged 1 commit into
M0Rf30:mainfrom
Ylarod:main

Conversation

@Ylarod

@Ylarod Ylarod commented Mar 29, 2026

Copy link
Copy Markdown
Contributor

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

JoesCat commented Mar 29, 2026

Copy link
Copy Markdown
Collaborator

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

JoesCat commented Mar 30, 2026

Copy link
Copy Markdown
Collaborator

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

JoesCat commented Mar 31, 2026

Copy link
Copy Markdown
Collaborator

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"

Comment thread 51-android.rules
Comment thread 51-android.rules
@M0Rf30
M0Rf30 self-requested a review April 23, 2026 15:51
@M0Rf30
M0Rf30 merged commit 5e7cef3 into M0Rf30:main Apr 23, 2026
1 check passed
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.

3 participants