9front - general discussion about 9front
 help / color / mirror / Atom feed
From: Nick Owens <mischief@offblast.org>
To: 9front@9front.org
Subject: two nusb tweaks
Date: Tue, 14 Feb 2017 22:04:41 -0800	[thread overview]
Message-ID: <CAH_zEu4+k0Ry_d-1V21kYYi3ijEgren343UjNAbHThFE7C35Yg@mail.gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 654 bytes --]

attached is a patch for two tweaks to nusb.

one is to hack in support for USB attached SCSI protocol in nusb/disk.
i don't think this is really correct, but somehow lets nusb/disk talk
bulk to my device (unitek Y-3363). still slow as a dog.

the other is for nusb/ptp to correctly represent directories that my
phone (LG G5) presents. the association type that my phone sends is 0
(Undefined), but it does correctly say the type is association
(0x3001). without this, i just see the directiories as 'files'.

i would appreciate any testing if someone has a USB UAS device, or
cell phone/camera with MTP capabilities.

if these are ok, i'll commit them.

[-- Attachment #2: nusb.diff --]
[-- Type: text/plain, Size: 1486 bytes --]

diff -r 12e494045696 sys/src/cmd/nusb/disk/disk.c
--- a/sys/src/cmd/nusb/disk/disk.c	Mon Feb 13 22:28:35 2017 +0100
+++ b/sys/src/cmd/nusb/disk/disk.c	Wed Feb 15 05:53:52 2017 -0800
@@ -939,7 +939,7 @@
 			continue;
 		csp = ep->iface->csp;
 		sc = Subclass(csp);
-		if(!(Class(csp) == Clstorage && (Proto(csp) == Protobulk)))
+		if(!(Class(csp) == Clstorage && (Proto(csp) == Protobulk || Proto(csp) == Protouasp)))
 			continue;
 		if(sc != Subatapi && sc != Sub8070 && sc != Subscsi)
 			fprint(2, "disk: subclass %#ulx not supported. trying anyway\n", sc);
diff -r 12e494045696 sys/src/cmd/nusb/disk/ums.h
--- a/sys/src/cmd/nusb/disk/ums.h	Mon Feb 13 22:28:35 2017 +0100
+++ b/sys/src/cmd/nusb/disk/ums.h	Wed Feb 15 05:53:52 2017 -0800
@@ -14,6 +14,7 @@
 	Protocbi =	0,	/* control/bulk/interrupt; mainly floppies */
 	Protocb =	1,	/*   "  with no interrupt; mainly floppies */
 	Protobulk =	0x50,	/* bulk only */
+	Protouasp =	0x62,	/* USB attached SCSI protocol */
 
 	Subrbc =	1,	/* reduced blk cmds */
 	Subatapi =	2,	/* cd/dvd using sff-8020i or mmc-2 cmd blks */
diff -r 12e494045696 sys/src/cmd/nusb/ptp/ptp.c
--- a/sys/src/cmd/nusb/ptp/ptp.c	Mon Feb 13 22:28:35 2017 +0100
+++ b/sys/src/cmd/nusb/ptp/ptp.c	Wed Feb 15 05:53:52 2017 -0800
@@ -555,7 +555,7 @@
 		x->handle = NUM(path);
 		x->store = GET4(p);
 		x->format = GET2(p+4);
-		if(x->format == 0x3001 && GET2(p+42) == 1){
+		if(x->format == 0x3001){
 			x->d.qid.type = QTDIR;
 			x->d.mode = DMDIR|0777;
 		} else {


             reply	other threads:[~2017-02-15  6:05 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-15  6:04 Nick Owens [this message]
2017-02-15  8:01 ` [9front] " cinap_lenrek

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAH_zEu4+k0Ry_d-1V21kYYi3ijEgren343UjNAbHThFE7C35Yg@mail.gmail.com \
    --to=mischief@offblast.org \
    --cc=9front@9front.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).