Skip to content

Commit

Permalink
Changes to support Logic3 Rock Candy Controller for Xbox One
Browse files Browse the repository at this point in the history
  • Loading branch information
Ignacio Quezada committed Oct 14, 2015
1 parent c6efaf7 commit 6c4842e
Showing 1 changed file with 26 additions and 2 deletions.
28 changes: 26 additions & 2 deletions xbox.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,8 @@ func main() {
*/
model = modelInfo{1, 0, 0, 1, 1, "360"}

case desc.Vendor == 0x045e && desc.Product == 0x02d1:
// case desc.Vendor == 0x045e && desc.Product == 0x02d1:
case desc.Vendor == 0x0e6f && desc.Product == 0x0146:
log.Printf("Found Microsoft Xbox One controller")
/*
250.006 045e:02d1 Unknown (Microsoft Corp.)
Expand Down Expand Up @@ -140,6 +141,7 @@ func main() {
}
return true
})
log.Printf("dev %s", devs)
if err != nil {
log.Fatalf("listdevices: %s", err)
}
Expand Down Expand Up @@ -428,8 +430,30 @@ func XBoxOne(controller *usb.Device, in, out usb.Endpoint) {
var err error

// Initializ
err = write(0x05, 0x20)
//err = write(0x05, 0x20)
//dieIf(err, "initialization")
read()
err = write(0x04, 0x20, 0x01, 0x00)
dieIf(err, "initialization")
read()
err = write(0x01, 0x20, 0x01, 0x09, 0x00, 0x04, 0x20, 0x3a, 0x00, 0x00, 0x00, 0x80, 0x00)
dieIf(err, "initialization")
read()
read()
read()
err = write(0x01, 0x20, 0x01, 0x09, 0x00, 0x04, 0x20, 0xba, 0x00, 0x00, 0x00, 0x00, 0x00)
dieIf(err, "initialization")
read()
err = write(0x05, 0x20, 0x02, 0x09, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x55, 0x53)
dieIf(err, "initialization")
read()
err = write(0x05, 0x20, 0x03, 0x01, 0x00)

This comment has been minimized.

Copy link
@paroj
dieIf(err, "initialization")
read()
read()
err = write(0x0a, 0x20, 0x04, 0x03, 0x00, 0x01, 0x14)
read()


decode := func(data []byte) {
if len(data) != 16 {
Expand Down

1 comment on commit 6c4842e

@paroj
Copy link

@paroj paroj commented on 6c4842e Oct 15, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the xpad driver currently does not really allow to send multiple packets one after another. If all of the above packets are indeed needed, you can try usb_interrupt_msg API or modify xpad_irq_out to send the next packet once the first is through..

Please sign in to comment.