From: "Олег Бахарев" <disconnectix@gmail.com>
To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net>
Subject: Re: [9fans] How read data from USB-device ?
Date: Thu, 16 Aug 2018 16:00:13 +0300 [thread overview]
Message-ID: <CALp9=o+C3=AaSiZHSMVMoOdkmma7YpooaiOt3UBeR644qTpOOg@mail.gmail.com> (raw)
In-Reply-To: <CALp9=oL7iYDrvKaMBVzTfo8UxnHx6UhcBtC-1pzR6jyB_jPicg@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 1640 bytes --]
Solved. File has been opened for read-only operations. Fixed.
2018-08-16 15:50 GMT+03:00 Олег Бахарев <disconnectix@gmail.com>:
> Not work (
> Program itself:
>
> package main
>
> import(
> "flag"
> "fmt"
> "os"
> )
>
> func main() {
>
> var color = flag.Int("color", 0x00000000, "Color value")
> flag.Parse()
>
> var hexColor uint32 = uint32(*color)
>
> var rgb [3]byte;
> rgb[2] = byte(hexColor & 0x000000ff)
> rgb[1] = byte((hexColor & 0x0000ff00) >> 8)
> rgb[0] = byte((hexColor & 0x00ff0000) >> 16)
>
> usbControl, controlErr := os.Open("/dev/eiaU5/eiaUctl")
>
> if controlErr != nil {
> fmt.Println(controlErr)
> os.Exit(1)
> }
> defer usbControl.Close()
>
> usbControl.WriteString("b9600")
> usbControl.Sync()
>
> usbFile, usbErr := os.Open("/dev/eiaU5/eiaU")
>
> if usbErr != nil {
> fmt.Println(usbErr)
> os.Exit(1)
> }
> defer usbFile.Close()
>
> fmt.Print(rgb[0])
> fmt.Print(rgb[1])
> fmt.Print(rgb[2])
>
> usbFile.Write(rgb[:])
> }
>
> 2018-08-16 14:26 GMT+03:00 Richard Miller <9fans@hamnavoe.com>:
>
>> > I encountered some problem: there is a trivial program on Go that
>> > writes to the files / dev / eiaU4 / eiaUctl and / dev / eiaU the
>>
>> I hope you meant /dev/eiaU4/eiaU, not /dev/eiaU
>>
>> Unless you do a "bind -a /dev/eiaU4 /dev" after starting the usb
>> serial driver, which allows you to reference the device files
>> as /dev/eiaUctl and /dev/eiaU and not have to remember the unit number.
>>
>>
>>
>
[-- Attachment #2: Type: text/html, Size: 2585 bytes --]
prev parent reply other threads:[~2018-08-16 13:00 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-08-13 22:45 Олег Бахарев
2018-08-14 7:45 ` Steve Simon
2018-08-14 7:54 ` Richard Miller
2018-08-14 8:32 ` Олег Бахарев
2018-08-14 9:46 ` Richard Miller
2018-08-14 11:09 ` Олег Бахарев
2018-08-14 11:19 ` Олег Бахарев
2018-08-14 12:16 ` Richard Miller
2018-08-14 16:36 ` Олег Бахарев
2018-08-15 23:03 ` Олег Бахарев
2018-08-16 11:26 ` Richard Miller
2018-08-16 12:50 ` Олег Бахарев
2018-08-16 13:00 ` Олег Бахарев [this message]
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='CALp9=o+C3=AaSiZHSMVMoOdkmma7YpooaiOt3UBeR644qTpOOg@mail.gmail.com' \
--to=disconnectix@gmail.com \
--cc=9fans@9fans.net \
/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).