Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Wed 23 Jul 2014, 14:11
All times are UTC - 4
 Forum index » Advanced Topics » Additional Software (PETs, n' stuff) » System
A small tool for when hardware is not recognized...
Post new topic   Reply to topic View previous topic :: View next topic
Page 1 of 1 [10 Posts]  
Author Message
Ibidem

Joined: 25 May 2010
Posts: 463
Location: State of Jefferson

PostPosted: Thu 22 May 2014, 00:22    Post subject:  A small tool for when hardware is not recognized...  

Here's a little tool to make the kernel check for PCI devices and partitions.
Rechecking PCI devices is equivalent to
Code:
echo "1" >/sys/bus/pci/rescan


Usage is "hwrs -p" for PCI rescan,
"hwrs -b" for checking for partitions; "hwrs" and "hwrs -bp" trigger both.
This probably seems silly; it's intended to be a suid tool for multiuser systems.
(Long explanation: I have an Acer Aspire One where PCI hotplug doesn't work OOB, the wireless flakes out if PCI hotplug is enabled, and both SD card readers are powered off until a card is inserted--meaning that they require PCI hotplug or a rescan.
Also, I run into problems with removable devices not getting partitions enumerated until I try mounting them or something like that; this throws off setting up /etc/fstab for user mount.
I didn't want to login as root every time I plugged in an SD card, so I needed some sort of suid helper, which meant writing it in C...)

It's written as a "toy" for toybox (the equivalent of an "applet" in busybox). To build it, get a recent version of the toybox source, then drop hwrs.c in toys/pending/ and type
Code:
CFLAGS="-Os -static" scripts/single.sh hwrs

(You can also set CC, CROSS_COMPILE, or several other variables the same way.)
This build is linked statically with a fairly current musl and sstrip'ed.
hwrs.c.gz
Description  The gzipped source (see above for explanation of building it)
gz

 Download 
Filename  hwrs.c.gz 
Filesize  519 Bytes 
Downloaded  29 Time(s) 
hwrs.tar.gz
Description  A tarball for the sake of perms/owner.
gz

 Download 
Filename  hwrs.tar.gz 
Filesize  18.54 KB 
Downloaded  27 Time(s) 
Back to top
View user's profile Send private message 
starhawk

Joined: 22 Nov 2010
Posts: 2755
Location: Everybody knows this is nowhere...

PostPosted: Thu 22 May 2014, 00:36    Post subject:  

I'd love to see this for USB. I have this USB to parallel port dongle that uses a weird Chinese chip, and I'd love to know whether there's just no driver for it, or if the reason it's not being picked up is kernel stubbornness...
_________________
Loving X-Slacko 1.1! Get the PetGet patch on pg8; it's important.
Next system will be an HP MOCA-AR + Core2Duo in an innovative case... if I ever get off my butt and build it Razz
Back to top
View user's profile Send private message 
Ted Dog


Joined: 13 Sep 2005
Posts: 2290
Location: Heart of Texas

PostPosted: Thu 22 May 2014, 02:46    Post subject:  

what hardware is your acer one. I have had wierd issues with stuff plugged in and not being seen until a different event. mine came with some sad software called win8. Wink
Back to top
View user's profile Send private message 
Ibidem

Joined: 25 May 2010
Posts: 463
Location: State of Jefferson

PostPosted: Thu 22 May 2014, 18:15    Post subject:  

@starhawk, as far as I know USB devices are always detected via hotplug; there's no rescan file in sysfs.
"If I were troubleshooting it," Wink
I'd do something like this:
Code:
lsusb -v >usb.old
#plug it in, wait a moment
dmesg |tail
lsusb -v >usb.new
diff -U 0 usb.old usb.new

If it's "live", it will show up with a "+" before it in the output of diff; if it isn't, forget trying to get it working.
The next step would be to look in /sys/bus/usb/devices/*/id* for the vendor and product id, cd to the directory that matches, and look at
(1) the contents of "modalias" and "uevent", and (2) the driver, if any (basename `readlink -f driver`)

Speaking of modalias, I'll have to post resolve_modalias...

@Ted Dog: Acer Aspire One AOA150-1786 aka ZG5.
CPU is Intel Atom N270 (hyperthreading single-core).
Back to top
View user's profile Send private message 
Ibidem

Joined: 25 May 2010
Posts: 463
Location: State of Jefferson

PostPosted: Thu 22 May 2014, 18:34    Post subject: resolve modalias to module name  

resolve_modalias will convert a series of module aliases to module names.
Example (how to view all modules that could be used for all USB devices your computer recognizes):
Code:
cat /sys/bus/usb/devices/*/modalias|xargs ./resolve_modalias


Source is used the same as for hwrs.
resolve_modalias.gz
Description  Compressed binnary.
gz

 Download 
Filename  resolve_modalias.gz 
Filesize  6.07 KB 
Downloaded  22 Time(s) 
resolve_modalias.c.gz
Description  Source code
gz

 Download 
Filename  resolve_modalias.c.gz 
Filesize  929 Bytes 
Downloaded  22 Time(s) 
Back to top
View user's profile Send private message 
starhawk

Joined: 22 Nov 2010
Posts: 2755
Location: Everybody knows this is nowhere...

PostPosted: Thu 22 May 2014, 19:20    Post subject:  

@Ibidem -- then it's not got a driver in Puppy. It's a weird chip -- usually these are PL2305 chips inside these dongles, but this one is a QinHeng Electronics CH340. What little I can find on it, indicates that it can be configured as USB->RS-232 (COMport serial), USB->IEEE-1284 (LPTport parallel), or USB->I2C (I2C is a very standard serial protocol, sometimes referred to as the Two Wire Interface because that's the number of signal wires it uses... clock, data, and ground.)

Mine is of course configured as IEEE1284 (LPTport parallel). I can find a driver for it that implements the COMport functionality, but that really doesn't help me here... particularly because it ONLY implements the COMport functionality, with no support for either of the other two protocols at all. That (useless to me) driver has source code here --> http://lxr.free-electrons.com/source/drivers/usb/serial/ch341.c

_________________
Loving X-Slacko 1.1! Get the PetGet patch on pg8; it's important.
Next system will be an HP MOCA-AR + Core2Duo in an innovative case... if I ever get off my butt and build it Razz
Back to top
View user's profile Send private message 
Ted Dog


Joined: 13 Sep 2005
Posts: 2290
Location: Heart of Texas

PostPosted: Thu 22 May 2014, 20:06    Post subject:  

Ibidem wrote:
@starhawk, as far as I know USB devices are always detected via hotplug; there's no rescan file in sysfs.
"If I were troubleshooting it," Wink
I'd do something like this:
Code:
lsusb -v >usb.old
#plug it in, wait a moment
dmesg |tail
lsusb -v >usb.new
diff -U 0 usb.old usb.new

If it's "live", it will show up with a "+" before it in the output of diff; if it isn't, forget trying to get it working.
The next step would be to look in /sys/bus/usb/devices/*/id* for the vendor and product id, cd to the directory that matches, and look at
(1) the contents of "modalias" and "uevent", and (2) the driver, if any (basename `readlink -f driver`)

Speaking of modalias, I'll have to post resolve_modalias...

@Ted Dog: Acer Aspire One AOA150-1786 aka ZG5.
CPU is Intel Atom N270 (hyperthreading single-core).


we have same..
Back to top
View user's profile Send private message 
Ibidem

Joined: 25 May 2010
Posts: 463
Location: State of Jefferson

PostPosted: Thu 22 May 2014, 21:20    Post subject:  

@Ted Dog: Not quite the same, I suspect. I doubt that a new Win8 machine came with an Atom N270.
Mine came with XP on a 160gb 5400RPM HDD, Atheros "AR5BXB63"/AR5007(some nonsense I forget...) a/b/g wireless, RTL8102E 10/100 ethernet, and 1 gig of DDR2 ram.
AFAICT, the GPU (945GM) is incapable of OGL 3.x or DirectX 10+.

@starhawk: sounds like junk.
Allegedly, back in 2008 usblp could get some portion of a print job across that gadget/chip, with some mutilation and an eventual crash.
The author of the CH341 serial driver is still in business (Kingswood Consulting), FYI.
Back to top
View user's profile Send private message 
Ted Dog


Joined: 13 Sep 2005
Posts: 2290
Location: Heart of Texas

PostPosted: Thu 22 May 2014, 22:07    Post subject:  

I have three.. win xp win 7 and win 8. different acer one models.. Laughing sorry I have trouble with all three. the xp sdcards are tricky. Mom stole or permanental borrowed my win7 model. and my win 8 is full of little gotchas mostly 9f microsoft doing including boot from usb and disabled hardware stuff.. oh and the usb3 dropping power and usb unmounting under fatdog. Rolling Eyes
I just started to play with older 2008 xp model after just missing the one time only trade in by a week. Had to charge it up.
Back to top
View user's profile Send private message 
Ibidem

Joined: 25 May 2010
Posts: 463
Location: State of Jefferson

PostPosted: Thu 22 May 2014, 22:18    Post subject:  

Ted Dog wrote:
I have three.. win xp win 7 and win 8. different acer one models.. Laughing sorry I have trouble with all three. the xp sdcards are tricky. Mom stole or permanental borrowed my win7 model. and my win 8 is full of little gotchas mostly 9f microsoft doing including boot from usb and disabled hardware stuff.. oh and the usb3 dropping power and usb unmounting under fatdog. Rolling Eyes
I just started to play with older 2008 xp model after just missing the one time only trade in by a week. Had to charge it up.

Well, the sd cards in the xp one are what hwrs was written for.
I haven't bought a new computer since a while after Win7 came out (Thinkpad X100e), and I'm hoping to find a decently priced MIPS laptop come time for the next procurement, which may be several years away. (I'm thinking MIPS because it cannot run Windows.)
Although a build-it-yourself Snapdragon S5+ or Seattle system does sound somewhat fun. Seattle is AMD's ARM64 Opteron.
Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 1 of 1 [10 Posts]  
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » Advanced Topics » Additional Software (PETs, n' stuff) » System
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.0763s ][ Queries: 12 (0.0062s) ][ GZIP on ]