LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 12-08-2020, 07:02 AM   #1
FlinchX
Member
 
Registered: Nov 2017
Distribution: Slackware Linux
Posts: 666

Rep: Reputation: Disabled
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.
 
Old 12-08-2020, 08:40 AM   #2
Tonus
Senior Member
 
Registered: Jan 2007
Location: Paris, France
Distribution: Slackware-15.0
Posts: 1,407
Blog Entries: 3

Rep: Reputation: 514Reputation: 514Reputation: 514Reputation: 514Reputation: 514Reputation: 514
Did you already had a look at adb (Android-tools at slackbuilds.org) ?

Found that : https://android.stackexchange.com/qu...ering-over-usb

Last edited by Tonus; 12-08-2020 at 08:44 AM.
 
Old 12-08-2020, 08:48 AM   #3
FlinchX
Member
 
Registered: Nov 2017
Distribution: Slackware Linux
Posts: 666

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by Tonus View Post
Did you already had a look at adb (Android-tools at slackbuilds.org) ?

Found that : https://android.stackexchange.com/qu...ering-over-usb
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!
 
Old 12-08-2020, 09:54 AM   #4
FlinchX
Member
 
Registered: Nov 2017
Distribution: Slackware Linux
Posts: 666

Original Poster
Rep: Reputation: Disabled
The first problem occured here:

Code:
./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

Yet:

Code:
adb devices -l
List of devices attached
But according to https://zoneofmobile.com/product/redmi-9c-nfc/, the release date of the phone is July 07, 2020, while the last release of android-tools on SBo is like 3 years old.

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.
 
Old 12-08-2020, 11:02 AM   #5
FlinchX
Member
 
Registered: Nov 2017
Distribution: Slackware Linux
Posts: 666

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by FlinchX View Post
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.
According to https://www.androidauthority.com/goo...wnload-741582/, the lastest android-tools can be downloaded from here:

https://dl.google.com/android/reposi...test-linux.zip

If I replace the SBO android-tools with this, the problem persists. The only change is in the output of adb devices -l:

Code:
adb devices -l 
* daemon not running; starting now at tcp:5037
* daemon started successfully
List of devices attached
 
Old 12-08-2020, 03:16 PM   #6
bassmadrigal
LQ Guru
 
Registered: Nov 2003
Location: West Jordan, UT, USA
Distribution: Slackware
Posts: 8,792

Rep: Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656
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.
 
Old 12-08-2020, 11:49 PM   #7
FlinchX
Member
 
Registered: Nov 2017
Distribution: Slackware Linux
Posts: 666

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by bassmadrigal View Post
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 View Post
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.
 
Old 12-09-2020, 01:20 AM   #8
FlinchX
Member
 
Registered: Nov 2017
Distribution: Slackware Linux
Posts: 666

Original Poster
Rep: Reputation: Disabled
I've just run adb as root. No improvement.

So now it's up to me to teach myself about how to enable "developer mode" on the android phone and are there any warranty implications if I do this.

I will report back when I made some progress with this, or when I'll have a question about doing it (I want to try learning about it myself first).
 
Old 12-09-2020, 03:36 AM   #9
FlinchX
Member
 
Registered: Nov 2017
Distribution: Slackware Linux
Posts: 666

Original Poster
Rep: Reputation: Disabled
I have found developer mode on my phone, but didn't enable it yet.

Quote:
Originally Posted by bassmadrigal View Post
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 View Post
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
 
Old 12-09-2020, 06:06 AM   #10
Tonus
Senior Member
 
Registered: Jan 2007
Location: Paris, France
Distribution: Slackware-15.0
Posts: 1,407
Blog Entries: 3

Rep: Reputation: 514Reputation: 514Reputation: 514Reputation: 514Reputation: 514Reputation: 514
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...
 
Old 12-09-2020, 06:44 AM   #11
bitfuzzy
Member
 
Registered: Nov 2003
Location: NY
Distribution: slackware
Posts: 464

Rep: Reputation: 133Reputation: 133
Quote:
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"
 
Old 12-09-2020, 10:22 AM   #13
FlinchX
Member
 
Registered: Nov 2017
Distribution: Slackware Linux
Posts: 666

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by bitfuzzy View Post
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.
 
Old 12-09-2020, 10:43 AM   #14
bassmadrigal
LQ Guru
 
Registered: Nov 2003
Location: West Jordan, UT, USA
Distribution: Slackware
Posts: 8,792

Rep: Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656
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.)
 
Old 12-09-2020, 11:15 AM   #15
FlinchX
Member
 
Registered: Nov 2017
Distribution: Slackware Linux
Posts: 666

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by bassmadrigal View Post
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.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to install Google Play apps over a USB cable on an android phone that has its antenna removed Ulysses_ Linux - Mobile 5 05-10-2017 12:57 AM
LXer: Android Smartphone USB Tethering (Linux Mint 11) LXer Syndicated Linux News 0 10-03-2011 05:00 PM
Sharing Internet Connectivity via. USB cable sjmarshy Linux - Newbie 5 04-23-2009 03:36 PM
Smartphone + external DVD writer connectivity styrmis Linux - Hardware 2 09-15-2005 09:08 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 11:14 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration