[SOLVED] Slackware and Android smartphone connectivity over USB cable.
SlackwareThis Forum is for the discussion of Slackware Linux.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Slackware and Android smartphone connectivity over USB cable.
I have a Slackware64-14.2 Linux having Internet access over a Wired 100MBs Ethernet cable. I also bought an Android phone today. The model is Redmi 9C NFC, but I didn't have time to go to an Mobile provider, It's just the phone. And the charger - a power supply with and USB socket + an USB-to-MicroUSB cable.
My problem is that I would like to provide internet access to the phone if possible. Over the USB cable. My restriction is I have no wireless devices at home and literally zero chances to get one until next year.
I've found something called Tethering in the phone, but as I understand, this is the opposite case to mine - when I would need to provide internet access from the phone to the desktop.
My question is: If I get the USB-to-microUSB cable, I plug the USB into the desktop that has internet over Ethernet and runs Slackware64-14.2, then the micro-USB in the smartphone, can I make the desktop share the connection to the smartphone? And what exactly should I do on Slackware? I'd be happy to read a tutorial and learn myself, then ask additional questions if I get any. After spending one hour of time earlier today trying to find such a tutorial online, and failing, I'm reaching you guys for help.
Hacks like rooting the phone myself are excluded, I'm asking if it's possible by exclusively doing some command line black magic on my Slackware desktop.
Not yet, but will be looking right now! Thank you for the quick response, sir, you're a life saver. I'm also very limited by time, but generally displaying impatience when asking such technical questions is considered rude, so I refrained from it. Going to read about that right now!
./gnirehtet start
2020-12-08 17:10:32.021 INFO Main: Checking gnirehtet client...
2020-12-08 17:10:32.023 ERROR Main: Execution error: Command adb ["shell", "dumpsys", "package", "com.genymobile.gnirehtet"] returned with value 1
but the dmesg after I plug the phone to the computer shows:
Code:
[ 9665.146069] usb 1-7: new high-speed USB device number 59 using xhci_hcd
[ 9665.310529] usb 1-7: New USB device found, idVendor=2717, idProduct=ff10
[ 9665.310532] usb 1-7: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 9665.310533] usb 1-7: Product: Redmi 9C NFC
[ 9665.310534] usb 1-7: Manufacturer: Xiaomi
[ 9665.310536] usb 1-7: SerialNumber: C6EY8PSG9XBMEIEU
[14254.673407] usb 1-7: USB disconnect, device number 59
[23023.245795] usb 1-8: new high-speed USB device number 60 using xhci_hcd
[23023.410374] usb 1-8: New USB device found, idVendor=2717, idProduct=ff40
[23023.410377] usb 1-8: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[23023.410379] usb 1-8: Product: Redmi 9C NFC
[23023.410380] usb 1-8: Manufacturer: Xiaomi
[23023.410381] usb 1-8: SerialNumber: C6EY8PSG9XBMEIEU
So the phone itself get recognized by Slackware as connected through USB
Any chance adb can-t find the phone because adb provided by SBo for Slackware64-14.2 is just too old?
And does anybody know if android-tools developers provide an official fresh AppImage? That would allow me to bypass SBo entirely to get a fresh running version on Slackware as soon as I download it.
And does anybody know if android-tools developers provide an official fresh AppImage? That would allow me to bypass SBo entirely to get a fresh running version on Slackware as soon as I download it.
There's a strong possibility your user doesn't have proper access to the device. Can you try running adb as root and see if you get a response there? If it works as root, then you'll want to get some udev rules set up for Android. The easiest way is to probably grab this rules file from this github repo and save it in /etc/udev/rules.d/ and then reload udev. You do need to make sure your normal user is in the plugdev group (which is done by default if you press the "up" button when creating a user with the adduser script).
Code:
wget https://github.com/snowdream/51-android/raw/master/51-android.rules
mv 51-android.rules to /etc/udev/rules.d/
udevadm control --reload-rules
Just to double check, you do need to enable "developer mode" on your device and then enable "USB Debugging" under Developer Options for adb to work.
Can you try running adb as root and see if you get a response there?
Yes I can. As I understand, this involves repeating the last process above from the "start adb" step. No need to get adb, I already have it locally. Then I run gnirehtet. If it works, it's a progress. If it still doesn't, I run adb devices -l as root and see what happens.
Quote:
Originally Posted by bassmadrigal
Just to double check, you do need to enable "developer mode" on your device and then enable "USB Debugging" under Developer Options for adb to work.
As I understand, this involves fiddling with the android device. So I can't do this, for now. This might become possible later, for now no need to focus on this. To give you an idea about my knowledge of the smartphone: think of an user who bought himself a computer.
He had 0 prior experience with computers. Computer came with OS basic programs preinstalled. THe user used the computer for 1 day only and learned:
1. To power it up and wait until the OS boots.
2. To click on the shortcut of a text processing program on the desktop.
3. To type text.
4. To save the document to be confident it's on the hard drive (he doesn't know where yet, if he wanted to copy it to a flash drive, he would need assistance of a more skilled user).
5. To power off the computer by mouse clicking somewhere.
By analogy, enabling "developer" mode, would be something like the computer user above trying to set a static IP address to an already configured Ethernet card, yet still too hard for him, this is already admin work.
I also don't know if enabling "developer mode" on the android device might somehow void it's warranty. And I'm not confident that when I'll be able to enable "developer mode", even if this thing itself wouldn't impact the warranty, I wouldn't accidentally make some other admin-related change on the smartphone that might still impact the warranty.
So, for now, my plan is to use your suggestion and try running adb as root. I will try to do this later today and I will report back the result.
I have found developer mode on my phone, but didn't enable it yet.
Quote:
Originally Posted by bassmadrigal
You do need to make sure your normal user is in the plugdev group (which is done by default if you press the "up" button when creating a user with the adduser script).
My regular user is in the plugdev group. IIRC this is also useful for accessing removable media like flash drives as regular user, but I might be wrong.
Quote:
Originally Posted by bassmadrigal
There's a strong possibility your user doesn't have proper access to the device. Can you try running adb as root and see if you get a response there? If it works as root, then you'll want to get some udev rules set up for Android. The easiest way is to probably grab this rules file from this github repo and save it in /etc/udev/rules.d/ and then reload udev.
Code:
wget https://github.com/snowdream/51-android/raw/master/51-android.rules
mv 51-android.rules to /etc/udev/rules.d/
udevadm control --reload-rules
I guess I can already try this now, since it happens on the computer.
After that I will need feedback on two things:
Answers to this:
adb needs developer mode to run. I know where developer mode is, but didn't enable it yet. I need to know if I enable developer mode later, just to help adb find my phone via adb devices -l, adb itself might do something that is something higher level developer stuff and void the warranty.
Last edited by FlinchX; 12-09-2020 at 03:38 AM.
Reason: removed info added by mistake
AFAIK no garanty void. You can easy revert the totale. Has nothing to do with rooting or whatever trip knox or involves flashing anything.
FYI adb as a debug tool is already a developper tool...
I have no wireless devices at home and literally zero chances to get one until next year.
I've never tried this, but as another option "in theory" if you have a wireless card/adapter it should be possible to share your "wired" internet connection through the wireless creating a ad-hoc "hot-spot"
I've never tried this, but as another option "in theory" if you have a wireless card/adapter it should be possible to share your "wired" internet connection through the wireless creating a ad-hoc "hot-spot"
Exactly.
My very first restriction is listed in the original post.
Enabling developer mode has no effect on the warranty and doesn't, by itself, cause any problems with the phone. Once developer mode is enabled, a new "developer options" menu will appear. There's a lot of options in there, and some may affect your phone, but they're well commented and easy to ignore what you don't want.
Don't worry about enabling developer mode. It's not nearly as scary as the Windows registry, where a slight misstep can break your OS.
When you enable USB debugging, it allows the device to listen for adb commands. If that is not enabled, adb will *never* see the device (it'd be like disabling the ssh server on your computer... you'd never be able to ssh into it without it running).
(I did state that "by itself", developer mode won't cause problems, however, once that's enabled, you're able to allow unlocking of your bootloader (if your device supports it), which may or may not affect your warranty. But to unlock modern bootloaders, you have to enable an option in developer options, then reboot the device into bootloader mode, issue the command to unlock it (using fastboot, which is slightly different than adb), and then confirm the unlocking of the bootloader by hitting a button on your phone... so it's hardly something you can do by accident.)
however, once that's enabled, you're able to allow unlocking of your bootloader (if your device supports it), which may or may not affect your warranty. But to unlock modern bootloaders, you have to enable an option in developer options, then reboot the device into bootloader mode, issue the command to unlock it (using fastboot, which is slightly different than adb), and then confirm the unlocking of the bootloader by hitting a button on your phone... so it's hardly something you can do by accident.)
None of these are my concerns now.
My concerns now are 3:
1. adb won't go into breaking warranty by doing things to the phone to detect it (now it doesn't, even as root), after I enable developer mode
2. I don't know the relationship between adb on my computer, gnirehtet and the smartphone
Does gnirehtet talk to the phone itself, or it uses adb on my computer , so adb talks to the computer (this is already for setting up networking to the phone, so it gets internet access to the wired internet over USB cable)
3. Once 2 is settled, whoever from adb and gnirehtet talks to the phone to set the IP address over the USB, if that guy does nothing that crosses past developer mode and there's no risk to void the warranty by going to hardware level like bootloader mentioned above.
Once I feel safe about all 3, I will be able to enable developer mode and repeat the previous step. First to make adb detect the phone, then to hook up the phone to the internet.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.