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

Device always invalid on Ubuntu #42

Open
KthProg opened this issue May 23, 2018 · 23 comments
Open

Device always invalid on Ubuntu #42

KthProg opened this issue May 23, 2018 · 23 comments

Comments

@KthProg
Copy link

KthProg commented May 23, 2018

Here is the problem line.

Splitting on Environment.NewLine, or including "\r" would fix the issue. Ubuntu (and Linux in general) uses "\r" for newlines. Otherwise t gets one long string and fails to match the RegEx.

@KthProg
Copy link
Author

KthProg commented May 23, 2018

Here's the PR

@KthProg
Copy link
Author

KthProg commented May 23, 2018

I take it back, this might not quite be the issue. Let me investigate some more.

@camalot
Copy link
Owner

camalot commented May 23, 2018

So I am not understanding how this fixes it... it currently splits on \r\n or \n, Environment.NewLine should only be \n on linux, \r\n on windows.

@camalot
Copy link
Owner

camalot commented May 23, 2018

ok, now, i see your new message.

@KthProg
Copy link
Author

KthProg commented May 23, 2018

Yeah I'm apparently very wrong lol. It is having an error at the parsing stage (most likely when it splits) for some reason, but I'm not sure why yet (checking the regex shows that it does match the adb devices output).

@camalot
Copy link
Owner

camalot commented May 23, 2018

can you put the error that you are seeing in this issue

@KthProg
Copy link
Author

KthProg commented May 23, 2018

@KthProg
Copy link
Author

KthProg commented May 23, 2018

If it was splitting correctly, then the RegEx should be successful (I tested it against the output of adb devices)

@KthProg
Copy link
Author

KthProg commented May 23, 2018

There's an outside possibility that something different is being returned from adb than I'm seeing, but I can't imagine why that would be.

@camalot
Copy link
Owner

camalot commented May 23, 2018

can you post the value that is coming in in data. feel free to XXXX out any values if you want.

@KthProg
Copy link
Author

KthProg commented May 23, 2018

Lemme see. I'm running it through a test adapter so I'll have to create a new project to call it directly.

@KthProg
Copy link
Author

KthProg commented May 23, 2018

It doesn't look like I can debug that code from the package. I can pull down the code locally and try that. I don't know if it will build though since it isn't .NET Core.

@KthProg
Copy link
Author

KthProg commented May 23, 2018

Yeah I can't build it outside of a .NET Core project. So there's no way for me to tell really. Is there any way you could push up a NuGet with some logging?

@KthProg
Copy link
Author

KthProg commented May 24, 2018

Hello. Did you get a chance to look at this? I don't have any way of figuring out what the input was.

@KthProg
Copy link
Author

KthProg commented May 25, 2018

Hey. Just following up. Any chance to look into this?

@gamesguru
Copy link

no permissions

This is due to adb not being started with elevated permissions. I don't know if ManagedAdb automatiaclly runs the kill-server and start-server commands at some point. (I hope not?)

But if not, starting adb with sudo privileges at boot-time would resolve this issue. If so, the library should at least throw a warning that it tried to start adb in elevated mode but a password was requested.

adb kill-server
sudo `which adb` start-server

You can make an entry in the ect/sudoers.d folder to skip the password requirement for sudo adb. You should refactor your project into a more debuggable form for situations like this.
This is the easiest solution assuming you aren't in a non-sudo Linux system, like Fedora.

Other approach is to add yourself to plugdev group and put adb executable under non-root owner.

sudo usermod -aG plugdev kthprog
sudo chown kthprog `which adb`
sudo chgrp kthprog `which adb`
sudo chmod 775 `which adb`

@KthProg
Copy link
Author

KthProg commented May 26, 2018

Weird. It works fine when I run adb myself. I don't think adb is being run under my account. I'll sort through the code and figure out what it's running under.

@gamesguru
Copy link

gamesguru commented May 26, 2018

if you run adb yourself with the devices you have at work attached, i expect some will return 'no permission'

looks like there are 5 references to either Stop() or Restart() in AndroidDebugBridge.cs

what's curious is StartServer() is a totally empty method. I had had this problem with the library in the past, on Tony's app, that it wouldn't start a server but depended on one running already. So i had to ALWAYS start it from command prompt. Pretty stupid really

Assuming it does issue the kill server command, the best option is probably a simple python script running in the background which constantly checks for devices with 'no permissions' and restarts the server with sudo priviledges if this ever happens. You can put the python script in your startup commands on Ubuntu.

@KthProg
Copy link
Author

KthProg commented May 29, 2018

Initially I thought it might be best to fix this issue in the library itself under a new fork, but you're right, it's probably best to just put a nice little script on the Linux box.

@KthProg
Copy link
Author

KthProg commented Oct 26, 2018

I'm getting this error again now on Windows. Even though the list comes up fine in cmd

@gamesguru
Copy link

that's because no one has pushed a commit to this repo in 3 years. Anyone who would use it for Android 9 is a fool

make your own wrapper and you will be thankful

@KthProg
Copy link
Author

KthProg commented Oct 26, 2018

Lmao sup Shane. Didn't know it was that out of date. Seems too buggy to keep using

@gamesguru
Copy link

it's also possible no commits have been pushed because it is already perfect. you should ask the maker directly what's up @camalot

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

No branches or pull requests

3 participants